Browse Source
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>main
David Gibson
17 years ago
committed by
Jon Loeliger
11 changed files with 90 additions and 21 deletions
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
#! /bin/sh |
||||
|
||||
. tests.sh |
||||
|
||||
TMPFILE="tmp.out.$$" |
||||
|
||||
rm -f $TMPFILE |
||||
|
||||
verbose_run "$DTC" -o $TMPFILE "$@" |
||||
ret="$?" |
||||
|
||||
if [ -f $TMPFILE ]; then |
||||
FAIL "output file was created despite bad input" |
||||
fi |
||||
|
||||
if [ "$ret" = "2" ]; then |
||||
PASS |
||||
else |
||||
FAIL "dtc returned error code $ret instead of 2 (check failed)" |
||||
fi |
||||
|
||||
rm -f $TMPFILE |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
node { |
||||
}; |
||||
node { |
||||
}; |
||||
}; |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
node1 { |
||||
linux,phandle = <1>; |
||||
}; |
||||
node2 { |
||||
linux,phandle = <1>; |
||||
}; |
||||
}; |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
prop; |
||||
prop; |
||||
}; |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
node { |
||||
linux,phandle = <0xffffffff>; |
||||
}; |
||||
}; |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
# Common functions for shell testcases |
||||
|
||||
PASS () { |
||||
echo "PASS" |
||||
exit 0 |
||||
} |
||||
|
||||
FAIL () { |
||||
echo "FAIL" "$@" |
||||
exit 2 |
||||
} |
||||
|
||||
DTC=../dtc |
||||
|
||||
verbose_run () { |
||||
if [ -z "$QUIET_TEST" ]; then |
||||
"$@" |
||||
else |
||||
"$@" > /dev/null 2> /dev/null |
||||
fi |
||||
} |
Loading…
Reference in new issue