Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname.cc =================================================================== --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname.cc +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname.cc @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // UNSUPPORTED: linux, solaris +#include #include #include #include @@ -9,11 +10,8 @@ struct stat st; char *name; - if (stat("/dev/null", &st)) - exit(1); - - if (!(name = devname(st.st_rdev, S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK))) - exit(1); + assert(!stat("/dev/null", &st)); + assert((name = devname(st.st_rdev, S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK))); printf("%s\n", name); Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc =================================================================== --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -12,17 +13,14 @@ char name[100]; mode_t type; - if (stat("/dev/null", &st)) - exit(1); + assert(!stat("/dev/null", &st)); type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK; #if defined(__NetBSD__) - if (devname_r(st.st_rdev, type, name, sizeof(name))) - exit(1); + assert(!devname_r(st.st_rdev, type, name, sizeof(name))); #else - if (!devname_r(st.st_rdev, type, name, sizeof(name))) - exit(1); + assert(devname_r(st.st_rdev, type, name, sizeof(name))); #endif printf("%s\n", name); Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fgetln.cc =================================================================== --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fgetln.cc +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fgetln.cc @@ -1,24 +1,20 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t // UNSUPPORTED: linux +#include #include #include int main(void) { - FILE *fp; - size_t len; - char *s; - - fp = fopen("/etc/hosts", "r"); - if (!fp) - exit(1); + FILE *fp = fopen("/etc/hosts", "r"); + assert(fp); - s = fgetln(fp, &len); + size_t len; + char *s = fgetln(fp, &len); printf("%.*s\n", (int)len, s); - if (fclose(fp) == EOF) - exit(1); + assert(!fclose(fp)); return 0; } Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fgets.cc =================================================================== --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fgets.cc +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fgets.cc @@ -1,20 +1,16 @@ // RUN: %clangxx -g %s -o %t && %run %t +#include #include int main(int argc, char **argv) { - FILE *fp; - char buf[2]; - char *s; - - fp = fopen(argv[0], "r"); - if (!fp) - return 1; + FILE *fp = fopen(argv[0], "r"); + assert(fp); - s = fgets(buf, sizeof(buf), fp); - if (!s) - return 2; + char buf[2]; + char *s = fgets(buf, sizeof(buf), fp); + assert(s); - fclose(fp); + assert(!fclose(fp)); return 0; } Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fputs_puts.cc =================================================================== --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fputs_puts.cc +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fputs_puts.cc @@ -1,18 +1,12 @@ // RUN: %clangxx -g %s -o %t && %run %t | FileCheck %s // CHECK: {{^foobar$}} +#include #include int main(void) { - int r; - - r = fputs("foo", stdout); - if (r < 0) - return 1; - - r = puts("bar"); - if (r < 0) - return 1; + assert(fputs("foo", stdout) >= 0); + assert(puts("bar") >= 0); return 0; } Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/lstat.cc =================================================================== --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/lstat.cc +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/lstat.cc @@ -1,16 +1,14 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t +#include #include #include int main(void) { struct stat st; - if (lstat("/dev/null", &st)) - exit(1); - - if (!S_ISCHR(st.st_mode)) - exit(1); + assert(!lstat("/dev/null", &st)); + assert(S_ISCHR(st.st_mode)); return 0; }