Age | Commit message (Collapse) | Author |
|
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.
|
|
Useful for bulk testing modules, where some might not have required
external (non-CCAN) dependencies.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
We weren't using the compiler and cflags options in tools/compile.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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
|
|
Move ccan_dir determination out to its own function, rather than implying it
by the first time we get the manifest of a module.
|
|
Other tools will soon want to use this, so make it independent.
(eg. ccantool).
|
|
Gets rid of generated file.
|
|
It's much easier to simply say "keep all", and it simplifies the code
quite a bit.
|
|
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).
|
|
Rather than walking the list of tests manually, use
dgraph_traverse_to() to run the tests.
|
|
Instead of a linked list of tests, we use dgraph and strmap.
|
|
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.
|
|
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.
|
|
Measuring ccanlint -d ccan/tdb2 on my dual core hyperthread laptop gives:
Before: 6:47
After: 5:59
|
|
We use the lbalance module to figure out how many to run in parallel.
|
|
Rather than a separate cov_compiled member, we can add to the
compiled[] array, and we reduce duplication significantly.
|
|
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.
|
|
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.
|
|
We'll need this in a moment.
|
|
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.
|
|
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.
|
|
This improves on the current ad-hoc methods, and also fixes a bug where
we mapped "GPLv2" to the GPLv3 symlink.
|
|
Otherwise, _GNU_SOURCE isn't defined (for example) so prototypes such as
isblank can be missing.
|
|
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.
|
|
Be a little more careful with const.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
Joey Adams also pointed out that we should use strings for the dependency
lists. Moving them into the structure also somewhat simplifies it.
|
|
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).
|
|
Now it will build copies of other ccan deps if it can't find them.
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
Much easier to run just a single test across the tree.
|
|
Comments of form "// [given x] outputs y" we can check the examples do as expected.
|
|
Now we get long options!
|
|
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".
|
|
This is a precursor to doing something useful with them.
|
|
eg. -v dumps percentage of coverage, -vv dumps per-line data, -vvv dumps every command executed.
|
|
|
|
Particularly useful for building tests standalone.
|
|
|
|
|
|
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.
|
|
|
|
|