diff options
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index f567a18367..aa38d0fc5d 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2020, The Tor Project, Inc. */ + * Copyright (c) 2007-2021, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" @@ -4554,7 +4554,7 @@ test_util_glob(void *ptr) #else const char *results_test3[] = {"dir1", "dir2", "file1", "file2", "forbidden"}; -#endif +#endif /* defined(_WIN32) */ TEST("*i*"); EXPECT(results_test3); @@ -4584,15 +4584,8 @@ test_util_glob(void *ptr) TEST("file1"); EXPECT(results_test9); -#if defined(__APPLE__) || defined(__darwin__) || \ - defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD) TEST("file1"PATH_SEPARATOR); EXPECT_EMPTY(); -#else - const char *results_test10[] = {"file1"}; - TEST("file1"PATH_SEPARATOR); - EXPECT(results_test10); -#endif // test path separator at end - with wildcards and linux path separator const char *results_test11[] = {"dir1", "dir2", "forbidden"}; @@ -4606,7 +4599,7 @@ test_util_glob(void *ptr) #else const char *results_test12[] = {"dir1", "dir2", "empty", "file1", "file2", "forbidden"}; -#endif +#endif /* defined(_WIN32) */ TEST("*"); EXPECT(results_test12); @@ -4653,7 +4646,7 @@ test_util_glob(void *ptr) tor_free(pattern); tt_assert(!results); } -#endif +#endif /* !defined(_WIN32) */ #undef TEST #undef EXPECT @@ -4665,7 +4658,7 @@ test_util_glob(void *ptr) (void) chmod(dir1_forbidden, 0700); (void) chmod(dir2_forbidden, 0700); (void) chmod(forbidden_forbidden, 0700); -#endif +#endif /* !defined(_WIN32) */ tor_free(dir1); tor_free(dir2); tor_free(forbidden); @@ -4679,11 +4672,11 @@ test_util_glob(void *ptr) SMARTLIST_FOREACH(results, char *, f, tor_free(f)); smartlist_free(results); } -#else +#else /* !defined(HAVE_GLOB) */ tt_skip(); done: return; -#endif +#endif /* defined(HAVE_GLOB) */ } static void @@ -4791,7 +4784,7 @@ test_util_get_glob_opened_files(void *ptr) // dot files are not special on windows const char *results_test3[] = {"", ".test-hidden", "dir1", "dir2", "empty", "file1", "file2", "forbidden"}; -#endif +#endif /* !defined(_WIN32) */ TEST("*"PATH_SEPARATOR"*"); EXPECT(results_test3); @@ -4803,7 +4796,7 @@ test_util_get_glob_opened_files(void *ptr) // dot files are not special on windows const char *results_test4[] = {"", ".test-hidden", "dir1", "dir2", "empty", "file1", "file2", "forbidden"}; -#endif +#endif /* !defined(_WIN32) */ TEST("*"PATH_SEPARATOR"*"PATH_SEPARATOR); EXPECT(results_test4); @@ -4868,7 +4861,7 @@ test_util_get_glob_opened_files(void *ptr) TT_FAIL(("unable to chmod a file on cleanup: %s", strerror(errno))); } } -#endif +#endif /* !defined(_WIN32) */ tor_free(dir1); tor_free(dir2); tor_free(forbidden); @@ -4882,11 +4875,11 @@ test_util_get_glob_opened_files(void *ptr) SMARTLIST_FOREACH(results, char *, f, tor_free(f)); smartlist_free(results); } -#else +#else /* !defined(HAVE_GLOB) */ tt_skip(); done: return; -#endif +#endif /* defined(HAVE_GLOB) */ } static void @@ -5949,7 +5942,7 @@ static int fd_is_cloexec(tor_socket_t fd) { int flags = fcntl(fd, F_GETFD, 0); - return (flags & FD_CLOEXEC) == FD_CLOEXEC; + return (flags & FD_CLOEXEC) != 0; } #endif /* defined(FD_CLOEXEC) */ @@ -5959,7 +5952,7 @@ static int fd_is_nonblocking(tor_socket_t fd) { int flags = fcntl(fd, F_GETFL, 0); - return (flags & O_NONBLOCK) == O_NONBLOCK; + return (flags & O_NONBLOCK) != 0; } #endif /* !defined(_WIN32) */ |