Skip to content

Commit 4b92b79

Browse files
wtarreaut-8ch
authored andcommitted
selftests/nolibc: run-tests.sh: detect missing toolchain
The script tries to resolve the path to the current toolchain using realpath, which fails in case it's not installed, and since it's run under -e, it doesn't have the opportunity to display a help message. Let's detect the absence of the required toolchain before running that command and provide a friendlier message when this happens. Link: https://lore.kernel.org/all/ZtlQbpgpn9OQOPyI@1wt.eu/ Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
1 parent 40384c8 commit 4b92b79

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ test_arch() {
143143
arch=$1
144144
ct_arch=$(crosstool_arch "$arch")
145145
ct_abi=$(crosstool_abi "$1")
146+
147+
if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
148+
echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
149+
echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
150+
return 1
151+
fi
152+
146153
cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
147154
build_dir="${build_location}/${arch}"
148155
if [ "$werror" -ne 0 ]; then

0 commit comments

Comments
 (0)