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>
This commit is contained in:
David Gibson 2025-07-25 13:01:41 +10:00
parent 52f07dcca4
commit 5b71660724

View file

@ -9,7 +9,7 @@ rm -f $LOG $EXPECT
trap "rm -f $LOG $EXPECT" 0
expect="$1"
printf '%b\n' "$expect" > $EXPECT
printf "$expect\n" > $EXPECT
shift
verbose_run_log_check "$LOG" $VALGRIND $DTGET "$@"