diff --git a/tests/dirent/main.c b/tests/dirent/main.c index 92a4fe2467..e9f943526d 100644 --- a/tests/dirent/main.c +++ b/tests/dirent/main.c @@ -10,7 +10,7 @@ int main(void) { if (dir == NULL) { perror("opendir"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } struct dirent* entry; diff --git a/tests/dirent/scandir.c b/tests/dirent/scandir.c index 8bbee0d13f..a3102e5e10 100644 --- a/tests/dirent/scandir.c +++ b/tests/dirent/scandir.c @@ -12,7 +12,7 @@ int main(void) { int len = scandir("example_dir/", &array, filter, alphasort); if (len < 0) { perror("scandir"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } for(int i = 0; i < len; i += 1) { diff --git a/tests/fcntl/create.c b/tests/fcntl/create.c index c881270c2f..a5b6ffe30c 100644 --- a/tests/fcntl/create.c +++ b/tests/fcntl/create.c @@ -7,9 +7,9 @@ int main(void) { if (fd >= 0) { write(fd, "Hello World!\n", 13); close(fd); - return EXIT_SUCCESS; + exit(EXIT_SUCCESS); } else { write(STDERR_FILENO, "creat failed\n", 13); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/netdb/getaddrinfo.c b/tests/netdb/getaddrinfo.c index 1c92a86307..b57c1bb2c5 100644 --- a/tests/netdb/getaddrinfo.c +++ b/tests/netdb/getaddrinfo.c @@ -22,7 +22,7 @@ int main(void) { errcode = getaddrinfo("www.redox-os.org", NULL, &hints, &res); if (errcode != 0) { perror("getaddrinfo"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } while (res) { diff --git a/tests/pwd.c b/tests/pwd.c index 029972c7b7..59acfdef66 100644 --- a/tests/pwd.c +++ b/tests/pwd.c @@ -19,7 +19,7 @@ int main(void) { struct passwd *pwd = getpwuid(0); if (errno != 0) { perror("getpwuid"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (pwd != NULL) { print(pwd); @@ -30,7 +30,7 @@ int main(void) { pwd = getpwnam("nobody"); if (errno != 0) { perror("getpwnam"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (pwd != NULL) { print(pwd); @@ -43,12 +43,12 @@ int main(void) { if (getpwuid_r(0, &pwd2, buf, 100, &result) < 0) { perror("getpwuid_r"); free(buf); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (result != NULL) { if (result != &pwd2) { free(buf); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } print(&pwd2); } @@ -57,12 +57,12 @@ int main(void) { if (getpwnam_r("nobody", &pwd2, buf, 100, &result) < 0) { perror("getpwuid_r"); free(buf); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (result != NULL) { if (result != &pwd2) { free(buf); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } print(&pwd2); } @@ -72,11 +72,11 @@ int main(void) { char buf2[1]; if (getpwuid_r(0, &pwd2, buf2, 1, &result) == 0) { puts("This shouldn't have succeeded, but did!"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (errno != ERANGE) { perror("getpwuid_r"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts("Returned ERANGE because the buffer was too small 👍"); } diff --git a/tests/regex.c b/tests/regex.c index e920b601d3..d59989e758 100644 --- a/tests/regex.c +++ b/tests/regex.c @@ -11,7 +11,7 @@ int main(void) { regerror(error, ®ex, error_buf, 255); error_buf[255] = 0; printf("regcomp error: %d = %s\n", error, error_buf); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } regmatch_t matches[3] = {{0}}; @@ -23,7 +23,7 @@ int main(void) { if (error) { regerror(error, ®ex, error_buf, 255); printf("regexec error: %d = %s\n", error, error_buf); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } for (int group = 0; group < 3; group += 1) { diff --git a/tests/resource/getrusage.c b/tests/resource/getrusage.c index 1650dd6fc5..f924b5ae34 100644 --- a/tests/resource/getrusage.c +++ b/tests/resource/getrusage.c @@ -10,7 +10,7 @@ int main(void) { struct rusage r_usage; if (getrusage(RUSAGE_SELF, &r_usage) < 0) { perror("getrusage"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } printf("ru_utime:"); ptimeval(&r_usage.ru_utime); diff --git a/tests/signal.c b/tests/signal.c index 1a48004507..3c1ceab8d8 100644 --- a/tests/signal.c +++ b/tests/signal.c @@ -12,14 +12,14 @@ int main(void) { if (signal(SIGUSR1, &handler) == SIG_ERR) { puts("Signal error!"); printf("%d\n", errno); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts("Raising..."); if (raise(SIGUSR1)) { puts("Raise error!"); printf("%d\n", errno); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts("Raised."); } diff --git a/tests/stdio/fgets.c b/tests/stdio/fgets.c index e48247b98f..28254debef 100644 --- a/tests/stdio/fgets.c +++ b/tests/stdio/fgets.c @@ -13,7 +13,7 @@ int main(void) { puts("EOF"); if (!feof(f)) { puts("feof() not updated!"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } break; } diff --git a/tests/stdio/fread.c b/tests/stdio/fread.c index e5e13b28cb..e69b6f1700 100644 --- a/tests/stdio/fread.c +++ b/tests/stdio/fread.c @@ -9,7 +9,7 @@ int main(void) { for (int i = 1; i <= 32; ++i) { if (fread(buf, 1, i, fp) < 0) { perror("fread"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } buf[i] = 0; diff --git a/tests/stdio/fseek.c b/tests/stdio/fseek.c index 6f166928f3..ddbcfb6778 100644 --- a/tests/stdio/fseek.c +++ b/tests/stdio/fseek.c @@ -5,7 +5,7 @@ int main(void) { FILE *f = fopen("stdio/stdio.in", "r"); if (fseek(f, 14, SEEK_CUR) < 0) { puts("fseek error"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } char buffer[256]; printf("%s", fgets(buffer, 256, f)); diff --git a/tests/stdio/fwrite.c b/tests/stdio/fwrite.c index 9132420bff..c858cca174 100644 --- a/tests/stdio/fwrite.c +++ b/tests/stdio/fwrite.c @@ -7,15 +7,15 @@ int main(void) { const char ptr[] = "Hello World!"; if (fwrite(ptr, 0, 17, f)) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (fwrite(ptr, 7, 0, f)) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (fwrite(ptr, 0, 0, f)) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } fwrite(ptr, sizeof(ptr), 1, f); diff --git a/tests/stdio/getc_unget.c b/tests/stdio/getc_unget.c index 55eb6bbb3e..fded82577f 100644 --- a/tests/stdio/getc_unget.c +++ b/tests/stdio/getc_unget.c @@ -6,8 +6,8 @@ int main(void) { char c; if ((c = getchar()) == 'h') { printf("Worked!\n"); - return EXIT_SUCCESS; + exit(EXIT_SUCCESS); } printf("failed :( %c\n", c); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } diff --git a/tests/stdio/mutex.c b/tests/stdio/mutex.c index d318ea3e2b..229e3f56ec 100644 --- a/tests/stdio/mutex.c +++ b/tests/stdio/mutex.c @@ -11,17 +11,17 @@ int main(void) { if (!ftrylockfile(f)) { puts("Mutex unlocked but it shouldn't be"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } funlockfile(f); if (ftrylockfile(f)) { puts("Mutex locked but it shouldn't be"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (!ftrylockfile(f)) { puts("Mutex unlocked but it shouldn't be"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } funlockfile(f); } diff --git a/tests/stdio/popen.c b/tests/stdio/popen.c index afa83fab0a..b534fb9f5e 100644 --- a/tests/stdio/popen.c +++ b/tests/stdio/popen.c @@ -10,7 +10,7 @@ int main(void) { fp = popen("ls -1 example_dir", "r"); if (fp == NULL) { perror("popen"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } while (fgets(path, 256, fp) != NULL) { @@ -21,7 +21,7 @@ int main(void) { status = pclose(fp); if (status == -1) { perror("pclose"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } else { printf("status %x\n", status); } diff --git a/tests/stdio/rename.c b/tests/stdio/rename.c index df88c5f54f..31cf8f252d 100644 --- a/tests/stdio/rename.c +++ b/tests/stdio/rename.c @@ -21,8 +21,8 @@ int main(void) { close(fd); remove(newpath); if (strcmp(str, buf) == 0) { - return EXIT_SUCCESS; + exit(EXIT_SUCCESS); } else { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/stdio/sprintf.c b/tests/stdio/sprintf.c index 829ce59989..2de35e4508 100644 --- a/tests/stdio/sprintf.c +++ b/tests/stdio/sprintf.c @@ -12,7 +12,7 @@ int main(void) { ); if (ret != 68) { printf("Failed! Return value was %d\n", ret); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } memset(buffer, 0, sizeof(buffer)); @@ -25,7 +25,7 @@ int main(void) { ); if (ret != 86) { printf("Failed! Return value was %d\n", ret); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts(buffer); diff --git a/tests/stdlib/a64l.c b/tests/stdlib/a64l.c index 7c44bb84ed..ddf7d88526 100644 --- a/tests/stdlib/a64l.c +++ b/tests/stdlib/a64l.c @@ -6,7 +6,7 @@ int main(void) { long l = a64l(s); if (l != 194301926) { printf("Invalid result: a64l(%s) = %ld\n", s, l); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } printf("Correct a64l: %s = %ld\n", s, l); @@ -15,7 +15,7 @@ int main(void) { l = a64l(s); if (l != 53222) { printf("Invalid result: a64l(%s) = %ld\n", s, l); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } printf("Correct a64l: %s = %ld\n", s, l); } diff --git a/tests/stdlib/bsearch.c b/tests/stdlib/bsearch.c index a56756a77a..678e8a7e83 100644 --- a/tests/stdlib/bsearch.c +++ b/tests/stdlib/bsearch.c @@ -13,7 +13,7 @@ int int_cmp(const void* a, const void* b) { size_t i = 0; \ for (; i < len; ++i) printf("%d,", arr[i]); \ printf("] expected %p but got %p\n", (void*) expect, res); \ - return EXIT_FAILURE; \ + exit(EXIT_FAILURE); \ } \ } while (0); diff --git a/tests/stdlib/env.c b/tests/stdlib/env.c index 83cd0b44fc..5bdda7f3d5 100644 --- a/tests/stdlib/env.c +++ b/tests/stdlib/env.c @@ -34,7 +34,7 @@ int main(void) { if (env) { puts("This should be null, but isn't"); puts(env); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } else { puts("Value deleted successfully!"); } diff --git a/tests/stdlib/realpath.c b/tests/stdlib/realpath.c index 5bcea42717..c5df66f9dd 100644 --- a/tests/stdlib/realpath.c +++ b/tests/stdlib/realpath.c @@ -8,7 +8,7 @@ int main(void) { char* path = realpath("stdlib/realpath.c", NULL); if (!path) { perror("realpath"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts(path); @@ -21,7 +21,7 @@ int main(void) { if (!path) { perror("realpath"); free(path); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts(path); diff --git a/tests/string/mem.c b/tests/string/mem.c index 2b717d6c75..305d643904 100644 --- a/tests/string/mem.c +++ b/tests/string/mem.c @@ -9,7 +9,7 @@ int main(void) { arr[50] = 1; if ((size_t)memchr((void *)arr, 1, 100) - (size_t)arr != 50) { puts("Incorrect memchr"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts("Correct memchr"); char arr2[51]; @@ -17,25 +17,25 @@ int main(void) { memccpy((void *)arr2, (void *)arr, 1, 100); if (arr[50] != 1) { puts("Incorrect memccpy"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts("Correct memccpy"); int res; if ((res = memcmp("hello world", "hello world", 11))) { printf("Incorrect memcmp (1), expected 0 found %d\n", res); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if ((res = memcmp("hello world", "hello worlt", 11)) >= 0) { printf("Incorrect memcmp (2), expected -, found %d\n", res); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if ((res = memcmp("hello world", "hallo world", 5)) <= 0) { printf("Incorrect memcmp (3), expected +, found %d\n", res); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if ((res = memcmp("hello world", "henlo world", 5)) >= 0) { printf("Incorrect memcmp (4), expected -, found %d\n", res); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } puts("Correct memcmp"); } diff --git a/tests/string/strrchr.c b/tests/string/strrchr.c index d32c244ff1..a8ae06c024 100644 --- a/tests/string/strrchr.c +++ b/tests/string/strrchr.c @@ -8,14 +8,14 @@ int main(void) { if (ptr != &s0[10]) { printf("%p != %p\n", ptr, &s0[10]); printf("strrchr FAIL , exit with status code %d\n", 1); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } char s1[] = ""; ptr = strrchr(s1, 'a'); if (ptr != NULL) { printf("%p != 0\n", ptr); printf("strrchr FAIL, exit with status code %d\n", 1); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } printf("strrch PASS, exiting with status code %d\n", 0); } diff --git a/tests/time/asctime.c b/tests/time/asctime.c index f2e57da1a6..9f7e2b5494 100644 --- a/tests/time/asctime.c +++ b/tests/time/asctime.c @@ -10,6 +10,6 @@ int main(void) { char *time_string = asctime(time_info); if (time_string == NULL || strcmp(time_string, "Thu Jan 1 00:00:00 1970\n") != 0) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/time/gmtime.c b/tests/time/gmtime.c index 09bc97e5ef..a0af0ab6be 100644 --- a/tests/time/gmtime.c +++ b/tests/time/gmtime.c @@ -14,7 +14,7 @@ int main(void) { info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday || info->tm_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst || info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (info->tm_sec != expected.tm_sec || info->tm_min != expected.tm_min || @@ -22,6 +22,6 @@ int main(void) { info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday || info->tm_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst || info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/time/mktime.c b/tests/time/mktime.c index eba83363c0..f3010de6e7 100644 --- a/tests/time/mktime.c +++ b/tests/time/mktime.c @@ -14,9 +14,9 @@ int check(time_t input) { t->tm_year, t->tm_yday, t->tm_mon, t->tm_mday, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec ); puts("Failed!"); - return EXIT_FAILURE; + return 1; } - return EXIT_SUCCESS; + return 0; } int main(void) { @@ -31,7 +31,7 @@ int main(void) { time_t inputs[] = { -(day * 33), -day, -500, 0, 1531454950 }; for (int i = 0; i < 5; i += 1) { if (check(inputs[i])) { - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/time/time.c b/tests/time/time.c index 24d7b28d34..8ee969ed2f 100644 --- a/tests/time/time.c +++ b/tests/time/time.c @@ -8,18 +8,18 @@ int main(void) { int cgt = clock_gettime(CLOCK_REALTIME, &tm); if (cgt == -1) { perror("clock_gettime"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } time_t t = time(NULL); if (t == (time_t)-1) { perror("time"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } clock_t c = clock(); if (c == (clock_t)-1) { perror("clock"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/unistd/access.c b/tests/unistd/access.c index 9de843b6d1..f7a5ecf6ae 100644 --- a/tests/unistd/access.c +++ b/tests/unistd/access.c @@ -5,11 +5,11 @@ int main(void) { if (access("example_dir/1-never-gonna-give-you-up", R_OK | W_OK)) { perror("access"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (!access("example_dir/1-never-gonna-give-you-up", X_OK)) { puts("Accessing a file with X_OK worked even though it... probably... shouldn't?"); puts("Please run `chmod 644 example_dir/*` and try again."); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/unistd/getcwd.c b/tests/unistd/getcwd.c index f1e088f8ca..2f9442e2a4 100644 --- a/tests/unistd/getcwd.c +++ b/tests/unistd/getcwd.c @@ -15,7 +15,7 @@ int main(void) { if (strcmp(first, second)) { puts("Not matching"); free(second); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } free(second); diff --git a/tests/unistd/link.c b/tests/unistd/link.c index 7c2af4565e..19cf0810e7 100644 --- a/tests/unistd/link.c +++ b/tests/unistd/link.c @@ -12,7 +12,7 @@ int main(void) { // Stat for the inode if (stat("unistd/link.c", &buf)) { perror("stat"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } unsigned long inode = buf.st_ino; printf("%ld\n", inode); @@ -20,7 +20,7 @@ int main(void) { // Create the link if (link("unistd/link.c", "link.out")) { perror("link"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } // Make sure inodes match @@ -38,10 +38,10 @@ int main(void) { // Remove link if (unlink("link.out")) { perror("unlink"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } if (!stat("link.out", &buf) || errno != ENOENT) { perror("stat"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } diff --git a/tests/unistd/pipe.c b/tests/unistd/pipe.c index 90dfa64641..ba1b1c9906 100644 --- a/tests/unistd/pipe.c +++ b/tests/unistd/pipe.c @@ -11,7 +11,7 @@ int main(void) { if (pipe(pip) < 0) { perror("pipe"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } pid = fork(); @@ -29,13 +29,13 @@ int main(void) { /* check result */ if (bytes < 0) { perror("pipe write"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } else if (bytes != strlen(outstring)) { fprintf(stderr, "pipe write: %d != %ld\n", bytes, strlen(outstring)); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } - return EXIT_SUCCESS; + exit(EXIT_SUCCESS); } else /* parent : receives message from child */ { @@ -54,17 +54,17 @@ int main(void) { /* check result */ if (bytes < 0) { perror("pipe read"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } else if (bytes != strlen(outstring)) { fprintf(stderr, "pipe read: %d != %ld\n", bytes, strlen(outstring)); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } else if (memcmp(instring, outstring, strlen(outstring)) != 0) { fprintf(stderr, "pipe read does not match pipe write\n"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } else { printf("%s\n", instring); } - return EXIT_SUCCESS; + exit(EXIT_SUCCESS); } } diff --git a/tests/unistd/stat.c b/tests/unistd/stat.c index 7287c0018e..00997ca43b 100644 --- a/tests/unistd/stat.c +++ b/tests/unistd/stat.c @@ -11,7 +11,7 @@ int main(void) { if (stat("unistd/stat.c", &buf)) { perror("stat"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } printf("st_size: %lu\n", buf.st_size); diff --git a/tests/waitpid.c b/tests/waitpid.c index e25011d89a..6cf019d072 100644 --- a/tests/waitpid.c +++ b/tests/waitpid.c @@ -7,7 +7,7 @@ int main(void) { if (pid == 0) { // child sleep(1); - return EXIT_SUCCESS; + exit(EXIT_SUCCESS); } else { // parent int stat_loc; diff --git a/tests/wchar/putwchar.c b/tests/wchar/putwchar.c index db5e276acc..2f39a8ea10 100644 --- a/tests/wchar/putwchar.c +++ b/tests/wchar/putwchar.c @@ -12,7 +12,7 @@ int main(void) { if (0xFFFFFFFFu == putwchar(wcs[i])) { printf("Unable to putwchar() the wide character.\n"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); } } }