diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-05-25 10:48:41 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-05-25 10:48:41 +0530 |
| commit | 537b22d8731af4d8d6d20ce2eade5c0c4a5f2253 (patch) | |
| tree | 10e4a5683a7c0f692ed2b3ee537df2256e73df94 /build.c | |
| parent | b0a585e21362137c90a6484de44889d2117d9c7a (diff) | |
coming up with a testing setup
Diffstat (limited to 'build.c')
| -rw-r--r-- | build.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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); |
