Commit 5fc24ec

kravantokh <kravantokh@noreply.codeberg.org>
2026-08-16 16:27:58
Make builds properly stop on failure.
1 parent a5ddfe8
Changed files (1)
testing
testing/test.sh
@@ -4,6 +4,7 @@ rm -rf ./build/tests/*
 mkdir -p ./build/tests
 
 CFLAGS=(-nostdlib -ffreestanding -I. -DNOTLIBC_IMPLEMENT -DNOTLIBC_SILENCE -fno-builtin -g -Wall -Wextra -Wpedantic -Werror)
+pids=()
 
 ensure () {
 	if ! command -v "$1" >/dev/null 2>&1 ; then
@@ -42,7 +43,8 @@ build () {
 	echo "Building $filename."
 
 	if ! $2 ${flags[@]} $1 -o "$out"; then
-		echo "Build failed for "
+		echo "Build failed for $out."
+		exit 1
 	fi
 }
 
@@ -57,7 +59,6 @@ ensure tcc
 ensure gdb
 
 i=0
-pids=()
 
 for SRC in ./testing/tests/*.c; do
 
@@ -78,6 +79,7 @@ for SRC in ./testing/tests/*.c; do
 		for pid in "${pids[@]}"; do
 			if ! wait "$pid"; then
 				echo "Some compilation failed. Check the other messages, since this is parallelized."
+				exit 1
 			fi
 		done
 		pids=()