diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-08-01 15:05:34 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-08-01 15:43:54 -0400 |
commit | 1440c2cb340f904cafb402474b538725abdeb04f (patch) | |
tree | 6a8ded47e153eb98153dad7080c32aa965875717 /scripts/maint/practracker/test_practracker.sh | |
parent | fa60fee8d56af01f6fefca17f945bdd00d195571 (diff) | |
download | tor-1440c2cb340f904cafb402474b538725abdeb04f.tar.gz tor-1440c2cb340f904cafb402474b538725abdeb04f.zip |
Adjust test_practracker.sh to work on windows
The required change is to ignore trailing CRs when diffing files.
Diffstat (limited to 'scripts/maint/practracker/test_practracker.sh')
-rwxr-xr-x | scripts/maint/practracker/test_practracker.sh | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh index c7be227702..c878ca5580 100755 --- a/scripts/maint/practracker/test_practracker.sh +++ b/scripts/maint/practracker/test_practracker.sh @@ -28,6 +28,17 @@ run_practracker() { --max-include-count=0 --max-file-size=0 --max-function-size=0 --terse \ "${DATA}/" "$@"; } +compare() { + # we can't use cmp because we need to use -b for windows + diff -b -u "$@" > "${TMPDIR}/test-diff" + if test -z "$(cat "${TMPDIR}"/test-diff)"; then + echo "OK" + else + cat "${TMPDIR}/test-diff" + echo "FAILED" + exit 1 + fi +} echo "unit tests:" @@ -37,18 +48,10 @@ echo "ex0:" run_practracker --exceptions "${DATA}/ex0.txt" > "${TMPDIR}/ex0-received.txt" -if cmp "${TMPDIR}/ex0-received.txt" "${DATA}/ex0-expected.txt" ; then - echo " OK" -else - exit 1 -fi +compare "${TMPDIR}/ex0-received.txt" "${DATA}/ex0-expected.txt" echo "ex1:" run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt" -if cmp "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt" ;then - echo " OK" -else - exit 1 -fi +compare "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt" |