test/runtests.sh: distinguish between failed and OK timeouts

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/test/35fa71a030ca-test.c b/test/35fa71a030ca-test.c
index 17e062b..1573413 100644
--- a/test/35fa71a030ca-test.c
+++ b/test/35fa71a030ca-test.c
@@ -310,8 +310,15 @@
     break;
   }
 }
+
+static void sig_int(int sig)
+{
+	exit(0);
+}
+
 int main(void)
 {
+  signal(SIGINT, sig_int);
   syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
   loop();
   return 0;
diff --git a/test/a4c0b3decb33-test.c b/test/a4c0b3decb33-test.c
index e1e0706..c7d0fec 100644
--- a/test/a4c0b3decb33-test.c
+++ b/test/a4c0b3decb33-test.c
@@ -164,8 +164,14 @@
 	syscall(__NR_io_uring_setup, 0x983, 0x20000080);
 }
 
+static void sig_int(int sig)
+{
+	exit(0);
+}
+
 int main(void)
 {
+	signal(SIGINT, sig_int);
 	syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
 	loop();
 	return 0;
diff --git a/test/runtests.sh b/test/runtests.sh
index b2e5526..9ca4654 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -17,12 +17,12 @@
 	else
 		echo Running test $t
 	fi
-	timeout -s INT $TIMEOUT ./$t
+	timeout --preserve-status -s INT $TIMEOUT ./$t
 	r=$?
 	if [ "${r}" -eq 124 ]; then
 		echo "Test $t timed out (may not be a failure)"
 	elif [ "${r}" -ne 0 ]; then
-		echo Test $t failed
+		echo "Test $t failed with ret ${r}"
 		FAILED="$FAILED $t"
 		RET=1
 	fi
@@ -30,6 +30,8 @@
 
 if [ "${RET}" -ne 0 ]; then
 	echo "Tests $FAILED failed"
+	exit $RET
+else
+	echo "All tests passed"
+	exit 0
 fi
-
-exit $RET