From fba74cf8bd9696b9b7f42a8cbb9e16dd065b0a83 Mon Sep 17 00:00:00 2001 From: Alberto Maschietto Date: Tue, 8 Sep 2026 01:12:20 +0400 Subject: plistutil: preserve binary data on Windows standard streams --- test/Makefile.am | 6 ++++-- test/data/streams.plist | 5 +++++ test/plistutil-streams.test | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 test/data/streams.plist create mode 100755 test/plistutil-streams.test (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am index f9f21e4..76d2373 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -84,7 +84,8 @@ TESTS = \ ostep-strings.test \ ostep-comments.test \ ostep-invalid-types.test \ - xml_behavior.test + xml_behavior.test \ + plistutil-streams.test EXTRA_DIST = \ $(TESTS) \ @@ -136,7 +137,8 @@ EXTRA_DIST = \ data/o1.ostep \ data/o2.ostep \ data/o3.ostep \ - data/test.strings + data/test.strings \ + data/streams.plist TESTS_ENVIRONMENT = \ top_srcdir=$(top_srcdir) \ diff --git a/test/data/streams.plist b/test/data/streams.plist new file mode 100644 index 0000000..b46a4af --- /dev/null +++ b/test/data/streams.plist @@ -0,0 +1,5 @@ + + + +DQoa + diff --git a/test/plistutil-streams.test b/test/plistutil-streams.test new file mode 100755 index 0000000..ce3c516 --- /dev/null +++ b/test/plistutil-streams.test @@ -0,0 +1,34 @@ +## -*- sh -*- +set -e + +DATASRC=$top_srcdir/test/data +DATAOUT=$top_builddir/test/data +PLISTUTIL=$top_builddir/tools/plistutil +TESTFILE=$DATAOUT/plistutil-streams.test + +mkdir -p "$DATAOUT" + +# The data contains CR, LF and Ctrl-Z, which Windows text streams translate. +"$PLISTUTIL" -i "$DATASRC/streams.plist" -f bin -o "$TESTFILE.bin" +"$PLISTUTIL" -i "$TESTFILE.bin" -f xml -o "$TESTFILE.xml" + +echo "Checking binary stdout" +"$PLISTUTIL" -i "$DATASRC/streams.plist" -f bin > "$TESTFILE.stdout.out" +cmp "$TESTFILE.bin" "$TESTFILE.stdout.out" +"$PLISTUTIL" -i "$DATASRC/streams.plist" -f bin -o - > "$TESTFILE.stdout.out" +cmp "$TESTFILE.bin" "$TESTFILE.stdout.out" + +echo "Checking binary stdin" +"$PLISTUTIL" -f xml -o "$TESTFILE.stdin.out" < "$TESTFILE.bin" +cmp "$TESTFILE.xml" "$TESTFILE.stdin.out" +cat "$TESTFILE.bin" | "$PLISTUTIL" -i - -f xml -o "$TESTFILE.stdin.out" +cmp "$TESTFILE.xml" "$TESTFILE.stdin.out" + +echo "Checking binary stdin in print mode" +"$PLISTUTIL" -p "$TESTFILE.bin" > "$TESTFILE.print.out" +cat "$TESTFILE.bin" | "$PLISTUTIL" -p - > "$TESTFILE.stdin.out" +cmp "$TESTFILE.print.out" "$TESTFILE.stdin.out" + +echo "Checking XML stdout" +"$PLISTUTIL" -i "$TESTFILE.bin" -f xml > "$TESTFILE.stdout.out" +cmp "$TESTFILE.xml" "$TESTFILE.stdout.out" -- cgit v1.1-32-gdbae