[ccan] [PATCH 4/9] configurator: Use native directory separator
David Gibson
david at gibson.dropbear.id.au
Tue Sep 20 15:04:29 AEST 2016
On Sun, Sep 18, 2016 at 06:52:01PM -0600, Kevin Locke wrote:
> 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 at kevinlocke.name>
A bit ugly, but I think necessarily so to accomplish the goal.
Reviewed-by: David Gibson <david at gibson.dropbear.id.au>
> ---
> tools/configurator/configurator.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c
> index 9dcf307..e95fd70 100644
> --- a/tools/configurator/configurator.c
> +++ b/tools/configurator/configurator.c
> @@ -41,6 +41,12 @@
> #define OUTPUT_FILE "configurator.out"
> #define INPUT_FILE "configuratortest.c"
>
> +#ifdef _WIN32
> +#define DIR_SEP "\\"
> +#else
> +#define DIR_SEP "/"
> +#endif
> +
> static const char *progname = "";
> static int verbose;
>
> @@ -615,7 +621,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)) {
> - 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);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20160920/336e9768/attachment-0001.sig>
More information about the ccan
mailing list