]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a TOR_SKIP_TESTCASES environment variable for suppressing tests.
authorNick Mathewson <nickm@torproject.org>
Thu, 19 Mar 2020 19:25:11 +0000 (15:25 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 19 Mar 2020 22:36:36 +0000 (18:36 -0400)
For example, "TOR_SKIP_TESTCASES=crypto/.. ./src/test/test" will run
the tests and suppress all the "crypto/" tests.  You could get the
same effect by running "./src/test/test :crypto/..", but that can be
harder to arrange from CI.

Part of a fix/workaround for 33643.

changes/ticket33643 [new file with mode: 0644]
src/test/testing_common.c

diff --git a/changes/ticket33643 b/changes/ticket33643
new file mode 100644 (file)
index 0000000..7fddab7
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor features (testing):
+    - The unit tests now support a "TOR_SKIP_TESTCASES" environment variable
+      to specify a list of space-separated test cases that should not be
+      executed. We will use this to disable certain tests that are failing on
+      Appveyor because of mismatched OpenSSL libraries. Part of ticket 33643.
index 62d40a42fa9ec8902840a97d72a5dc567d8a3a68..2c9c4538b93fb43622a710f6f4b409b5a46ad548 100644 (file)
@@ -348,6 +348,21 @@ main(int c, const char **v)
 
   atexit(remove_directory);
 
+  /* Look for TOR_SKIP_TESTCASES: a space-separated list of tests to skip. */
+  const char *skip_tests = getenv("TOR_SKIP_TESTCASES");
+  if (skip_tests) {
+    smartlist_t *skip = smartlist_new();
+    smartlist_split_string(skip, skip_tests, NULL,
+                           SPLIT_IGNORE_BLANK, -1);
+    int n = 0;
+    SMARTLIST_FOREACH_BEGIN(skip, char *, cp) {
+      n += tinytest_skip(testgroups, cp);
+      tor_free(cp);
+    } SMARTLIST_FOREACH_END(cp);
+    printf("Skipping %d testcases.\n", n);
+    smartlist_free(skip);
+  }
+
   int have_failed = (tinytest_main(c, v, testgroups) != 0);
 
   free_pregenerated_keys();