Commit graph

10 commits

Author SHA1 Message Date
David Gibson
d5399197e9 Allow toggling of semantic checks
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>
2012-07-08 13:45:21 -05:00
David Gibson
c879a8a28b Factor signal checks out of test scripts
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>
2012-02-03 08:38:40 -06:00
David Gibson
2ca83614e7 Use 'trap' builtin to clean up temporaries in test scripts
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>
2012-02-03 08:36:35 -06:00
David Gibson
9a50d82c4e Remove unused variable from test scripts
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>
2012-02-03 08:35:38 -06:00
David Gibson
fc6e6f8d91 dtc: Remove some small bashisms from test scripts
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>
2008-05-29 08:16:03 -05:00
David Gibson
68fe10ba4e dtc: Assorted improvements to test harness
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>
2008-03-23 08:00:33 -05:00
David Gibson
a68cbc09ff dtc: Fix silly typo in dtc-checkfails.sh
Too much C coding makes for dumb errors in shell.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-12-07 07:47:45 -06:00
David Gibson
0d9d10184b dtc: Make dtc-checfails.sh script catch deaths-by-signal
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>
2007-12-07 07:45:44 -06:00
David Gibson
5ba0086bfd dtc: More detailed testing of tree checks
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>
2007-12-06 09:15:19 -06:00
David Gibson
0d6ade2547 dtc: Add testcases for tree checks
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>
2007-11-20 09:03:51 -06:00