1#! /bin/sh 2 3# Run script for fdtoverlay tests 4# We run fdtoverlay to generate a target device tree, thn fdtget to check it 5 6# Usage 7# fdtoverlay-runtest.sh name expected_output dtb_file node property flags value 8 9. ./tests.sh 10 11LOG=tmp.log.$$ 12EXPECT=tmp.expect.$$ 13rm -f $LOG $EXPECT 14trap "rm -f $LOG $EXPECT" 0 15 16expect="$1" 17echo $expect >$EXPECT 18node="$2" 19property="$3" 20flags="$4" 21basedtb="$5" 22targetdtb="$6" 23shift 6 24overlays="$@" 25 26# First run fdtoverlay 27verbose_run_check $VALGRIND "$FDTOVERLAY" -i "$basedtb" -o "$targetdtb" $overlays 28 29# Now fdtget to read the value 30verbose_run_log_check "$LOG" $VALGRIND "$DTGET" "$targetdtb" "$node" "$property" $flags 31 32if cmp $EXPECT $LOG >/dev/null; then 33 PASS 34else 35 if [ -z "$QUIET_TEST" ]; then 36 echo "EXPECTED :-:" 37 cat $EXPECT 38 fi 39 FAIL "Results differ from expected" 40fi 41