Skip to content

Commit 774e6ef

Browse files
committed
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: Thomas Weißschuh <[email protected]> Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6cada28 commit 774e6ef

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tools/testing/selftests/nolibc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ CFLAGS_mips32be = -EB -mabi=32
152152
CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all))
153153
CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \
154154
$(call cc-option,-fno-stack-protector) \
155-
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR)
155+
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA)
156156
LDFLAGS :=
157157

158158
REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \

tools/testing/selftests/nolibc/run-tests.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ download_location="${cache_dir}/crosstools/"
1515
build_location="$(realpath "${cache_dir}"/nolibc-tests/)"
1616
perform_download=0
1717
test_mode=system
18+
CFLAGS_EXTRA="-Werror"
1819
archs="i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv s390 loongarch"
1920

20-
TEMP=$(getopt -o 'j:d:c:b:a:m:ph' -n "$0" -- "$@")
21+
TEMP=$(getopt -o 'j:d:c:b:a:m:peh' -n "$0" -- "$@")
2122

2223
eval set -- "$TEMP"
2324
unset TEMP
@@ -40,6 +41,7 @@ Options:
4041
-a [ARCH] Host architecture of toolchains to use (default: ${hostarch})
4142
-b [DIR] Build location (default: ${build_location})
4243
-m [MODE] Test mode user/system (default: ${test_mode})
44+
-e Disable -Werror
4345
EOF
4446
}
4547

@@ -66,6 +68,9 @@ while true; do
6668
'-m')
6769
test_mode="$2"
6870
shift 2; continue ;;
71+
'-e')
72+
CFLAGS_EXTRA=""
73+
shift; continue ;;
6974
'-h')
7075
print_usage
7176
exit 0
@@ -153,7 +158,7 @@ test_arch() {
153158
exit 1
154159
esac
155160
printf '%-15s' "$arch:"
156-
swallow_output "${MAKE[@]}" "$test_target" V=1
161+
swallow_output "${MAKE[@]}" CFLAGS_EXTRA="$CFLAGS_EXTRA" "$test_target" V=1
157162
cp run.out run.out."${arch}"
158163
"${MAKE[@]}" report | grep passed
159164
}

0 commit comments

Comments
 (0)