1#! /bin/sh
2
3# Run script for fdtput tests
4# We run fdtput to update the device tree, then fdtget to check it
5
6# Usage
7#    fdtput-runtest.sh name expected_output dtb_file node property flags value
8
9SRCDIR=`dirname "$0"`
10. "$SRCDIR/testutils.sh"
11
12LOG=tmp.log.$$
13EXPECT=tmp.expect.$$
14rm -f $LOG $EXPECT
15trap "rm -f $LOG $EXPECT" 0
16
17expect="$1"
18echo $expect >$EXPECT
19dtb="$2"
20node="$3"
21property="$4"
22flags="$5"
23shift 5
24value="$@"
25
26# First run fdtput
27verbose_run_check $VALGRIND "$DTPUT" "$dtb" "$node" "$property" $value $flags
28
29# Now fdtget to read the value
30verbose_run_log_check "$LOG" $VALGRIND "$DTGET" "$dtb" "$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