]> git.ozlabs.org Git - ccan/commitdiff
configurator: Use native directory separator
authorKevin Locke <kevin@kevinlocke.name>
Fri, 23 Sep 2016 03:33:07 +0000 (21:33 -0600)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 27 Sep 2016 05:39:45 +0000 (15:39 +1000)
Although Windows APIs generally permit "/" or "\\" for directory
separators in paths, cmd.exe does not recognize "./" when invoking
executables using a relative path and prints the following error:

    '.' is not recognized as an internal or external command,
    operable program or batch file.

Therefore, use "\\" when invoking tests on Windows.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
tools/configurator/configurator.c

index e322c76c72254f2f6089e0e5173978eaededd24d..0252fc1ce8901992649cf8a80ffcaf6684bf153f 100644 (file)
 #define OUTPUT_FILE "configurator.out"
 #define INPUT_FILE "configuratortest.c"
 
 #define OUTPUT_FILE "configurator.out"
 #define INPUT_FILE "configuratortest.c"
 
+#ifdef _WIN32
+#define DIR_SEP   "\\"
+#else
+#define DIR_SEP   "/"
+#endif
+
 static int verbose;
 
 enum test_style {
 static int verbose;
 
 enum test_style {
@@ -585,7 +591,7 @@ static bool run_test(const char *cmd, struct test *test)
                free(output);
                /* We run INSIDE_MAIN tests for sanity checking. */
                if ((test->style & EXECUTE) || (test->style & INSIDE_MAIN)) {
                free(output);
                /* We run INSIDE_MAIN tests for sanity checking. */
                if ((test->style & EXECUTE) || (test->style & INSIDE_MAIN)) {
-                       output = run("./" OUTPUT_FILE, &status);
+                       output = run("." DIR_SEP OUTPUT_FILE, &status);
                        if (!(test->style & EXECUTE) && status != 0)
                                errx(1, "Test for %s failed with %i:\n%s",
                                     test->name, status, output);
                        if (!(test->style & EXECUTE) && status != 0)
                                errx(1, "Test for %s failed with %i:\n%s",
                                     test->name, status, output);