Debian Codegraph @

testing/tests/binary-mode.test

raw
1 # This tests btest-diff's binary mode. In binary mode we treat test
2 # outputs and baselines as blobs, compare them only byte-by-byte,
3 # don't canonify them, and don't prefix our baseline header.
4 #
5 # Running the below directly should fail: there's no baseline yet.
6 # %TEST-EXEC-FAIL: btest %INPUT
7 #
8 # Verify that none got created either:
9 # %TEST-EXEC: test ! -e mydir/binary-mode/output
10 #
11 # Now update the baseline:
12 # %TEST-EXEC: btest -U %INPUT
13 #
14 # Verify it exists:
15 # %TEST-EXEC: test -f mydir/binary-mode/output
16 #
17 # btest should now successfully compare against the baseline:
18 # %TEST-EXEC: btest %INPUT
19 #
20 # And finally, verify that the updated baseline hasn't changed:
21 # %TEST-EXEC: printf "\00\01\02" >output
22 # %TEST-EXEC: diff -s output mydir/binary-mode/output
23 #
24 # Update once more, to ensure we refresh the baseline properly
25 # %TEST-EXEC: btest -U %INPUT
26 # %TEST-EXEC: diff -s output mydir/binary-mode/output
27
28 @TEST-EXEC: printf "\00\01\02" >output
29
30 # Setting a non-existant canonifier here verifies that binary mode
31 # indeed does not canonify.
32 @TEST-EXEC: TEST_DIFF_CANONIFIER=doesnotexist btest-diff --binary output
33
34 %TEST-START-FILE btest.cfg
35 [btest]
36 TmpDir = .tmp
37 BaselineDir = mydir
38 %TEST-END-FILE