[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] practracker: Capture stderr output in test_practracker.sh



commit cda2ff196540f3b1fe8639e4e647285b58bb6752
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Thu Dec 12 16:15:29 2019 +1000

    practracker: Capture stderr output in test_practracker.sh
    
    And canonicalise file paths, so that output is consistent, even in
    out-of-tree builds.
    
    Capturing stderr output produces better diagnostics.
    
    Diagnostics for 32705.
---
 scripts/maint/practracker/test_practracker.sh                 | 11 ++++++++---
 scripts/maint/practracker/testdata/ex0-expected.txt           |  1 +
 scripts/maint/practracker/testdata/ex1-expected.txt           |  1 +
 scripts/maint/practracker/testdata/ex1-overbroad-expected.txt |  1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh
index 9b107e071..3c87bc31b 100755
--- a/scripts/maint/practracker/test_practracker.sh
+++ b/scripts/maint/practracker/test_practracker.sh
@@ -15,6 +15,11 @@ if test "${PRACTRACKER_DIR}" = "" ||
     PRACTRACKER_DIR=$(dirname "$0")
 fi
 
+# Change to the tor directory, and canonicalise PRACTRACKER_DIR,
+# so paths in practracker output are consistent, even in out-of-tree builds
+cd "${PRACTRACKER_DIR}"/../../..
+PRACTRACKER_DIR="scripts/maint/practracker"
+
 TMPDIR="$(mktemp -d -t pracktracker.test.XXXXXX)"
 if test -z "${TMPDIR}" || test ! -d "${TMPDIR}" ; then
     echo >&2 "mktemp failed."
@@ -52,18 +57,18 @@ echo "unit tests:"
 
 echo "ex0:"
 
-run_practracker --exceptions "${DATA}/ex0.txt" > "${TMPDIR}/ex0-received.txt"
+run_practracker --exceptions "${DATA}/ex0.txt" > "${TMPDIR}/ex0-received.txt" 2>&1
 
 compare "${TMPDIR}/ex0-received.txt" "${DATA}/ex0-expected.txt"
 
 echo "ex1:"
 
-run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt"
+run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt" 2>&1
 
 compare "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt"
 
 echo "ex1.overbroad:"
 
-run_practracker --exceptions "${DATA}/ex1.txt" --list-overbroad > "${TMPDIR}/ex1-overbroad-received.txt"
+run_practracker --exceptions "${DATA}/ex1.txt" --list-overbroad > "${TMPDIR}/ex1-overbroad-received.txt" 2>&1
 
 compare "${TMPDIR}/ex1-overbroad-received.txt" "${DATA}/ex1-overbroad-expected.txt"
diff --git a/scripts/maint/practracker/testdata/ex0-expected.txt b/scripts/maint/practracker/testdata/ex0-expected.txt
index 502005edb..dc41c8700 100644
--- a/scripts/maint/practracker/testdata/ex0-expected.txt
+++ b/scripts/maint/practracker/testdata/ex0-expected.txt
@@ -1,3 +1,4 @@
+Unusual pattern permitted.h in scripts/maint/practracker/testdata
 problem file-size a.c 41
 problem include-count a.c 6
 problem function-size a.c:i_am_a_function() 9
diff --git a/scripts/maint/practracker/testdata/ex1-expected.txt b/scripts/maint/practracker/testdata/ex1-expected.txt
index 58140a4d9..7800a2cd0 100644
--- a/scripts/maint/practracker/testdata/ex1-expected.txt
+++ b/scripts/maint/practracker/testdata/ex1-expected.txt
@@ -1,3 +1,4 @@
+Unusual pattern permitted.h in scripts/maint/practracker/testdata
 problem function-size a.c:i_am_a_function() 9
 (warning) problem function-size a.c:another_function() 12
 problem function-size b.c:foo() 4
diff --git a/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt b/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt
index b757202da..ed3cbb29f 100644
--- a/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt
+++ b/scripts/maint/practracker/testdata/ex1-overbroad-expected.txt
@@ -1,2 +1,3 @@
+Unusual pattern permitted.h in scripts/maint/practracker/testdata
 problem file-size a.c 45 -> 41
 problem file-size z.c 100 -> 0



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits