summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/tinytest.c20
-rw-r--r--src/test/tinytest.h2
-rw-r--r--src/test/tinytest_demo.c2
-rw-r--r--src/test/tinytest_macros.h2
4 files changed, 15 insertions, 11 deletions
diff --git a/src/test/tinytest.c b/src/test/tinytest.c
index 8caa4f5453..27fa94c2ca 100644
--- a/src/test/tinytest.c
+++ b/src/test/tinytest.c
@@ -1,4 +1,4 @@
-/* tinytest.c -- Copyright 2009-2010 Nick Mathewson
+/* tinytest.c -- Copyright 2009-2012 Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -22,16 +22,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef TINYTEST_LOCAL
+#include "tinytest_local.h"
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#ifdef TINYTEST_LOCAL
-#include "tinytest_local.h"
-#endif
-
#ifdef _WIN32
#include <windows.h>
#else
@@ -66,8 +65,8 @@ const char *cur_test_prefix = NULL; /**< prefix of the current test group */
const char *cur_test_name = NULL;
#ifdef _WIN32
-/** Pointer to argv[0] for win32. */
-static const char *commandname = NULL;
+/* Copy of argv[0] for win32. */
+static char commandname[MAX_PATH+1];
#endif
static void usage(struct testgroup_t *groups, int list_groups)
@@ -291,7 +290,12 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups)
int i, j, n=0;
#ifdef _WIN32
- commandname = v[0];
+ const char *sp = strrchr(v[0], '.');
+ const char *extension = "";
+ if (!sp || stricmp(sp, ".exe"))
+ extension = ".exe"; /* Add an exe so CreateProcess will work */
+ snprintf(commandname, sizeof(commandname), "%s%s", v[0], extension);
+ commandname[MAX_PATH]='\0';
#endif
for (i=1; i<c; ++i) {
if (v[i][0] == '-') {
diff --git a/src/test/tinytest.h b/src/test/tinytest.h
index cbe28b7f51..7ce7858e64 100644
--- a/src/test/tinytest.h
+++ b/src/test/tinytest.h
@@ -1,4 +1,4 @@
-/* tinytest.h -- Copyright 2009-2010 Nick Mathewson
+/* tinytest.h -- Copyright 2009-2012 Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/src/test/tinytest_demo.c b/src/test/tinytest_demo.c
index 98cb773d1a..be95ce4c1d 100644
--- a/src/test/tinytest_demo.c
+++ b/src/test/tinytest_demo.c
@@ -1,4 +1,4 @@
-/* tinytest_demo.c -- Copyright 2009-2010 Nick Mathewson
+/* tinytest_demo.c -- Copyright 2009-2012 Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/src/test/tinytest_macros.h b/src/test/tinytest_macros.h
index 032393ccf7..1a07ad147b 100644
--- a/src/test/tinytest_macros.h
+++ b/src/test/tinytest_macros.h
@@ -1,4 +1,4 @@
-/* tinytest_macros.h -- Copyright 2009-2010 Nick Mathewson
+/* tinytest_macros.h -- Copyright 2009-2012 Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions