From ff3183ed8c292507254c06b343e24d5da3f73763 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Thu, 6 Jun 2024 12:40:35 +0200 Subject: [build] run executables by full names --- build.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'build.c') diff --git a/build.c b/build.c index a100596..ac9182f 100755 --- a/build.c +++ b/build.c @@ -35,10 +35,13 @@ enum { }; #if defined(_WIN32) && !defined(__CYGWIN__) +#define DELIM "\\" enum { OS = WINDOWS, }; #elif defined(__APPLE__) +#define DELIM "/" enum { OS = MACOS, }; #else +#define DELIM "/" enum { OS = LINUX, }; #endif @@ -419,7 +422,7 @@ i32 main(i32 argc, c8 **argv) { if (system(fmt( "%s %s " - "%s%s/" PROJECT "%s " + "%s%s" DELIM PROJECT "%s " SOURCE_LIB, compiler_c, flags, flag_obj, destination, postfix_obj) @@ -430,8 +433,8 @@ i32 main(i32 argc, c8 **argv) { if (system(fmt( "%s %s " - "%s%s/test_suite%s " - "%s/" PROJECT "%s " + "%s%s" DELIM "test_suite%s " + "%s" DELIM PROJECT "%s " FOLDER_TESTS "_exe.c " "%s", compiler_c, flags, @@ -450,8 +453,8 @@ i32 main(i32 argc, c8 **argv) { for (i32 i = 0; i < sizeof c_tests / sizeof *c_tests; ++i) if (system(fmt( "%s %s " - "%s%s/%s%s " - "%s/" PROJECT "%s " + "%s%s" DELIM "%s%s " + "%s" DELIM PROJECT "%s " FOLDER_TESTS "%s.c" " %s", compiler_c, flags, @@ -470,8 +473,8 @@ i32 main(i32 argc, c8 **argv) { for (i32 i = 0; i < sizeof cpp_tests / sizeof *cpp_tests; ++i) if (system(fmt( "%s %s " - "%s%s/%s%s " - "%s/" PROJECT "%s " + "%s%s" DELIM "%s%s " + "%s" DELIM PROJECT "%s " FOLDER_TESTS "%s.cpp" " %s", compiler_cpp, flags, @@ -492,12 +495,12 @@ i32 main(i32 argc, c8 **argv) { printf("Run tests\n\n"); - if (system(fmt("%s/test_suite", destination)) != 0) + if (system(fmt("\"." DELIM "%s" DELIM "test_suite\"", destination)) != 0) status = 1; i32 code; - code = system(fmt("%s/test_too_many_assertions --quiet", destination)) & 0xff; + code = system(fmt("\"." DELIM "%s" DELIM "test_too_many_assertions\" --quiet", destination)) & 0xff; if (code == 0) printf("too many assertions - OK\n"); else { @@ -505,7 +508,7 @@ i32 main(i32 argc, c8 **argv) { status = 1; } - code = system(fmt("%s/test_too_many_tests --quiet", destination)) & 0xff; + code = system(fmt("\"." DELIM "%s" DELIM "test_too_many_tests\" --quiet", destination)) & 0xff; if (code == 0) printf("too many tests - OK\n"); else { @@ -513,7 +516,7 @@ i32 main(i32 argc, c8 **argv) { status = 1; } - code = system(fmt("%s/test_cpp --quiet", destination)) & 0xff; + code = system(fmt("\"." DELIM "%s" DELIM "test_cpp\" --quiet", destination)) & 0xff; if (code == 0) printf("cpp - OK\n"); else { @@ -521,7 +524,7 @@ i32 main(i32 argc, c8 **argv) { status = 1; } - code = system(fmt("%s/test_signals --quiet", destination)) & 0xff; + code = system(fmt("\"." DELIM "%s" DELIM "test_signals\" --quiet", destination)) & 0xff; if (code == 0) printf("signals - OK\n"); else { @@ -529,12 +532,12 @@ i32 main(i32 argc, c8 **argv) { status = 1; } - system(fmt("%s/test_interprocess clean", destination)); + system(fmt("\"." DELIM "%s" DELIM "test_interprocess\" clean", destination)); if (OS == WINDOWS) - system(fmt("start \"\" /b %s/test_interprocess reader", destination)); + system(fmt("start \"\" /b %s/test_interprocess\" reader", destination)); else - system(fmt("%s/test_interprocess reader &", destination)); - code = system(fmt("%s/test_interprocess writer", destination)); + system(fmt("\"." DELIM "%s" DELIM "test_interprocess\" reader &", destination)); + code = system(fmt("\"." DELIM "%s" DELIM "test_interprocess\" writer", destination)); if (code == 0) printf("interprocess - OK\n"); else { -- cgit v1.2.3