summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-05-03 19:39:58 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-05-03 19:40:28 -0400
commitb11937fc35264180f15b31fedbab56724d2fadfa (patch)
tree67a3bd5e28996a128988bcacbde8829a0a4cd5f8 /tests
parent5b8e0f3fdeba17a4b7e8fdda3bfba0e4fef0634f (diff)
got tests to work on BSD
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/test.c19
2 files changed, 17 insertions, 4 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 4b9aca5..33ccc5b 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,4 +1,6 @@
got
out.c
+a.out
*.exe
test
+*.core
diff --git a/tests/test.c b/tests/test.c
index 1da262b..0593c9d 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -14,7 +14,9 @@ static const char *tests[] = {
"arrs_slices",
"ptr_arithmetic",
"defer",
- "sizeof",
+#ifndef __OpenBSD__
+ "sizeof", /* OpenBSD's GCC doesn't support _Alignof */
+#endif
"new",
"arr",
"arr2",
@@ -42,9 +44,12 @@ static const char *compilers[] = {
};
#else
static const char *compilers[] = {
- "gcc -O0 -g -Wno-parentheses-equality -Wno-builtin-declaration-mismatch",
- "clang -O3 -s -Wno-parentheses-equality -Wno-builtin-requires-header -Wno-format-security",
+ "gcc -O0 -g -Wno-parentheses-equality -Wno-builtin-declaration-mismatch -std=c99",
+ "clang -O3 -s -Wno-parentheses-equality -Wno-builtin-requires-header -Wno-format-security -std=c99"
+#ifdef __linux__ /* couldn't get TCC to build on BSD */
+ ,
"tcc"
+#endif
};
#endif
#define ncompilers ((int)(sizeof compilers / sizeof *compilers))
@@ -61,8 +66,12 @@ int main(int argc, char **argv) {
int i, c;
char command[256];
int color = 0;
+ int valgrind = 0;
#if unix
color = isatty(1);
+ #ifdef __linux__ /* valgrind is complaining a lot on BSD, but i think it's wrong */
+ valgrind = 1;
+ #endif
#endif
char const *failed;
if (color) {
@@ -76,8 +85,10 @@ int main(int argc, char **argv) {
fflush(stdout);
if (windows) {
sprintf(command, "..\\toc %s.toc", test);
+ } else if (valgrind) {
+ sprintf(command, "valgrind -q --error-exitcode=1 ../toc %s.toc", test);
} else {
- sprintf(command, "valgrind -q --exit-on-first-error=yes --error-exitcode=1 ../toc %s.toc", test);
+ sprintf(command, "../toc %s.toc", test);
}
if (system(command)) {
fprintf(stderr, "%s (while compiling toc).\n", failed);