[tor-commits] [tor/master] clean up the "skip this util test on windows" logic.

nickm at torproject.org nickm at torproject.org
Tue Jan 5 07:03:25 UTC 2016


commit c941240f325f312fb8485a2d018ccc183c2b1591
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sun Jan 3 08:47:14 2016 -0800

    clean up the "skip this util test on windows" logic.
---
 src/test/test_util.c |   36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index f88c297..73b4307 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4322,12 +4322,6 @@ test_util_clamp_double_to_int64(void *arg)
   ;
 }
 
-#define UTIL_LEGACY(name)                                               \
-  { #name, test_util_ ## name , 0, NULL, NULL }
-
-#define UTIL_TEST(name, flags)                          \
-  { #name, test_util_ ## name, flags, NULL, NULL }
-
 #ifdef FD_CLOEXEC
 #define CAN_CHECK_CLOEXEC
 static int
@@ -4632,6 +4626,22 @@ test_util_touch_file(void *arg)
   ;
 }
 
+#define UTIL_LEGACY(name)                                               \
+  { #name, test_util_ ## name , 0, NULL, NULL }
+
+#define UTIL_TEST(name, flags)                          \
+  { #name, test_util_ ## name, flags, NULL, NULL }
+
+#ifdef _WIN32
+#define UTIL_TEST_NO_WIN(n, f) { #n, NULL, TT_SKIP, NULL, NULL }
+#define UTIL_TEST_WIN_ONLY(n, f) UTIL_TEST(n, (f))
+#define UTIL_LEGACY_NO_WIN(n) UTIL_NO_WIN(n)
+#else
+#define UTIL_TEST_NO_WIN(n, f) UTIL_TEST(n, (f))
+#define UTIL_TEST_WIN_ONLY(n, f) { #n, NULL, TT_SKIP, NULL, NULL }
+#define UTIL_LEGACY_NO_WIN(n) UTIL_LEGACY(n)
+#endif
+
 struct testcase_t util_tests[] = {
   UTIL_LEGACY(time),
   UTIL_TEST(parse_http_time, 0),
@@ -4639,9 +4649,7 @@ struct testcase_t util_tests[] = {
   UTIL_LEGACY(config_line_quotes),
   UTIL_LEGACY(config_line_comment_character),
   UTIL_LEGACY(config_line_escaped_content),
-#ifndef _WIN32
-  UTIL_LEGACY(expand_filename),
-#endif
+  UTIL_LEGACY_NO_WIN(expand_filename),
   UTIL_LEGACY(escape_string_socks),
   UTIL_LEGACY(string_is_key_value),
   UTIL_LEGACY(strmisc),
@@ -4666,13 +4674,9 @@ struct testcase_t util_tests[] = {
   UTIL_TEST(listdir, 0),
   UTIL_TEST(parent_dir, 0),
   UTIL_TEST(ftruncate, 0),
-#ifdef _WIN32
-  UTIL_TEST(load_win_lib, 0),
-#endif
-#ifndef _WIN32
-  UTIL_TEST(exit_status, 0),
-  UTIL_TEST(fgets_eagain, 0),
-#endif
+  UTIL_TEST_WIN_ONLY(load_win_lib, 0),
+  UTIL_TEST_NO_WIN(exit_status, 0),
+  UTIL_TEST_NO_WIN(fgets_eagain, 0),
   UTIL_TEST(format_hex_number, 0),
   UTIL_TEST(format_dec_number, 0),
   UTIL_TEST(join_win_cmdline, 0),





More information about the tor-commits mailing list