| 1 |
# This test verifies that we only canonicalize baselines once, namely |
| 2 |
# when canonicalizing new test output, and that baselines get |
| 3 |
# converted over to our header-tagged format. |
| 4 |
# |
| 5 |
# Test prep: make our canonifier executable |
| 6 |
# %TEST-EXEC: chmod 755 ./diff-double-x |
| 7 |
# |
| 8 |
# Verify that without an existing baseline, we canonify a new one. |
| 9 |
# %TEST-EXEC: btest -U %INPUT |
| 10 |
# %TEST-EXEC: head -1 Baseline/canonifier-conversion/output | grep -q 'Do not edit' |
| 11 |
# %TEST-EXEC: tail -1 Baseline/canonifier-conversion/output | grep xx |
| 12 |
# %TEST-EXEC: cp Baseline/canonifier-conversion/output base.1 |
| 13 |
# |
| 14 |
# For testing conversion, first create a "dated" baseline. |
| 15 |
# %TEST-EXEC: echo x >Baseline/canonifier-conversion/output |
| 16 |
# |
| 17 |
# Verify that it succeeds: |
| 18 |
# %TEST-EXEC: btest %INPUT |
| 19 |
# |
| 20 |
# Update the baseline. This should prefix btest-diff's header and canonify: |
| 21 |
# %TEST-EXEC: btest -U %INPUT |
| 22 |
# |
| 23 |
# Verify that these have happened and preserve baseline: |
| 24 |
# %TEST-EXEC: head -1 Baseline/canonifier-conversion/output | grep -q 'Do not edit' |
| 25 |
# %TEST-EXEC: tail -1 Baseline/canonifier-conversion/output | grep xx |
| 26 |
# %TEST-EXEC: cp Baseline/canonifier-conversion/output base.2 |
| 27 |
# |
| 28 |
# Verify that it still succeeds: |
| 29 |
# %TEST-EXEC: btest %INPUT |
| 30 |
# |
| 31 |
# Update the baseline again. |
| 32 |
# %TEST-EXEC: btest -U %INPUT |
| 33 |
# %TEST-EXEC: cp Baseline/canonifier-conversion/output base.3 |
| 34 |
# |
| 35 |
# Verify the updated baselines remained identical. |
| 36 |
# %TEST-EXEC: test "$(cat base.1)" = "$(cat base.2)" && test "$(cat base.2)" = "$(cat base.3)" |
| 37 |
|
| 38 |
@TEST-EXEC: echo x >output |
| 39 |
@TEST-EXEC: btest-diff output |
| 40 |
|
| 41 |
%TEST-START-FILE btest.cfg |
| 42 |
[btest] |
| 43 |
TmpDir = .tmp |
| 44 |
|
| 45 |
[environment] |
| 46 |
TEST_DIFF_CANONIFIER=%(testbase)s/diff-double-x |
| 47 |
%TEST-END-FILE |
| 48 |
|
| 49 |
%TEST-START-FILE diff-double-x |
| 50 |
#! /usr/bin/env bash |
| 51 |
sed 's/x/xx/g' |
| 52 |
%TEST-END-FILE |