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

[tor-commits] [tor/master] Add integration tests for new practracker features



commit c71051882586201f9f2566fa7073e13bf50b60db
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Aug 26 12:28:46 2019 -0400

    Add integration tests for new practracker features
    
    These tests check our .may_include checking, and our header file
    checking.
    
    They do not pass yet: we have a bug in our filtering code.
---
 scripts/maint/practracker/test_practracker.sh       | 4 +++-
 scripts/maint/practracker/testdata/.may_include     | 3 +++
 scripts/maint/practracker/testdata/a.c              | 2 +-
 scripts/maint/practracker/testdata/ex0-expected.txt | 4 ++++
 scripts/maint/practracker/testdata/ex1.txt          | 4 ++++
 scripts/maint/practracker/testdata/header.h         | 8 ++++++++
 6 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh
index c878ca558..4f8b7e204 100755
--- a/scripts/maint/practracker/test_practracker.sh
+++ b/scripts/maint/practracker/test_practracker.sh
@@ -25,7 +25,9 @@ DATA="${PRACTRACKER_DIR}/testdata"
 
 run_practracker() {
     "${PYTHON:-python}" "${PRACTRACKER_DIR}/practracker.py" \
-        --max-include-count=0 --max-file-size=0 --max-function-size=0 --terse \
+        --max-include-count=0 --max-file-size=0 \
+        --max-h-include-count=0 --max-h-file-size=0 \
+        --max-function-size=0 --terse \
         "${DATA}/" "$@";
 }
 compare() {
diff --git a/scripts/maint/practracker/testdata/.may_include b/scripts/maint/practracker/testdata/.may_include
new file mode 100644
index 000000000..40bf8155d
--- /dev/null
+++ b/scripts/maint/practracker/testdata/.may_include
@@ -0,0 +1,3 @@
+!advisory
+
+permitted.h
diff --git a/scripts/maint/practracker/testdata/a.c b/scripts/maint/practracker/testdata/a.c
index b52a14f56..1939773f5 100644
--- a/scripts/maint/practracker/testdata/a.c
+++ b/scripts/maint/practracker/testdata/a.c
@@ -3,7 +3,7 @@
 #include "two.h"
 #incldue "three.h"
 
-# include "four.h"
+# include "permitted.h"
 
 int
 i_am_a_function(void)
diff --git a/scripts/maint/practracker/testdata/ex0-expected.txt b/scripts/maint/practracker/testdata/ex0-expected.txt
index c021e6f71..5f3d9e5ae 100644
--- a/scripts/maint/practracker/testdata/ex0-expected.txt
+++ b/scripts/maint/practracker/testdata/ex0-expected.txt
@@ -2,6 +2,10 @@ problem file-size a.c 38
 problem include-count a.c 4
 problem function-size a.c:i_am_a_function() 9
 problem function-size a.c:another_function() 12
+problem dependency-violation a.c 3
 problem file-size b.c 15
 problem function-size b.c:foo() 4
 problem function-size b.c:bar() 5
+problem file-size header.h 8
+problem include-count header.h 4
+problem dependency-violation header.h 3
diff --git a/scripts/maint/practracker/testdata/ex1.txt b/scripts/maint/practracker/testdata/ex1.txt
index db42ae845..f619e33b2 100644
--- a/scripts/maint/practracker/testdata/ex1.txt
+++ b/scripts/maint/practracker/testdata/ex1.txt
@@ -9,3 +9,7 @@ problem file-size b.c 15
 # This is removed, and so will produce an error.
 # problem function-size b.c:foo() 4
 problem function-size b.c:bar() 5
+problem dependency-violation a.c 3
+problem dependency-violation header.h 3
+problem file-size header.h 8
+problem include-count header.h 4
diff --git a/scripts/maint/practracker/testdata/header.h b/scripts/maint/practracker/testdata/header.h
new file mode 100644
index 000000000..1183f5db9
--- /dev/null
+++ b/scripts/maint/practracker/testdata/header.h
@@ -0,0 +1,8 @@
+
+// some forbidden includes
+#include "foo.h"
+#include "quux.h"
+#include "quup.h"
+
+// a permitted include
+#include "permitted.h"



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