summaryrefslogtreecommitdiff
path: root/tools/ccanlint/ccanlint.h
AgeCommit message (Collapse)Author
2015-04-10ccanlint: avoid segfault when module_builds' linking failsPeter Barker
In the case that the objects built but linking failed, module_builds.c called score_file_error with a NULL ccan_file object and 0 for line number. score_file_error assumed that the ccan_file object it is passed was not-NULL when appending file errors to the score's aggregate error string. It attempted to dereference it to get "fullname". score_error was factored out from score_file_error. It takes a "source" parameter, which is the file's full name (and possibly line number) in the score_file_error case, and the ccan module name in the case of link failure.
2013-04-01ccanlint: --deps-fail-ignore.Rusty Russell
Useful for bulk testing modules, where some might not have required external (non-CCAN) dependencies. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-12-07ccanlint: fix --compiler and --cflags options to apply to _info files as well.Rusty Russell
We weren't using the compiler and cflags options in tools/compile. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-12-03tools: use tal instead of talloc.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-09-10tools: more intelligent caching for compile _info.Rusty Russell
We let the get_deps() caller hand us the compiled _info filename, but what about recursive dependencies? These we re-generate every time. So fix this: hand a generator callback to get_deps(), expose the one which simply compiles it, and add a ccanlint one which looks up the manifest to see if we have one already. Before: $ ccanlint -vvvv ccan/failtest | grep -c 'Creating.*_info' 31 After: $ ccanlint -vvvv ccan/failtest | grep -c 'Creating.*_info' 17
2012-03-19tools: explicit find_ccan_dir()Rusty Russell
Move ccan_dir determination out to its own function, rather than implying it by the first time we get the manifest of a module.
2012-03-19tools: split out manifest from ccanlintRusty Russell
Other tools will soon want to use this, so make it independent. (eg. ccantool).
2011-12-05ccanlint: use ccan/autodataRusty Russell
Gets rid of generated file.
2011-12-02ccanlint: remove argument to -k/--keepRusty Russell
It's much easier to simply say "keep all", and it simplifies the code quite a bit.
2011-12-02ccanlint: use traversal to trim tests we want to skip.Rusty Russell
Rather than using a separate index of tetst to skip, make sure tests we don't want to run are removed from the graph of tests to start with. This means that the "skip" field is only set when we fail a test (and thus must be reset when we test the next module).
2011-12-02ccanlint: use node traverse for --target.Rusty Russell
Rather than walking the list of tests manually, use dgraph_traverse_to() to run the tests.
2011-12-02ccanlint: use dgraph module.Rusty Russell
Instead of a linked list of tests, we use dgraph and strmap.
2011-12-02ccanlint: remove wart from info options.Rusty Russell
Make info_exists() call add_info_options() directly, rather than detecting that we've found _info inside the loop of tests. It means targeting is now a global, which is a bit sucky.
2011-12-01ccanlint: get rid of separate class of compulsory tests.Rusty Russell
It's reduced to a flag which means we stop processing the module. We have to enhance our dependencies a bit, but they've always been quite good. This simplifies things quite a bit.
2011-09-12ccanlint: compile tests in parallelRusty Russell
Measuring ccanlint -d ccan/tdb2 on my dual core hyperthread laptop gives: Before: 6:47 After: 5:59
2011-09-12ccanlint: infrastructure to run commands async.Rusty Russell
We use the lbalance module to figure out how many to run in parallel.
2011-08-30ccanlint: add coverage variant of files.Rusty Russell
Rather than a separate cov_compiled member, we can add to the compiled[] array, and we reduce duplication significantly.
2011-08-30ccanlint: keep separate array of compiled versions.Rusty Russell
Rather than mug the old ->compiled version when we reduce features, keep both in the structure. This makes it clear that we are using the right version (we weren't in all cases, in particular we weren't recompiling the test helpers correctly.
2011-08-30ccanlint: run tests under valgrind initially.Rusty Russell
Unless it's not available or suppressed, we might as well run it under valgrind the first time, which speeds things a little. We save the valgrind output file for tests_pass_valgrind's use later.
2011-08-30ccanlint: add is_excluded() helper.Rusty Russell
We'll need this in a moment.
2011-08-24ccanlint: allow per-file restrictions, so we don't have to remove all tests.Rusty Russell
For example, valgrind can't handle some things, so we may need to switch it off, but we don't want to do that for every test. So, start a standard format for per-file restrictions, eg: Ccanlint: tests_pass_valgrind test/foo.c:FAIL For the moment, only tests_pass_valgrind takes options, so it has to change: we now have a helper which returns the array of options applicable to a given file.
2011-07-21ccanlint: add simple check for comment referring to LICENSE file.Rusty Russell
After discussion with various developers (particularly the Samba team), there's a consensus that a reference to the license in each source file is useful. Since CCAN modules are designed to be cut and paste, this helps avoid any confusion should the LICENSE file go missing. We also detect standard boilerplates, in which case a one-line summary isn't necessary.
2011-07-19ccanlint: make a license enum, and parse the license string to set it.Rusty Russell
This improves on the current ad-hoc methods, and also fixes a bug where we mapped "GPLv2" to the GPLv3 symlink.
2011-04-27tools: always include config.h before anything else.Rusty Russell
Otherwise, _GNU_SOURCE isn't defined (for example) so prototypes such as isblank can be missing.
2011-03-22ccanlint: exit with non-zero exit status if a test fails.Rusty Russell
This means we change some minor tests to "never fail", eg. whitespace or documentation tests. Note that pass/fail is independent of the score for a test.
2011-03-22tools: fix up warnings with -Wwrite-strings.Rusty Russell
Be a little more careful with const.
2011-03-01ccanlint: --compiler and --cflags options.Rusty Russell
2011-03-01ccanlint: read config.h to get compilation flags at runtime.Rusty Russell
This means you don't have to recompile ccanlint to get the new flags; it's a small step towards making ccanlint useful outside the ccan repo.
2011-01-18ccanlint: fix _info option handlingRusty Russell
Two places were using a bogus ccanlint struct: the side-effect was that valgrind options didn't work, nor did license fixups. Make REGISTER_TEST do the extern declaration, and remove the bogus ones.
2011-01-17ccanlint: score_file_error() takes printf-formatRusty Russell
We simply build up the error string in score_file_error; a bit different but simpler than current behaviour. We keep around struct file_error because some tests need it.
2011-01-07ccanlint: list dependencies by keyRusty Russell
Joey Adams also pointed out that we should use strings for the dependency lists. Moving them into the structure also somewhat simplifies it.
2010-12-13ccanlint: report valgrind "definite" leaks.Rusty Russell
This is complicated by valgrind's limited options, and our desire not to run valgrind twice (it's already the slowest part of the tests). Ideally I'd like a different error code for each kind of error. I could parse and pretty-print the XML output, but instead I just parse the human-readable (which is fragile).
2010-11-23ccanlint: build depends if necessaryRusty Russell
Now it will build copies of other ccan deps if it can't find them.
2010-11-17ccanlint: add ccanlint section to _infoRusty Russell
This supersedes the previous Fails: section, into a more general set of lines of form: <testname> <option>... With the special <option> "FAIL" to mean we know we fail this test. We accept options to valgrind-tests; in particular tdb2 wants --partial-loads-ok=yes passed to valgrind.
2010-11-15ccanlint: print error information even if we pass.Rusty Russell
This means we can see messages even if we don't fail; ie. for compiler warnings once they are no longer fatal. This means that various tests have to be more careful in not setting score->error.
2010-11-10ccanlint: clarify different -v levels.Rusty Russell
2010-11-09ccanlint: rework so checks have more structure.Rusty Russell
Previously each check returned a void *, but in fact most of them fell into similar patterns. So define 'struct score' and a helper to add files to it, and use that. Under these rules, you get 0/1 if you skip a test because a dependency failed which in theory means your score (as a percentage) could drop if you fix a test.
2010-11-04ccanlint: add --targetRusty Russell
Much easier to run just a single test across the tree.
2010-11-04ccanlint: try running example code.Rusty Russell
Comments of form "// [given x] outputs y" we can check the examples do as expected.
2010-10-08ccanlint: use opt package.Rusty Russell
Now we get long options!
2010-10-06ccanlint: load file contents on demand, fix names for extracted examples.Rusty Russell
We had example names like "example-opt.h-opt_parse", which got trimmed to "example-opt". By using a basename of example-opt.h-opt_parse.c, we only strip the final ".c" not the middle ".h".
2010-09-25tools/ccanlint: extract examples in separate test.Rusty Russell
This is a precursor to doing something useful with them.
2010-08-30ccanlint: use up to three -v to mean more verbosity.Rusty Russell
eg. -v dumps percentage of coverage, -vv dumps per-line data, -vvv dumps every command executed.
2010-08-27ccanlint: use gcov to rate test coverage (score out of 5)Rusty Russell
2010-06-07ccanlint: Add -k option to keep results.Rusty Russell
Particularly useful for building tests standalone.
2010-06-07ccanlint: make sure fullname is always full path name.Rusty Russell
2010-04-09ccanlint: timeout, and implement -t option for quicker tests.Rusty Russell
2010-04-09From: Joseph Adams <joeyadams3.14159@gmail.com>Rusty Russell
The ccanlint patch is rather intrusive. First, it adds a new field to all the ccanlint tests, "key". key is a shorter, still unique description of the test (e.g. "valgrind"). The names I chose as keys for all the tests are somewhat arbitrary and often don't reflect the name of the .c source file (because some of those names are just too darn long). Second, it adds two new options to ccanlint: -l: list tests ccanlint performs -x: exclude tests (e.g. -x trailing_whitespace,valgrind) It also adds a consistency check making sure all tests have unique keys and names. The primary goal of the ccanlint patch was so I could exclude the valgrind test, which takes a really long time for some modules (I think btree takes the longest, at around 2 minutes). I'm not sure I did it 100% correctly, so you'll want to review it first.
2010-02-02ccanlint: fix directory issues properly.Rusty Russell
2010-01-19Make manifest code do chdir into appropriate directory.Rusty Russell