From 5a5d524f4a04dd38b7cf47077706faa4334593c0 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Tue, 23 Jun 2009 01:18:00 -0400 Subject: [PATCH] SVN-Revision: 1181 --- tar/test/main.c | 15 +++++++++------ tar/test/test.h | 3 +++ tar/test/test_0.c | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tar/test/main.c b/tar/test/main.c index a3fc995b4..ad8b08cad 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -1026,9 +1026,7 @@ int main(int argc, char **argv) int i, tests_run = 0, tests_failed = 0, option; time_t now; char *refdir_alloc = NULL; -#if defined(_WIN32) && !defined(__CYGWIN__) char *testprg; -#endif const char *progname; const char *tmp, *option_arg, *p; char tmpdir[256]; @@ -1120,7 +1118,7 @@ int main(int argc, char **argv) break; case 'p': #ifdef PROGRAM - testprog = option_arg; + testprogfile = option_arg; #else usage(progname); #endif @@ -1144,7 +1142,7 @@ int main(int argc, char **argv) * Sanity-check that our options make sense. */ #ifdef PROGRAM - if (testprog == NULL) + if (testprogfile == NULL) usage(progname); #endif #if defined(_WIN32) && !defined(__CYGWIN__) @@ -1152,13 +1150,18 @@ int main(int argc, char **argv) * command.com cannot accept the command used '/' with drive * name such as c:/xxx/command.exe when use '|' pipe handling. */ - testprg = strdup(testprog); + testprg = strdup(testprogfile); for (i = 0; testprg[i] != '\0'; i++) { if (testprg[i] == '/') testprg[i] = '\\'; } - testprog = testprg; + testprogfile = testprg; #endif + testprg = malloc(strlen(testprogfile) + 3); + strcpy(testprg, "\""); + strcat(testprg, testprogfile); + strcat(testprg, "\""); + testprog = testprg; /* * Create a temp directory for the following tests. diff --git a/tar/test/test.h b/tar/test/test.h index 4dab51c32..b1b9ea354 100644 --- a/tar/test/test.h +++ b/tar/test/test.h @@ -172,4 +172,7 @@ void extract_reference_file(const char *); */ /* Pathname of exe to be tested. */ +const char *testprogfile; +/* Name of exe to use in printf-formatted command strings. */ +/* On Windows, this includes leading/trailing quotes. */ const char *testprog; diff --git a/tar/test/test_0.c b/tar/test/test_0.c index e7f000133..c9277da16 100644 --- a/tar/test/test_0.c +++ b/tar/test/test_0.c @@ -40,7 +40,7 @@ DEFINE_TEST(test_0) struct stat st; failure("File %s does not exist?!", testprog); - if (!assertEqualInt(0, stat(testprog, &st))) + if (!assertEqualInt(0, stat(testprogfile, &st))) exit(1); failure("%s is not executable?!", testprog); -- 2.47.3