Skip to content

Commit 21e075e

Browse files
committed
metaflac test: print out the diff of metadata when failing
1 parent 12535dc commit 21e075e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/test_metaflac.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,23 @@ metaflac_test ()
120120
run_metaflac $args $flacfile | filter > $testdir/out1.meta || die "ERROR running metaflac"
121121
# Ignore lengths which can be affected by the version string.
122122
sed "s/length:.*/length: XXX/" $testdir/out1.meta > $testdir/out.meta
123-
diff -w $expect $testdir/out.meta > /dev/null 2>&1 || die "ERROR: metadata does not match expected $expect"
123+
exit_code=0
124+
diff -w $expect $testdir/out.meta > /dev/null 2>&1 || exit_code=$?
125+
if [ "$exit_code" != 0 ] ; then
126+
echo ""
127+
echo "diff of expected and actual metadata:"
128+
diff -w $expect $testdir/out.meta || true
129+
130+
# Also output a hexdump of the metadata, which can be useful in case there are in fact
131+
# differences in whitespace
132+
echo ""
133+
echo "hexdump diff of expected and actual metadata:"
134+
hd "$expect" > "$testdir/out.meta.expect.hd" || true
135+
hd "$testdir/out.meta" > "$testdir/out.meta.hd" || true
136+
diff "$testdir/out.meta.expect.hd" "$testdir/out.meta.hd" || true
137+
138+
die "ERROR: metadata does not match expected $expect"
139+
fi
124140
# To blindly accept (and check later): cp -f $testdir/out.meta $expect
125141
echo OK
126142
}

0 commit comments

Comments
 (0)