dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
#! /bin/sh
|
2006-11-27 06:21:28 +01:00
|
|
|
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
. ./tests.sh
|
2008-03-05 06:01:55 +01:00
|
|
|
|
2006-11-27 06:21:28 +01:00
|
|
|
export QUIET_TEST=1
|
|
|
|
|
2007-11-21 01:56:14 +01:00
|
|
|
export VALGRIND=
|
|
|
|
VGCODE=126
|
|
|
|
|
2007-06-26 03:33:10 +02:00
|
|
|
tot_tests=0
|
|
|
|
tot_pass=0
|
|
|
|
tot_fail=0
|
|
|
|
tot_config=0
|
2007-11-21 01:56:14 +01:00
|
|
|
tot_vg=0
|
2007-06-26 03:33:10 +02:00
|
|
|
tot_strange=0
|
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
base_run_test() {
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
tot_tests=$((tot_tests + 1))
|
2008-03-05 06:01:55 +01:00
|
|
|
if VALGRIND="$VALGRIND" "$@"; then
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
tot_pass=$((tot_pass + 1))
|
2007-06-26 03:33:10 +02:00
|
|
|
else
|
2007-08-29 04:18:51 +02:00
|
|
|
ret="$?"
|
|
|
|
if [ "$ret" == "1" ]; then
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
tot_config=$((tot_config + 1))
|
2007-08-29 04:18:51 +02:00
|
|
|
elif [ "$ret" == "2" ]; then
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
tot_fail=$((tot_fail + 1))
|
2007-11-21 01:56:14 +01:00
|
|
|
elif [ "$ret" == "$VGCODE" ]; then
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
tot_vg=$((tot_vg + 1))
|
2007-08-29 04:18:51 +02:00
|
|
|
else
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
tot_strange=$((tot_strange + 1))
|
2007-08-29 04:18:51 +02:00
|
|
|
fi
|
2007-06-26 03:33:10 +02:00
|
|
|
fi
|
2006-11-27 06:21:28 +01:00
|
|
|
}
|
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_test () {
|
|
|
|
echo -n "$@: "
|
|
|
|
if [ -n "$VALGRIND" -a -f $1.supp ]; then
|
|
|
|
VGSUPP="--suppressions=$1.supp"
|
|
|
|
fi
|
|
|
|
base_run_test $VALGRIND $VGSUPP "./$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
run_sh_test () {
|
|
|
|
echo -n "$@: "
|
|
|
|
base_run_test sh "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
wrap_test () {
|
|
|
|
(
|
|
|
|
if verbose_run "$@"; then
|
|
|
|
PASS
|
|
|
|
else
|
|
|
|
ret="$?"
|
|
|
|
if [ "$ret" -gt 127 ]; then
|
dtc: Address an assortment of portability problems
I've recently worked with a FreeBSD developer, getting dtc and libfdt
working on FreeBSD. This showed up a number of portability problems
in the dtc package which this patch addresses. Changes are as
follows:
- the parent_offset and supernode_atdepth_offset testcases
used the glibc extension functions strchrnul() and strndupa(). Those
are removed, using slightly longer coding with standard C functions
instead.
- some other testcases had a #define _GNU_SOURCE for no
particular reason. This is removed.
- run_tests.sh has bash specific constructs removed, and the
interpreter changed to /bin/sh. This apparently now runs fine on
FreeBSD's /bin/sh, and I've also tested it with both ash and dash.
- convert-dtsv0-lexer.l has some extra #includes added. These
must have been included indirectly with Linux and glibc, but aren't on
FreeBSD.
- the endian handling functions in libfdt_env.h, based on
endian.h and byteswap.h are replaced with some portable open-coded
versions. Unfortunately, these result in fairly crappy code when
compiled, but as far as I can determine there doesn't seem to be any
POSIX, SUS or de facto standard way of determining endianness at
compile time, nor standard names for byteswapping functions.
- some more endian handling, from testdata.h using the
problematic endian.h is simply removed, since it wasn't actually being
used anyway.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-06-26 03:03:49 +02:00
|
|
|
signame=$(kill -l $((ret - 128)))
|
2008-03-05 06:01:55 +01:00
|
|
|
FAIL "Killed by SIG$signame"
|
|
|
|
else
|
|
|
|
FAIL "Returned error code $ret"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
run_wrap_test () {
|
|
|
|
echo -n "$@: "
|
|
|
|
base_run_test wrap_test "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
run_dtc_test () {
|
|
|
|
echo -n "dtc $@: "
|
|
|
|
base_run_test wrap_test $VALGRIND $DTC "$@"
|
|
|
|
}
|
|
|
|
|
2008-05-15 08:39:12 +02:00
|
|
|
CONVERT=../convert-dtsv0
|
|
|
|
|
|
|
|
run_convert_test () {
|
|
|
|
echo -n "convert-dtsv0 $@: "
|
|
|
|
base_run_test wrap_test $VALGRIND $CONVERT "$@"
|
|
|
|
}
|
|
|
|
|
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-11-12 23:59:38 +01:00
|
|
|
run_test get_phandle $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-11-12 23:59:38 +01:00
|
|
|
run_test node_offset_by_phandle $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
|
2008-01-11 04:55:05 +01:00
|
|
|
run_test set_name $TREE
|
2007-09-28 06:57:01 +02:00
|
|
|
run_test setprop $TREE
|
|
|
|
run_test del_property $TREE
|
|
|
|
run_test del_node $TREE
|
|
|
|
}
|
|
|
|
|
2008-07-07 03:19:13 +02:00
|
|
|
check_tests () {
|
|
|
|
tree="$1"
|
|
|
|
shift
|
|
|
|
run_sh_test dtc-checkfails.sh "$@" -- -I dts -O dtb $tree
|
|
|
|
run_dtc_test -I dts -O dtb -o $tree.test.dtb -f $tree
|
|
|
|
run_sh_test dtc-checkfails.sh "$@" -- -I dtb -O dtb $tree.test.dtb
|
|
|
|
}
|
|
|
|
|
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
|
2007-11-21 01:29:18 +01:00
|
|
|
run_test dtbs_equal_ordered $tree moved.$tree
|
|
|
|
run_test dtbs_equal_ordered $tree shunted.$tree
|
|
|
|
run_test dtbs_equal_ordered $tree deshunted.$tree
|
2006-12-01 05:07:19 +01:00
|
|
|
done
|
2006-12-01 06:59:43 +01:00
|
|
|
|
2007-10-25 07:05:58 +02:00
|
|
|
# v16 and alternate layout tests
|
2007-11-21 01:29:18 +01:00
|
|
|
for tree in test_tree1.dtb; do
|
2007-10-25 07:05:58 +02:00
|
|
|
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-21 01:29:18 +01:00
|
|
|
for basetree in test_tree1.dtb; do
|
2007-11-01 01:37:31 +01:00
|
|
|
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 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
|
|
|
|
2008-02-18 06:09:25 +01:00
|
|
|
for basetree in test_tree1.dtb sw_tree1.test.dtb rw_tree1.test.dtb; do
|
|
|
|
run_test nopulate $basetree
|
|
|
|
run_test dtbs_equal_ordered $basetree noppy.$basetree
|
|
|
|
tree1_tests noppy.$basetree
|
|
|
|
tree1_tests_rw noppy.$basetree
|
|
|
|
done
|
|
|
|
|
2006-12-14 05:29:25 +01:00
|
|
|
# Tests for behaviour on various sorts of corrupted trees
|
|
|
|
run_test truncated_property
|
2008-02-14 06:50:34 +01:00
|
|
|
|
|
|
|
# Specific bug tests
|
|
|
|
run_test add_subnode_with_nops
|
2006-11-27 06:21:28 +01:00
|
|
|
}
|
|
|
|
|
2007-09-18 02:33:40 +02:00
|
|
|
dtc_tests () {
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -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
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dts -O dtb -o dtc_tree1_dts0.test.dtb test_tree1_dts0.dts
|
2007-11-07 01:17:17 +01:00
|
|
|
tree1_tests dtc_tree1_dts0.test.dtb
|
|
|
|
tree1_tests_rw dtc_tree1_dts0.test.dtb
|
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -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-11-07 00:34:06 +01:00
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dts -O dtb -o dtc_references.test.dtb references.dts
|
2007-11-12 23:59:38 +01:00
|
|
|
run_test references dtc_references.test.dtb
|
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dts -O dtb -o dtc_references_dts0.test.dtb references_dts0.dts
|
dtc: Fix some lexical problems with references
The recent change to the lexer to only recognize property and node
names in the appropriate context removed a number of lexical warts in
our language that would have gotten ugly as we add expression support
and so forth.
But there's one nasty one remaining: references can contain a full
path, including the various problematic node name characters (',', '+'
and '-', for example). This would cause trouble with expressions, and
it also causes trouble with the patch I'm working on to allow
expanding references to paths rather than phandles. This patch
therefore reworks the lexer to mitigate these problems.
- References to labels cause no problems. These are now
recognized separately from references to full paths. No syntax change
here.
- References to full paths, including problematic characters
are allowed by "quoting" the path with braces
e.g. &{/pci@10000/somedevice@3,8000}. The braces protect any internal
problematic characters from being confused with operators or whatever.
- For compatibility with existing dts files, in v0 dts files
we allow bare references to paths as before &/foo/bar/whatever - but
*only* if the path contains no troublesome characters. Specifically
only [a-zA-Z0-9_@/] are allowed.
This is an incompatible change to the dts-v1 format, but since AFAIK
no-one has yet switched to dts-v1 files, I think we can get away with
it. Better to make the transition when people to convert to v1, and
get rid of the problematic old syntax.
Strictly speaking, it's also an incompatible change to the v0 format,
since some path references that were allowed before are no longer
allowed. I suspect no-one has been using the no-longer-supported
forms (certainly none of the kernel dts files will cause trouble).
We might need to think about this harder, though.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-22 07:10:07 +01:00
|
|
|
run_test references dtc_references_dts0.test.dtb
|
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dts -O dtb -o dtc_path-references.test.dtb path-references.dts
|
2007-12-05 00:43:50 +01:00
|
|
|
run_test path-references dtc_path-references.test.dtb
|
|
|
|
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dts -O dtb -o dtc_comments.test.dtb comments.dts
|
|
|
|
run_dtc_test -I dts -O dtb -o dtc_comments-cmp.test.dtb comments-cmp.dts
|
2008-02-15 05:14:16 +01:00
|
|
|
run_test dtbs_equal_ordered dtc_comments.test.dtb dtc_comments-cmp.test.dtb
|
|
|
|
|
2008-08-14 15:28:19 +02:00
|
|
|
# Check aliases support in fdt_path_offset
|
|
|
|
run_dtc_test -I dts -O dtb -o aliases.dtb aliases.dts
|
|
|
|
run_test path_offset_aliases aliases.dtb
|
|
|
|
|
2008-06-24 03:21:44 +02:00
|
|
|
# Check /include/ directive
|
|
|
|
run_dtc_test -I dts -O dtb -o includes.test.dtb include0.dts
|
|
|
|
run_test dtbs_equal_ordered includes.test.dtb test_tree1.dtb
|
|
|
|
|
dtc: Add support for binary includes.
On Wed, Jun 04, 2008 at 09:26:23AM -0500, Jon Loeliger wrote:
> David Gibson wrote:
>
>> But as I said that can be dealt with in the future without breaking
>> compatibility. Objection withdrawn.
>>
>
> And on that note, I officially implore Scott to
> re-submit his binary include patch!
Scott's original patch does still have some implementation details I
didn't like. So in the interests of saving time, I've addressed some
of those, added a testcase, and and now resubmitting my revised
version of Scott's patch.
dtc: Add support for binary includes.
A property's data can be populated with a file's contents
as follows:
node {
prop = /incbin/("path/to/data");
};
A subset of a file can be included by passing start and size parameters.
For example, to include bytes 8 through 23:
node {
prop = /incbin/("path/to/data", 8, 16);
};
As with /include/, non-absolute paths are looked for in the directory
of the source file that includes them.
Implementation revised, and a testcase added by David Gibson
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Scott Wood <scottwood@freescale.com>
2008-06-11 03:58:39 +02:00
|
|
|
# Check /incbin/ directive
|
|
|
|
run_dtc_test -I dts -O dtb -o incbin.test.dtb incbin.dts
|
|
|
|
run_test incbin incbin.test.dtb
|
|
|
|
|
2008-05-16 05:22:57 +02:00
|
|
|
# Check boot_cpuid_phys handling
|
|
|
|
run_dtc_test -I dts -O dtb -b 17 -o boot_cpuid.test.dtb empty.dts
|
|
|
|
run_test boot-cpuid boot_cpuid.test.dtb 17
|
|
|
|
run_dtc_test -I dtb -O dtb -b 17 -o boot_cpuid_test_tree1.test.dtb test_tree1.dtb
|
|
|
|
run_test boot-cpuid boot_cpuid_test_tree1.test.dtb 17
|
|
|
|
run_dtc_test -I dtb -O dtb -o boot_cpuid_preserved_test_tree1.test.dtb boot_cpuid_test_tree1.test.dtb
|
|
|
|
run_test dtbs_equal_ordered boot_cpuid_preserved_test_tree1.test.dtb boot_cpuid_test_tree1.test.dtb
|
|
|
|
|
2007-11-07 00:34:06 +01:00
|
|
|
# Check -Odts mode preserve all dtb information
|
|
|
|
for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb ; do
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dtb -O dts -o odts_$tree.test.dts $tree
|
|
|
|
run_dtc_test -I dts -O dtb -o odts_$tree.test.dtb odts_$tree.test.dts
|
2007-11-07 00:34:06 +01:00
|
|
|
run_test dtbs_equal_ordered $tree odts_$tree.test.dtb
|
|
|
|
done
|
2007-11-12 23:59:38 +01:00
|
|
|
|
2008-02-28 10:55:37 +01:00
|
|
|
# Check version conversions
|
|
|
|
for tree in test_tree1.dtb ; do
|
|
|
|
for aver in 1 2 3 16 17; do
|
|
|
|
atree="ov${aver}_$tree.test.dtb"
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dtb -O dtb -V$aver -o $atree $tree
|
2008-02-28 10:55:37 +01:00
|
|
|
for bver in 16 17; do
|
|
|
|
btree="ov${bver}_$atree"
|
2008-03-05 06:01:55 +01:00
|
|
|
run_dtc_test -I dtb -O dtb -V$bver -o $btree $atree
|
2008-02-28 10:55:37 +01:00
|
|
|
run_test dtbs_equal_ordered $btree $tree
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2007-11-20 06:24:23 +01:00
|
|
|
# Check some checks
|
2008-07-07 03:19:13 +02:00
|
|
|
check_tests dup-nodename.dts duplicate_node_names
|
|
|
|
check_tests dup-propname.dts duplicate_property_names
|
|
|
|
check_tests dup-phandle.dts explicit_phandles
|
|
|
|
check_tests zero-phandle.dts explicit_phandles
|
|
|
|
check_tests minusone-phandle.dts explicit_phandles
|
2008-03-05 06:01:55 +01:00
|
|
|
run_sh_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-node-ref.dts
|
|
|
|
run_sh_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-label-ref.dts
|
2008-07-07 03:19:13 +02:00
|
|
|
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-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
|
|
|
|
check_tests default-addr-size.dts avoid_default_addr_size
|
|
|
|
check_tests obsolete-chosen-interrupt-controller.dts obsolete_chosen_interrupt_controller
|
2008-03-05 06:01:55 +01:00
|
|
|
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
|
2008-03-05 06:22:41 +01:00
|
|
|
|
|
|
|
# Check for proper behaviour reading from stdin
|
|
|
|
run_dtc_test -I dts -O dtb -o stdin_dtc_tree1.test.dtb - < test_tree1.dts
|
|
|
|
run_wrap_test cmp stdin_dtc_tree1.test.dtb dtc_tree1.test.dtb
|
|
|
|
run_dtc_test -I dtb -O dts -o stdin_odts_test_tree1.dtb.test.dts - < test_tree1.dtb
|
|
|
|
run_wrap_test cmp stdin_odts_test_tree1.dtb.test.dts odts_test_tree1.dtb.test.dts
|
|
|
|
|
|
|
|
# Check for graceful failure in some error conditions
|
|
|
|
run_sh_test dtc-fatal.sh -I dts -O dtb nosuchfile.dts
|
|
|
|
run_sh_test dtc-fatal.sh -I dtb -O dtb nosuchfile.dtb
|
|
|
|
run_sh_test dtc-fatal.sh -I fs -O dtb nosuchfile
|
2007-09-18 02:33:40 +02:00
|
|
|
}
|
|
|
|
|
2008-05-15 08:39:12 +02:00
|
|
|
convert_tests () {
|
|
|
|
V0_DTS="test_tree1_dts0.dts references_dts0.dts empty.dts escapes.dts \
|
|
|
|
test01.dts label01.dts"
|
|
|
|
for dts in $V0_DTS; do
|
|
|
|
run_dtc_test -I dts -O dtb -o cvtraw_$dts.test.dtb $dts
|
|
|
|
run_dtc_test -I dts -O dts -o cvtdtc_$dts.test.dts $dts
|
|
|
|
run_dtc_test -I dts -O dtb -o cvtdtc_$dts.test.dtb cvtdtc_$dts.test.dts
|
|
|
|
run_convert_test $dts
|
|
|
|
run_dtc_test -I dts -O dtb -o cvtcvt_$dts.test.dtb ${dts}v1
|
|
|
|
|
|
|
|
run_wrap_test cmp cvtraw_$dts.test.dtb cvtdtc_$dts.test.dtb
|
|
|
|
run_wrap_test cmp cvtraw_$dts.test.dtb cvtcvt_$dts.test.dtb
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2007-11-21 01:56:14 +01:00
|
|
|
while getopts "vt:m" ARG ; do
|
2006-11-27 06:21:28 +01:00
|
|
|
case $ARG in
|
|
|
|
"v")
|
|
|
|
unset QUIET_TEST
|
|
|
|
;;
|
|
|
|
"t")
|
|
|
|
TESTSETS=$OPTARG
|
|
|
|
;;
|
2007-11-21 01:56:14 +01:00
|
|
|
"m")
|
|
|
|
VALGRIND="valgrind --tool=memcheck -q --error-exitcode=$VGCODE"
|
|
|
|
;;
|
2006-11-27 06:21:28 +01:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$TESTSETS" ]; then
|
2008-05-15 08:39:12 +02:00
|
|
|
TESTSETS="libfdt dtc convert"
|
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
|
2007-11-07 00:34:06 +01:00
|
|
|
rm -f *.test.dtb *.test.dts
|
2007-10-16 05:53:20 +02:00
|
|
|
|
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
|
|
|
|
;;
|
2008-05-15 08:39:12 +02:00
|
|
|
"convert")
|
|
|
|
convert_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"
|
2007-11-21 01:56:14 +01:00
|
|
|
if [ -n "$VALGRIND" ]; then
|
|
|
|
echo -e "* valgrind errors: $tot_vg"
|
|
|
|
fi
|
2007-06-26 03:33:10 +02:00
|
|
|
echo -e "* Strange test result: $tot_strange"
|
|
|
|
echo -e "**********"
|
|
|
|
|