From: Nick Bowler Date: Fri, 26 Jan 2024 06:06:45 +0000 (-0500) Subject: tests: Ignore output from the C compiler. X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/commitdiff_plain/cba6ab66683d20b46def45f691fa7c750f3f9a2b tests: Ignore output from the C compiler. Some C compilers are quite noisy and a lot of the tests aren't actually ignoring the output, leading to spurious failures. --- diff --git a/tests/scripts.at b/tests/scripts.at index 92db0a1..1748070 100644 --- a/tests/scripts.at +++ b/tests/scripts.at @@ -1,4 +1,4 @@ -dnl Copyright © 2021-2023 Nick Bowler +dnl Copyright © 2021-2024 Nick Bowler dnl dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. dnl This is free software: you are free to do what the fuck you want to. @@ -93,7 +93,8 @@ int main(void) return 0; } ]]) -AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [], [ignore]) +AT_CHECK([$CC -o test0$EXEEXT test0.c 1>&2 && ./test0$EXEEXT], + [0], [], [ignore]) # test 1: long option names and help text AT_DATA([test1.c], @@ -144,7 +145,7 @@ AT_DATA([lopthelp.awk], ]]) $AWK -f lopthelp.awk options.def >expout -AT_CHECK([$CC -o test1$EXEEXT test1.c && ./test1$EXEEXT], +AT_CHECK([$CC -o test1$EXEEXT test1.c 1>&2 && ./test1$EXEEXT], [0], [expout], [ignore]) # test 2: short option string @@ -191,7 +192,7 @@ AT_DATA([soptstr.awk], ]]) $AWK -f soptstr.awk options.def >expout -AT_CHECK([$CC -o test2$EXEEXT test2.c && ./test2$EXEEXT], +AT_CHECK([$CC -o test2$EXEEXT test2.c 1>&2 && ./test2$EXEEXT], [0], [expout], [ignore]) AT_CLEANUP @@ -312,23 +313,23 @@ int main(void) TEST_GEN_OPTIONS([[--single-option ]], [single.dat]) -AT_CHECK([$CC -o single$EXEEXT test.c && ./single$EXEEXT], [0], +AT_CHECK([$CC -o single$EXEEXT test.c 1>&2 && ./single$EXEEXT], [0], [[0 --single-option, 0, 0 -]]) +]], [ignore]) TEST_GEN_OPTIONS([[-a, --the-first-option -b, --the-second-option=ARG -c, --the-third-option[=ARG] -d, --the-fourth-option ]], [16bit.dat]) -AT_CHECK([$CC -o 16bit$EXEEXT test.c && ./16bit$EXEEXT], [0], +AT_CHECK([$CC -o 16bit$EXEEXT test.c 1>&2 && ./16bit$EXEEXT], [0], [[2 --the-first-option, 0, 'a' --the-second-option, 1, 'b' --the-third-option, 2, 'c' --the-fourth-option, 0, 'd' -]]) +]], [ignore]) AT_CLEANUP @@ -377,7 +378,7 @@ AS_ECHO([' return 0;']) AS_ECHO(['}']) } test0.c -AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [--- +AT_CHECK([$CC -o test0$EXEEXT test0.c 1>&2 && ./test0$EXEEXT], [0], [--- world --- hello world @@ -433,12 +434,12 @@ AT_DATA([test.c], #include HEADER int main(void) { printf("%d %s\n", hello, strtab+hello); return 0; } ]]) -AT_CHECK([$CC -DHEADER='"test0.h"' -o test0$EXEEXT test.c && ./test0$EXEEXT], - [0], [[0 hello -]]) -AT_CHECK([$CC -DHEADER='"test1.h"' -o test1$EXEEXT test.c && ./test1$EXEEXT], - [0], [[1 hello -]]) +AT_CHECK([$CC -DHEADER='"test0.h"' -o test0$EXEEXT test.c 1>&2 && + ./test0$EXEEXT], [0], [[0 hello +]], [ignore]) +AT_CHECK([$CC -DHEADER='"test1.h"' -o test1$EXEEXT test.c 1>&2 && + ./test1$EXEEXT], [0], [[1 hello +]], [ignore]) AT_CLEANUP @@ -465,11 +466,11 @@ int main(void) return 0; } ]]) -AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], +AT_CHECK([$CC -o test0$EXEEXT test0.c 1>&2 && ./test0$EXEEXT], [0], [[foobar bar baz -]]) +]], [ignore]) AT_CLEANUP @@ -514,13 +515,13 @@ int main(void) } ]]) -AT_CHECK([$CC -DHEADER='"test0.h"' -o test0$EXEEXT test.c && ./test0$EXEEXT], - [0], [[hello world world goodbye -]]) +AT_CHECK([$CC -DHEADER='"test0.h"' -o test0$EXEEXT test.c 1>&2 && + ./test0$EXEEXT], [0], [[hello world world goodbye +]], [ignore]) -AT_CHECK([$CC -DHEADER='"test1.h"' -o test1$EXEEXT test.c && ./test1$EXEEXT], - [0], [[hello world world goodbye -]]) +AT_CHECK([$CC -DHEADER='"test1.h"' -o test1$EXEEXT test.c 1>&2 && + ./test1$EXEEXT], [0], [[hello world world goodbye +]], [ignore]) AT_CLEANUP @@ -593,7 +594,8 @@ int main(void) } ]]) sed '/^#/d' tree.def >expout -AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [expout]) +AT_CHECK([$CC -o test0$EXEEXT test0.c 1>&2 && ./test0$EXEEXT], + [0], [expout], [ignore]) AT_CLEANUP @@ -635,7 +637,7 @@ int main(void) } ]]) -AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], +AT_CHECK([$CC -o test0$EXEEXT test0.c 1>&2 && ./test0$EXEEXT], [0], [[1, 3 2, 6 0, 0 @@ -645,7 +647,7 @@ AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], 1, 0 2, 0 0, 0 -]]) +]], [ignore]) AT_DATA([flat.def], [[FLAT @@ -657,12 +659,12 @@ AT_DATA([flat.def], AT_CHECK([$AWK -f "$srcdir/scripts/gen-tree.awk" flat.h]) sed -e 's/tree\.h/flat.h/' -e 's/ROOT/FLAT/' test0.c >test1.c -AT_CHECK([$CC -o test1$EXEEXT test1.c && ./test1$EXEEXT], [0], +AT_CHECK([$CC -o test1$EXEEXT test1.c 1>&2 && ./test1$EXEEXT], [0], [[1, 0 2, 0 3, 0 0, 0 -]]) +]], [ignore]) AT_CLEANUP