platform_external_dtc/tests/fdtdump-runtest.sh
Simon Glass 76a65b14d1 Add a basic test for fdtdump
We can test fdtdump by comparing its output with the source file that was
compiled by dtc. Add a simple test that should at least catch regressions
in basic functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-06-18 21:24:48 +10:00

30 lines
528 B
Bash

#! /bin/sh
# Arguments:
# $1 - source file to compile and compare with fdtdump output of the
# compiled file.
. ./tests.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