dtc/tests/fdtget-runtest.sh
David Gibson 5b71660724 tests: Work around limitation in FreeBSD's printf(1)
Some of our testcases check fdtget retreiving string list properties that
include internal \0 characters.  We use printf(1) to generate the expected
value for comparison.

However, on FreeBSD, printf(1)'s %b format option can't handle \0: it will
terminate that argument ignoring it and everything after.  Curiously,
internal \0 *is* ok in the main format string.  So avoid using %b and use
the format string directly instead.

Link: https:/https://github.com/dgibson/dtc/issues/165

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2025-07-25 13:01:41 +10:00

25 lines
412 B
Bash
Executable file

#! /bin/sh
SRCDIR=`dirname "$0"`
. "$SRCDIR/testutils.sh"
LOG=tmp.log.$$
EXPECT=tmp.expect.$$
rm -f $LOG $EXPECT
trap "rm -f $LOG $EXPECT" 0
expect="$1"
printf "$expect\n" > $EXPECT
shift
verbose_run_log_check "$LOG" $VALGRIND $DTGET "$@"
if cmp $EXPECT $LOG>/dev/null; then
PASS
else
if [ -z "$QUIET_TEST" ]; then
echo "EXPECTED :-:"
cat $EXPECT
fi
FAIL "Results differ from expected"
fi