This patch adds -W and -E options to dtc which allow toggling on and off
of the various built in semantic checks on the tree.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Several test scripts now have some code to check for a program returning
a signal, and reporting a suitable failure. This patch moves this
duplicated code into a helper function in tests.sh. At the same time we
remove a bashism found in the current copies (using the non portablr $[ ]
construct for arithmetic).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Some of the test scripts create temporary files, which we remove at the
end. Except that we usually forgot to remove them on some exit paths. To
avoid this problem in future, this modifies the scripts to use the shell's
trap 0 functionality to automatically remove the temporaries on any exit.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Several of the test scripts remove $TMPFILE, without ever having set
the TMPFILE variable. This patch fixes it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Some of the helper scripts used to run testcases contain some
constructs that are bashisms. Or at least which don't work on dash,
the minimal shell used as /bin/sh on recent Ubuntu systems.
This patch removes these constructs so that the testsuite will pass
"out of the box" on systems where /bin/sh is dash.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch makes several small improvements to the test harness.
* An altered way of invoking shell script testcases from run_tests.sh
means scripts no longer need to me marked executable in the
repository to work properly.
* dtc.sh never did anything that was really dtc specific - with the
exception of messages, it would work equally well for any binary
that returns 0 in the successful case. Therefore, generalise dtc.sh
and fold it into run_tests.sh so we don't need a separate script any
more.
* Tweak various things so that the valgrind options are properly
propagated down to invoke dtc under valgrind when called via wrapper
scripts.
* Tweak the valgrind suppressions to work properly on a wider range of
systems (this was necessary on my machine running Ubuntu Hardy).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Since commit 5ba0086bfd, the
dtc-checkfails.sh script does not check the return code from dtc.
That's reasonable, since depending on the checks we're testing, dtc
could either complete succesfully or return an error.
However, it's never right for dtc to SEGV or otherwise be killed by a
signal. So the script should catch that, and fail the testcase if it
happens. This patch implements this behaviour.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch modifies the dtc-checkfails.sh testcase wrapper so that
instead of testing just that dtc fails with a particular error code on
the sample input, it scans dtc's stderr output looking for a message
that dtc failed a specific check or checks. This has several advantages:
- It means we more precisely check dtc's checking behaviour
- It means we can check for generation of warnings using the
same script
- It means we can test cases where dtc should generate
multiple errors or warnings from different checks
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch adds a group of testcases to check that dtc correctly
rejects trees with various structural errors.
To make things easier to test, we change dtc so that failing checks
(as opposed to other errors) result in exit code 2.
This patch also fixes an embarrasing bug uncovered by these new tests:
check_phandles() worked out if the tree's phandles were valid, then
throws that information away and returns success always.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>