platform_external_dtc/tests/fdtdump-runtest.sh
David Gibson 00f9febf9c tests: Rename tests.sh to testutils.sh
tests.sh has a bunch of shell setup that's sourced in a number of other
scripts.  It _doesn't_ actually run a bunch of tests, which is kind of what
the name suggests.  So rename it to be more obvious.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-03-29 16:31:39 +11:00

30 lines
532 B
Bash

#! /bin/sh
# Arguments:
# $1 - source file to compile and compare with fdtdump output of the
# compiled file.
. ./testutils.sh
dts="$1"
dtb="${dts}.dtb"
out="${dts}.out"
LOG=tmp.log.$$
files="$dtb $out $LOG"
rm -f $files
trap "rm -f $files" 0
verbose_run_log_check "$LOG" $VALGRIND $DTC -O dtb $dts -o $dtb
$FDTDUMP ${dtb} | grep -v "//" >${out}
if diff -w $dts $out >/dev/null; then
PASS
else
if [ -z "$QUIET_TEST" ]; then
echo "DIFF :-:"
diff -u -w $dts $out
fi
FAIL "Results differ from expected"
fi