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