[tor-bugs] #18012 [Tor]: Building Unit Tests on Windows

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Jan 7 03:23:03 UTC 2016


#18012: Building Unit Tests on Windows
------------------------+--------------------------------
     Reporter:  teor    |      Owner:
         Type:  defect  |     Status:  new
     Priority:  Medium  |  Milestone:  Tor: 0.2.8.x-final
    Component:  Tor     |    Version:
     Severity:  Normal  |   Keywords:  windows tests
Actual Points:          |  Parent ID:
       Points:          |    Sponsor:
------------------------+--------------------------------
 Reported by Gisle Vanem on tor-dev@
 https://lists.torproject.org/pipermail/tor-dev/2016-January/010126.html
 {{{
 The src/test/test_util.c have this statement:

 #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)

 But I fail to see where 'UTIL_NO_WIN(n)' is defined. Should not the
 above read:

 --- a/test/test_util.c 2016-01-05 13:19:07
 +++ b/test/test_util.c 2016-01-05 14:36:52
 @@ -4676,7 +4676,7 @@
 #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)
 +#define UTIL_LEGACY_NO_WIN(n)   { #n, NULL, TT_SKIP, NULL, NULL }
 #else
 #define UTIL_TEST_NO_WIN(n, f) UTIL_TEST(n, (f))

 With this, my test.exe runs fine. Although 36 SKIPPED tests.

 Another thing regarding MSVC. In test/test_checkdir.c,
 <dirent.h> is included for _WIN32. MSVC does not have this header.
 Hence I think this patch is needed:

 --- a/test/test_checkdir.c 2015-08-31 13:24:33
 +++ b/test/test_checkdir.c 2015-08-31 14:50:53
 @@ -4,9 +4,7 @@
 #include "orconfig.h"
 #include "or.h"

 -#ifdef _WIN32
 -#include <direct.h>
 -#else
 +#ifndef _MSC_VER
 #include <dirent.h>
 #endif

 Since <direct.h> is already included in "or.h", it's not needed here
 too.
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18012>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list