aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-31 10:59:42 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-31 15:48:47 -0500
commit5cf9167f919dfef964b1d149731ed04941e25ebf (patch)
tree37668dde9fd4c68d80cb1bde90523b55fba4b226 /src/test
parent23054543278a8ee5db6d8dae3b3a96e2b2fd5377 (diff)
downloadtor-5cf9167f919dfef964b1d149731ed04941e25ebf.tar
tor-5cf9167f919dfef964b1d149731ed04941e25ebf.tar.gz
Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32
This commit is completely mechanical; I used this perl script to make it: #!/usr/bin/perl -w -i.bak -p if (/^\s*\#/) { s/MS_WINDOWS/_WIN32/g; s/\bWIN32\b/_WIN32/g; }
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-child.c6
-rw-r--r--src/test/test.c4
-rw-r--r--src/test/test_microdesc.c4
-rw-r--r--src/test/test_util.c28
4 files changed, 21 insertions, 21 deletions
diff --git a/src/test/test-child.c b/src/test/test-child.c
index 1b9c5e3d5..b57d8caa9 100644
--- a/src/test/test-child.c
+++ b/src/test/test-child.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include "orconfig.h"
-#ifdef MS_WINDOWS
+#ifdef _WIN32
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#else
@@ -23,13 +23,13 @@ main(int argc, char **argv)
succeed. Otherwise ReadFile() will get the entire output in one */
// XXX: Can we make stdio flush on newline?
fflush(stdout);
-#ifdef MS_WINDOWS
+#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
fprintf(stdout, "DONE\n");
-#ifdef MS_WINDOWS
+#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
diff --git a/src/test/test.c b/src/test/test.c
index 9d369c04d..2ecf6ff6c 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -19,7 +19,7 @@ const char tor_git_revision[] = "";
#include <fcntl.h>
#endif
-#ifdef MS_WINDOWS
+#ifdef _WIN32
/* For mkdir() */
#include <direct.h>
#else
@@ -83,7 +83,7 @@ setup_directory(void)
int r;
if (is_setup) return;
-#ifdef MS_WINDOWS
+#ifdef _WIN32
{
char buf[MAX_PATH];
const char *tmp = buf;
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index dcc6f9c16..9326c035f 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -9,7 +9,7 @@
#include "test.h"
-#ifdef MS_WINDOWS
+#ifdef _WIN32
/* For mkdir() */
#include <direct.h>
#else
@@ -66,7 +66,7 @@ test_md_cache(void *data)
/* Possibly, turn this into a test setup/cleanup pair */
tor_free(options->DataDirectory);
options->DataDirectory = tor_strdup(get_fname("md_datadir_test"));
-#ifdef MS_WINDOWS
+#ifdef _WIN32
tt_int_op(0, ==, mkdir(options->DataDirectory));
#else
tt_int_op(0, ==, mkdir(options->DataDirectory, 0700));
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 670d87d07..508c15596 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -530,7 +530,7 @@ test_util_threads(void)
char *s1 = NULL, *s2 = NULL;
int done = 0, timedout = 0;
time_t started;
-#ifndef MS_WINDOWS
+#ifndef _WIN32
struct timeval tv;
tv.tv_sec=0;
tv.tv_usec=10;
@@ -564,7 +564,7 @@ test_util_threads(void)
timedout = done = 1;
}
tor_mutex_release(_thread_test_mutex);
-#ifndef MS_WINDOWS
+#ifndef _WIN32
/* Prevent the main thread from starving the worker threads. */
select(0, NULL, NULL, NULL, &tv);
#endif
@@ -735,7 +735,7 @@ test_util_mmap(void)
test_assert(mapping);
test_eq(mapping->size, strlen("Short file."));
test_streq(mapping->data, "Short file.");
-#ifdef MS_WINDOWS
+#ifdef _WIN32
tor_munmap_file(mapping);
mapping = NULL;
test_assert(unlink(fname1) == 0);
@@ -1260,7 +1260,7 @@ test_util_parent_dir(void *ptr)
tor_free(cp);
}
-#ifdef MS_WINDOWS
+#ifdef _WIN32
static void
test_util_load_win_lib(void *ptr)
{
@@ -1312,7 +1312,7 @@ test_util_exit_status(void *ptr)
;
}
-#ifndef MS_WINDOWS
+#ifndef _WIN32
/** Check that fgets waits until a full line, and not return a partial line, on
* a EAGAIN with a non-blocking pipe */
static void
@@ -1412,7 +1412,7 @@ run_util_spawn_background(const char *argv[], const char *expected_out,
int status;
/* Start the program */
-#ifdef MS_WINDOWS
+#ifdef _WIN32
status = tor_spawn_background(NULL, argv, NULL, &process_handle);
#else
status = tor_spawn_background(argv[0], argv, NULL, &process_handle);
@@ -1459,7 +1459,7 @@ run_util_spawn_background(const char *argv[], const char *expected_out,
static void
test_util_spawn_background_ok(void *ptr)
{
-#ifdef MS_WINDOWS
+#ifdef _WIN32
const char *argv[] = {"test-child.exe", "--test", NULL};
const char *expected_out = "OUT\r\n--test\r\nSLEEPING\r\nDONE\r\n";
const char *expected_err = "ERR\r\n";
@@ -1483,7 +1483,7 @@ test_util_spawn_background_fail(void *ptr)
const char *expected_err = "";
char expected_out[1024];
char code[32];
-#ifdef MS_WINDOWS
+#ifdef _WIN32
const int expected_status = PROCESS_STATUS_ERROR;
#else
/* TODO: Once we can signal failure to exec, set this to be
@@ -1515,7 +1515,7 @@ test_util_spawn_background_partial_read(void *ptr)
process_handle_t *process_handle=NULL;
int status;
char stdout_buf[100], stderr_buf[100];
-#ifdef MS_WINDOWS
+#ifdef _WIN32
const char *argv[] = {"test-child.exe", "--test", NULL};
const char *expected_out[] = { "OUT\r\n--test\r\nSLEEPING\r\n",
"DONE\r\n",
@@ -1533,7 +1533,7 @@ test_util_spawn_background_partial_read(void *ptr)
(void)ptr;
/* Start the program */
-#ifdef MS_WINDOWS
+#ifdef _WIN32
status = tor_spawn_background(NULL, argv, NULL, &process_handle);
#else
status = tor_spawn_background(argv[0], argv, NULL, &process_handle);
@@ -1544,7 +1544,7 @@ test_util_spawn_background_partial_read(void *ptr)
/* Check stdout */
for (expected_out_ctr = 0; expected_out[expected_out_ctr] != NULL;) {
-#ifdef MS_WINDOWS
+#ifdef _WIN32
pos = tor_read_all_handle(process_handle->stdout_pipe, stdout_buf,
sizeof(stdout_buf) - 1, NULL);
#else
@@ -1567,7 +1567,7 @@ test_util_spawn_background_partial_read(void *ptr)
}
/* The process should have exited without writing more */
-#ifdef MS_WINDOWS
+#ifdef _WIN32
pos = tor_read_all_handle(process_handle->stdout_pipe, stdout_buf,
sizeof(stdout_buf) - 1,
process_handle);
@@ -1881,11 +1881,11 @@ struct testcase_t util_tests[] = {
UTIL_TEST(asprintf, 0),
UTIL_TEST(listdir, 0),
UTIL_TEST(parent_dir, 0),
-#ifdef MS_WINDOWS
+#ifdef _WIN32
UTIL_TEST(load_win_lib, 0),
#endif
UTIL_TEST(exit_status, 0),
-#ifndef MS_WINDOWS
+#ifndef _WIN32
UTIL_TEST(fgets_eagain, TT_SKIP),
#endif
UTIL_TEST(spawn_background_ok, 0),