shithub: scc

Download patch

ref: 2bee5e38261775e54c94508a6955f0bbfa28e51c
parent: ee56849c612b6cb6ee27e6f647254967ebdd6981
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Oct 1 14:43:09 EDT 2021

tests/libc: Fix 0001-abort test case

The test 0001-abort was failling but the shell script
was reporting it like passing. The test itself was
not robust enough and the shell script was not considering
the error stream, being blind to assert failed but catched
with a signal handler.

--- a/tests/libc/execute/0001-abort.c
+++ b/tests/libc/execute/0001-abort.c
@@ -9,10 +9,12 @@
 end:
 */
 
+int ret = 1;
+
 void
 handler(int dummy)
 {
-	_Exit(0);
+	_Exit(ret);
 }
 
 int
@@ -20,8 +22,9 @@
 {
 	printf("aborting\n");
 	assert(signal(SIGABRT, handler) != SIG_ERR);
+	ret = 0;
 	abort();
 	printf("borning\n");
 
-	return 0;
+	return 1;
 }
--- a/tests/libc/execute/chktest.sh
+++ b/tests/libc/execute/chktest.sh
@@ -15,7 +15,7 @@
 	(echo $i
 	 ./cc.sh $CFLAGS -o $i $i.c
 	 echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c
-	 ./$i > $tmp2 2>> test.log
+	 ./$i > $tmp2 2>&1
 	 diff -u $tmp1 $tmp2) >> test.log 2>&1 &&
 
 	printf '[PASS]' || printf '[FAIL]'