dtc: Fix assorted problems in the testcases for the -a option
We just added the -a option to allow padding of the output dtb's size to
a specified alignment. Unfortunately the test cases for this had several
bugs:
* Didn't actually test anything since "alignbase" instead of $alignbase
was passed to the checker function
* Introduced an unnecessary run_local_test wrapper
* Didn't provide very helpful output on failure
* Only attempted to check one alignment value
This patch fixes up these problems.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
@@ -62,11 +62,6 @@ run_test () {
|
|||||||
base_run_test $VALGRIND $VGSUPP "./$@"
|
base_run_test $VALGRIND $VGSUPP "./$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_local_test () {
|
|
||||||
printf "$*: "
|
|
||||||
base_run_test "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
run_sh_test () {
|
run_sh_test () {
|
||||||
printf "$*: "
|
printf "$*: "
|
||||||
base_run_test sh "$@"
|
base_run_test sh "$@"
|
||||||
@@ -117,14 +112,15 @@ run_wrap_error_test () {
|
|||||||
|
|
||||||
# $1: dtb file
|
# $1: dtb file
|
||||||
# $2: align base
|
# $2: align base
|
||||||
align_test () {
|
check_align () {
|
||||||
local size=`stat -c %s $1`
|
shorten_echo "check_align $@: "
|
||||||
local mod=$(($size%$2))
|
local size=$(stat -c %s "$1")
|
||||||
|
local align="$2"
|
||||||
(
|
(
|
||||||
if [ $mod -eq 0 ] ;then
|
if [ $(($size % $align)) -eq 0 ] ;then
|
||||||
PASS
|
PASS
|
||||||
else
|
else
|
||||||
FAIL
|
FAIL "Output size $size is not $align-byte aligned"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -524,13 +520,14 @@ dtc_tests () {
|
|||||||
search_dir_b/search_paths_subdir.dts
|
search_dir_b/search_paths_subdir.dts
|
||||||
|
|
||||||
# Check -a option
|
# Check -a option
|
||||||
local alignbase=64
|
for align in 2 4 8 16 32 64; do
|
||||||
# -p -a
|
# -p -a
|
||||||
run_dtc_test -O dtb -p 1000 -a $alignbase -o align0.dtb subnode_iterate.dts
|
run_dtc_test -O dtb -p 1000 -a $align -o align0.dtb subnode_iterate.dts
|
||||||
run_local_test align_test align0.dtb alignbase
|
check_align align0.dtb $align
|
||||||
# -S -a
|
# -S -a
|
||||||
run_dtc_test -O dtb -S 1999 -a $alignbase -o align1.dtb subnode_iterate.dts
|
run_dtc_test -O dtb -S 1999 -a $align -o align1.dtb subnode_iterate.dts
|
||||||
run_local_test align_test align1.dtb alignbase
|
check_align align1.dtb $align
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp_tests () {
|
cmp_tests () {
|
||||||
|
|||||||
Reference in New Issue
Block a user