From 537b22d8731af4d8d6d20ce2eade5c0c4a5f2253 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Mon, 25 May 2026 10:48:41 +0530 Subject: coming up with a testing setup --- build.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'build.c') diff --git a/build.c b/build.c index 56c4d74..ec698c8 100644 --- a/build.c +++ b/build.c @@ -36,6 +36,23 @@ int main(int argc, char** argv) { } } + if (argc > 1) { + if (strcmp(argv[1], "test") == 0) { + printf("Test mode\n"); + if (fork() == 0) { + char* args[] = {"gcc", "tests/main.c", "-o", "test.o", NULL}; + execvp(args[0], args); + return 0; + } else { + wait(NULL); + } + + char* args[] = {"./test.o", NULL}; + execvp(args[0], args); + return 0; + } + } + if (fork() == 0) { char* args[] = {"gcc", "src/main.c", "-o", "main.o", NULL}; execvp(args[0], args); -- cgit v1.2.3