Commit 774e6ef2 authored by Thomas Weißschuh's avatar Thomas Weißschuh

selftests/nolibc: run-tests.sh: use -Werror by default

run-tests.sh hides the output from the compiler unless the compilation
fails. To recognize newly introduced warnings use -Werror by default.

Also add a switch to disable -Werror in case the warnings are expected.
Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Acked-by: default avatarWilly Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20240423-nolibc-werror-v1-1-e6f0bd66eb45@weissschuh.net
parent 6cada284
...@@ -152,7 +152,7 @@ CFLAGS_mips32be = -EB -mabi=32 ...@@ -152,7 +152,7 @@ CFLAGS_mips32be = -EB -mabi=32
CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all))
CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \ CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \
$(call cc-option,-fno-stack-protector) \ $(call cc-option,-fno-stack-protector) \
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA)
LDFLAGS := LDFLAGS :=
REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \ REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
......
...@@ -15,9 +15,10 @@ download_location="${cache_dir}/crosstools/" ...@@ -15,9 +15,10 @@ download_location="${cache_dir}/crosstools/"
build_location="$(realpath "${cache_dir}"/nolibc-tests/)" build_location="$(realpath "${cache_dir}"/nolibc-tests/)"
perform_download=0 perform_download=0
test_mode=system test_mode=system
CFLAGS_EXTRA="-Werror"
archs="i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv s390 loongarch" archs="i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv s390 loongarch"
TEMP=$(getopt -o 'j:d:c:b:a:m:ph' -n "$0" -- "$@") TEMP=$(getopt -o 'j:d:c:b:a:m:peh' -n "$0" -- "$@")
eval set -- "$TEMP" eval set -- "$TEMP"
unset TEMP unset TEMP
...@@ -40,6 +41,7 @@ Options: ...@@ -40,6 +41,7 @@ Options:
-a [ARCH] Host architecture of toolchains to use (default: ${hostarch}) -a [ARCH] Host architecture of toolchains to use (default: ${hostarch})
-b [DIR] Build location (default: ${build_location}) -b [DIR] Build location (default: ${build_location})
-m [MODE] Test mode user/system (default: ${test_mode}) -m [MODE] Test mode user/system (default: ${test_mode})
-e Disable -Werror
EOF EOF
} }
...@@ -66,6 +68,9 @@ while true; do ...@@ -66,6 +68,9 @@ while true; do
'-m') '-m')
test_mode="$2" test_mode="$2"
shift 2; continue ;; shift 2; continue ;;
'-e')
CFLAGS_EXTRA=""
shift; continue ;;
'-h') '-h')
print_usage print_usage
exit 0 exit 0
...@@ -153,7 +158,7 @@ test_arch() { ...@@ -153,7 +158,7 @@ test_arch() {
exit 1 exit 1
esac esac
printf '%-15s' "$arch:" printf '%-15s' "$arch:"
swallow_output "${MAKE[@]}" "$test_target" V=1 swallow_output "${MAKE[@]}" CFLAGS_EXTRA="$CFLAGS_EXTRA" "$test_target" V=1
cp run.out run.out."${arch}" cp run.out run.out."${arch}"
"${MAKE[@]}" report | grep passed "${MAKE[@]}" report | grep passed
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment