2006-11-27 06:21:28 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
export QUIET_TEST=1
|
|
|
|
|
|
|
|
ENV=/usr/bin/env
|
|
|
|
|
2007-06-26 03:33:10 +02:00
|
|
|
tot_tests=0
|
|
|
|
tot_pass=0
|
|
|
|
tot_fail=0
|
|
|
|
tot_config=0
|
|
|
|
tot_strange=0
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
run_test () {
|
2007-06-26 03:33:10 +02:00
|
|
|
tot_tests=$[tot_tests + 1]
|
2006-11-27 06:21:28 +01:00
|
|
|
echo -n "$@: "
|
2007-06-26 03:33:10 +02:00
|
|
|
if PATH=".:$PATH" $ENV "$@"; then
|
|
|
|
tot_pass=$[tot_pass + 1]
|
|
|
|
else
|
2007-08-29 04:18:51 +02:00
|
|
|
ret="$?"
|
|
|
|
if [ "$ret" == "1" ]; then
|
|
|
|
tot_config=$[tot_config + 1]
|
|
|
|
elif [ "$ret" == "2" ]; then
|
|
|
|
tot_fail=$[tot_fail + 1]
|
|
|
|
else
|
|
|
|
tot_strange=$[tot_strange + 1]
|
|
|
|
fi
|
2007-06-26 03:33:10 +02:00
|
|
|
fi
|
2006-11-27 06:21:28 +01:00
|
|
|
}
|
|
|
|
|
2006-11-28 07:20:01 +01:00
|
|
|
tree1_tests () {
|
|
|
|
TREE=$1
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
# Read-only tests
|
2007-10-10 09:12:12 +02:00
|
|
|
run_test get_mem_rsv $TREE
|
2006-11-28 07:20:01 +01:00
|
|
|
run_test root_node $TREE
|
2006-12-11 06:15:34 +01:00
|
|
|
run_test find_property $TREE
|
2006-11-28 07:20:01 +01:00
|
|
|
run_test subnode_offset $TREE
|
|
|
|
run_test path_offset $TREE
|
2007-08-30 06:54:04 +02:00
|
|
|
run_test get_name $TREE
|
2006-11-28 07:20:01 +01:00
|
|
|
run_test getprop $TREE
|
2007-08-30 06:54:04 +02:00
|
|
|
run_test get_path $TREE
|
2007-08-30 06:54:04 +02:00
|
|
|
run_test supernode_atdepth_offset $TREE
|
|
|
|
run_test parent_offset $TREE
|
2007-09-17 06:28:34 +02:00
|
|
|
run_test node_offset_by_prop_value $TREE
|
2007-10-16 05:58:25 +02:00
|
|
|
run_test node_check_compatible $TREE
|
|
|
|
run_test node_offset_by_compatible $TREE
|
2006-11-28 07:20:01 +01:00
|
|
|
run_test notfound $TREE
|
2006-11-27 06:21:28 +01:00
|
|
|
|
|
|
|
# Write-in-place tests
|
2006-11-28 07:20:01 +01:00
|
|
|
run_test setprop_inplace $TREE
|
|
|
|
run_test nop_property $TREE
|
|
|
|
run_test nop_node $TREE
|
|
|
|
}
|
|
|
|
|
2007-09-28 06:57:01 +02:00
|
|
|
tree1_tests_rw () {
|
|
|
|
TREE=$1
|
|
|
|
|
|
|
|
# Read-write tests
|
|
|
|
run_test setprop $TREE
|
|
|
|
run_test del_property $TREE
|
|
|
|
run_test del_node $TREE
|
|
|
|
}
|
|
|
|
|
2007-11-01 01:37:31 +01:00
|
|
|
ALL_LAYOUTS="mts mst tms tsm smt stm"
|
|
|
|
|
2007-09-17 06:39:24 +02:00
|
|
|
libfdt_tests () {
|
2006-11-28 07:20:01 +01:00
|
|
|
tree1_tests test_tree1.dtb
|
2006-11-29 06:45:46 +01:00
|
|
|
|
|
|
|
# Sequential write tests
|
|
|
|
run_test sw_tree1
|
|
|
|
tree1_tests sw_tree1.test.dtb
|
|
|
|
tree1_tests unfinished_tree1.test.dtb
|
2007-11-06 00:42:45 +01:00
|
|
|
run_test dtbs_equal_ordered test_tree1.dtb sw_tree1.test.dtb
|
2006-12-01 05:07:19 +01:00
|
|
|
|
|
|
|
# fdt_move tests
|
|
|
|
for tree in test_tree1.dtb sw_tree1.test.dtb unfinished_tree1.test.dtb; do
|
|
|
|
rm -f moved.$tree shunted.$tree deshunted.$tree
|
|
|
|
run_test move_and_save $tree
|
|
|
|
tree1_tests moved.$tree
|
|
|
|
tree1_tests shunted.$tree
|
|
|
|
tree1_tests deshunted.$tree
|
|
|
|
done
|
2006-12-01 06:59:43 +01:00
|
|
|
|
2007-10-25 07:05:58 +02:00
|
|
|
# v16 and alternate layout tests
|
|
|
|
for tree in test_tree1.dtb; do
|
|
|
|
for version in 17 16; do
|
2007-11-01 01:37:31 +01:00
|
|
|
for layout in $ALL_LAYOUTS; do
|
2007-10-25 07:05:58 +02:00
|
|
|
run_test mangle-layout $tree $version $layout
|
|
|
|
tree1_tests v$version.$layout.$tree
|
|
|
|
run_test dtbs_equal_ordered $tree v$version.$layout.$tree
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2006-12-01 06:59:43 +01:00
|
|
|
# Read-write tests
|
2007-11-01 01:37:31 +01:00
|
|
|
for basetree in test_tree1.dtb; do
|
|
|
|
for version in 17 16; do
|
|
|
|
for layout in $ALL_LAYOUTS; do
|
|
|
|
tree=v$version.$layout.$basetree
|
|
|
|
rm -f opened.$tree repacked.$tree
|
|
|
|
run_test open_pack $tree
|
|
|
|
tree1_tests $tree
|
|
|
|
tree1_tests opened.$tree
|
|
|
|
tree1_tests repacked.$tree
|
|
|
|
|
|
|
|
tree1_tests_rw $tree
|
|
|
|
tree1_tests_rw opened.$tree
|
|
|
|
tree1_tests_rw repacked.$tree
|
|
|
|
done
|
|
|
|
done
|
2007-09-28 06:57:01 +02:00
|
|
|
done
|
2006-12-01 06:59:43 +01:00
|
|
|
run_test rw_tree1
|
|
|
|
tree1_tests rw_tree1.test.dtb
|
2007-09-28 06:57:01 +02:00
|
|
|
tree1_tests_rw rw_tree1.test.dtb
|
2006-12-14 05:29:25 +01:00
|
|
|
|
|
|
|
# Tests for behaviour on various sorts of corrupted trees
|
|
|
|
run_test truncated_property
|
2006-11-27 06:21:28 +01:00
|
|
|
}
|
|
|
|
|
2007-09-18 02:33:40 +02:00
|
|
|
dtc_tests () {
|
2007-10-18 09:22:30 +02:00
|
|
|
run_test dtc.sh -I dts -O dtb -o dtc_tree1.test.dtb test_tree1.dts
|
2007-09-18 02:33:40 +02:00
|
|
|
tree1_tests dtc_tree1.test.dtb
|
2007-09-28 06:57:01 +02:00
|
|
|
tree1_tests_rw dtc_tree1.test.dtb
|
2007-10-24 03:06:09 +02:00
|
|
|
run_test dtbs_equal_ordered dtc_tree1.test.dtb test_tree1.dtb
|
2007-10-16 08:42:02 +02:00
|
|
|
|
2007-10-18 09:22:30 +02:00
|
|
|
run_test dtc.sh -I dts -O dtb -o dtc_escapes.test.dtb escapes.dts
|
2007-10-16 08:42:02 +02:00
|
|
|
run_test string_escapes dtc_escapes.test.dtb
|
2007-09-18 02:33:40 +02:00
|
|
|
}
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
while getopts "vdt:" ARG ; do
|
|
|
|
case $ARG in
|
|
|
|
"v")
|
|
|
|
unset QUIET_TEST
|
|
|
|
;;
|
|
|
|
"t")
|
|
|
|
TESTSETS=$OPTARG
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$TESTSETS" ]; then
|
2007-09-18 02:33:40 +02:00
|
|
|
TESTSETS="libfdt dtc"
|
2006-11-27 06:21:28 +01:00
|
|
|
fi
|
|
|
|
|
2007-10-16 05:53:20 +02:00
|
|
|
# Make sure we don't have stale blobs lying around
|
|
|
|
rm -f *.test.dtb
|
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
for set in $TESTSETS; do
|
|
|
|
case $set in
|
2007-09-17 06:39:24 +02:00
|
|
|
"libfdt")
|
|
|
|
libfdt_tests
|
2006-11-27 06:21:28 +01:00
|
|
|
;;
|
2007-09-18 02:33:40 +02:00
|
|
|
"dtc")
|
|
|
|
dtc_tests
|
|
|
|
;;
|
2006-11-27 06:21:28 +01:00
|
|
|
esac
|
|
|
|
done
|
2007-06-26 03:33:10 +02:00
|
|
|
|
|
|
|
echo -e "********** TEST SUMMARY"
|
|
|
|
echo -e "* Total testcases: $tot_tests"
|
|
|
|
echo -e "* PASS: $tot_pass"
|
|
|
|
echo -e "* FAIL: $tot_fail"
|
|
|
|
echo -e "* Bad configuration: $tot_config"
|
|
|
|
echo -e "* Strange test result: $tot_strange"
|
|
|
|
echo -e "**********"
|
|
|
|
|