aboutsummaryrefslogtreecommitdiffstats
path: root/tests/run_tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run_tests.sh')
-rwxr-xr-xtests/run_tests.sh109
1 files changed, 101 insertions, 8 deletions
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index ed489dbdd269..3fa7c0a7fc98 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -6,6 +6,11 @@ if [ -z "$CC" ]; then
CC=gcc
fi
+# stat differs between platforms
+if [ -z "$STATSZ" ]; then
+ STATSZ="stat -c %s"
+fi
+
export QUIET_TEST=1
STOP_ON_FAIL=0
@@ -114,7 +119,7 @@ run_wrap_error_test () {
# $2: align base
check_align () {
shorten_echo "check_align $@: "
- local size=$(stat -c %s "$1")
+ local size=$($STATSZ "$1")
local align="$2"
(
if [ $(($size % $align)) -eq 0 ] ;then
@@ -157,7 +162,15 @@ run_fdtdump_test() {
file="$1"
shorten_echo fdtdump-runtest.sh "$file"
printf ": "
- base_run_test sh fdtdump-runtest.sh "$file"
+ base_run_test sh fdtdump-runtest.sh "$file" 2>/dev/null
+}
+
+run_fdtoverlay_test() {
+ expect="$1"
+ shift
+ shorten_echo fdtoverlay-runtest.sh "$expect" "$@"
+ printf ": "
+ base_run_test sh fdtoverlay-runtest.sh "$expect" "$@"
}
BAD_FIXUP_TREES="bad_index \
@@ -197,6 +210,12 @@ libfdt_overlay_tests () {
run_test overlay overlay_base_manual_symbols.test.dtb overlay_overlay_manual_fixups.test.dtb
+ # test simplified plugin syntax
+ run_dtc_test -@ -I dts -O dtb -o overlay_overlay_simple.dtb overlay_overlay_simple.dts
+
+ # verify non-generation of local fixups
+ run_test check_path overlay_overlay_simple.dtb not-exists "/__local_fixups__"
+
# Bad fixup tests
for test in $BAD_FIXUP_TREES; do
tree="overlay_bad_fixup_$test"
@@ -420,7 +439,7 @@ dtc_tests () {
run_dtc_test -I dts -O dtb -o dtc_path-references.test.dtb path-references.dts
run_test path-references dtc_path-references.test.dtb
- run_test phandle_format dtc_references.test.dtb both
+ run_test phandle_format dtc_references.test.dtb epapr
for f in legacy epapr both; do
run_dtc_test -I dts -O dtb -H $f -o dtc_references.test.$f.dtb references.dts
run_test phandle_format dtc_references.test.$f.dtb $f
@@ -532,7 +551,10 @@ dtc_tests () {
check_tests bad-name-property.dts name_properties
check_tests bad-ncells.dts address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell
- check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string
+ check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string label_is_string compatible_is_string_list names_is_string_list
+ check_tests bad-chosen.dts chosen_node_is_root
+ check_tests bad-chosen.dts chosen_node_bootargs
+ check_tests bad-chosen.dts chosen_node_stdout_path
check_tests bad-reg-ranges.dts reg_format ranges_format
check_tests bad-empty-ranges.dts ranges_format
check_tests reg-ranges-root.dts reg_format ranges_format
@@ -540,6 +562,12 @@ dtc_tests () {
check_tests obsolete-chosen-interrupt-controller.dts obsolete_chosen_interrupt_controller
check_tests reg-without-unit-addr.dts unit_address_vs_reg
check_tests unit-addr-without-reg.dts unit_address_vs_reg
+ check_tests unit-addr-leading-0x.dts unit_address_format
+ check_tests unit-addr-leading-0s.dts unit_address_format
+ check_tests bad-phandle-cells.dts interrupts_extended_property
+ check_tests bad-gpio.dts gpios_property
+ run_sh_test dtc-checkfails.sh deprecated_gpio_property -- -Wdeprecated_gpio_property -I dts -O dtb bad-gpio.dts
+ check_tests bad-interrupt-cells.dts interrupts_property
run_sh_test dtc-checkfails.sh node_name_chars -- -I dtb -O dtb bad_node_char.dtb
run_sh_test dtc-checkfails.sh node_name_format -- -I dtb -O dtb bad_node_format.dtb
run_sh_test dtc-checkfails.sh prop_name_chars -- -I dtb -O dtb bad_prop_char.dtb
@@ -554,6 +582,10 @@ dtc_tests () {
run_test check_path test_tree1.dtb exists "/subnode@1"
run_test check_path test_tree1.dtb not-exists "/subnode@10"
+ check_tests pci-bridge-ok.dts -n pci_bridge
+ check_tests pci-bridge-bad1.dts pci_bridge
+ check_tests pci-bridge-bad2.dts pci_bridge
+
# Check warning options
run_sh_test dtc-checkfails.sh address_cells_is_cell interrupt_cells_is_cell -n size_cells_is_cell -- -Wno_size_cells_is_cell -I dts -O dtb bad-ncells.dts
run_sh_test dtc-fails.sh -n test-warn-output.test.dtb -I dts -O dtb bad-ncells.dts
@@ -690,7 +722,7 @@ fdtput_tests () {
text=lorem.txt
# Allow just enough space for $text
- run_dtc_test -O dtb -p $(stat -c %s $text) -o $dtb $dts
+ run_dtc_test -O dtb -p $($STATSZ $text) -o $dtb $dts
# run_fdtput_test <expected-result> <file> <node> <property> <flags> <value>
run_fdtput_test "a_model" $dtb / model -ts "a_model"
@@ -709,7 +741,7 @@ fdtput_tests () {
run_fdtput_test "$(cat $text $text)" $dtb /randomnode blob -ts "$(cat $text $text)"
# Start again with a fresh dtb
- run_dtc_test -O dtb -p $(stat -c %s $text) -o $dtb $dts
+ run_dtc_test -O dtb -p $($STATSZ $text) -o $dtb $dts
# Node creation
run_wrap_error_test $DTPUT $dtb -c /baldrick sod
@@ -737,7 +769,7 @@ fdtput_tests () {
run_wrap_test $DTPUT $dtb -cp /chosen/son
# Start again with a fresh dtb
- run_dtc_test -O dtb -p $(stat -c %s $text) -o $dtb $dts
+ run_dtc_test -O dtb -p $($STATSZ $text) -o $dtb $dts
# Node delete
run_wrap_test $DTPUT $dtb -c /chosen/node1 /chosen/node2 /chosen/node3
@@ -769,6 +801,55 @@ fdtdump_tests () {
run_fdtdump_test fdtdump.dts
}
+fdtoverlay_tests() {
+ base=overlay_base.dts
+ basedtb=overlay_base.fdoverlay.test.dtb
+ overlay=overlay_overlay_manual_fixups.dts
+ overlaydtb=overlay_overlay_manual_fixups.fdoverlay.test.dtb
+ targetdtb=target.fdoverlay.test.dtb
+
+ run_dtc_test -@ -I dts -O dtb -o $basedtb $base
+ run_dtc_test -@ -I dts -O dtb -o $overlaydtb $overlay
+
+ # test that the new property is installed
+ run_fdtoverlay_test foobar "/test-node" "test-str-property" "-ts" ${basedtb} ${targetdtb} ${overlaydtb}
+
+ stacked_base=stacked_overlay_base.dts
+ stacked_basedtb=stacked_overlay_base.fdtoverlay.test.dtb
+ stacked_bar=stacked_overlay_bar.dts
+ stacked_bardtb=stacked_overlay_bar.fdtoverlay.test.dtb
+ stacked_baz=stacked_overlay_baz.dts
+ stacked_bazdtb=stacked_overlay_baz.fdtoverlay.test.dtb
+ stacked_targetdtb=stacked_overlay_target.fdtoverlay.test.dtb
+
+ run_dtc_test -@ -I dts -O dtb -o $stacked_basedtb $stacked_base
+ run_dtc_test -@ -I dts -O dtb -o $stacked_bardtb $stacked_bar
+ run_dtc_test -@ -I dts -O dtb -o $stacked_bazdtb $stacked_baz
+
+ # test that baz correctly inserted the property
+ run_fdtoverlay_test baz "/foonode/barnode/baznode" "baz-property" "-ts" ${stacked_basedtb} ${stacked_targetdtb} ${stacked_bardtb} ${stacked_bazdtb}
+}
+
+pylibfdt_tests () {
+ TMP=/tmp/tests.stderr.$$
+ python pylibfdt_tests.py -v 2> $TMP
+
+ # Use the 'ok' message meaning the test passed, 'ERROR' meaning it failed
+ # and the summary line for total tests (e.g. 'Ran 17 tests in 0.002s').
+ # We could add pass + fail to get total tests, but this provides a useful
+ # sanity check.
+ pass_count=$(grep "\.\.\. ok$" $TMP | wc -l)
+ fail_count=$(grep "^ERROR: " $TMP | wc -l)
+ total_tests=$(sed -n 's/^Ran \([0-9]*\) tests.*$/\1/p' $TMP)
+ cat $TMP
+ rm $TMP
+
+ # Extract the test results and add them to our totals
+ tot_fail=$((tot_fail + $fail_count))
+ tot_pass=$((tot_pass + $pass_count))
+ tot_tests=$((tot_tests + $total_tests))
+}
+
while getopts "vt:me" ARG ; do
case $ARG in
"v")
@@ -787,7 +868,12 @@ while getopts "vt:me" ARG ; do
done
if [ -z "$TESTSETS" ]; then
- TESTSETS="libfdt utilfdt dtc dtbs_equal fdtget fdtput fdtdump"
+ TESTSETS="libfdt utilfdt dtc dtbs_equal fdtget fdtput fdtdump fdtoverlay"
+
+ # Test pylibfdt if the libfdt Python module is available.
+ if [ -f ../pylibfdt/_libfdt.so ]; then
+ TESTSETS="$TESTSETS pylibfdt"
+ fi
fi
# Make sure we don't have stale blobs lying around
@@ -816,6 +902,12 @@ for set in $TESTSETS; do
"fdtdump")
fdtdump_tests
;;
+ "pylibfdt")
+ pylibfdt_tests
+ ;;
+ "fdtoverlay")
+ fdtoverlay_tests
+ ;;
esac
done
@@ -830,3 +922,4 @@ fi
echo "* Strange test result: $tot_strange"
echo "**********"
+[ "$tot_tests" -eq "$tot_pass" ] || exit 1