]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/nolibc: run-tests.sh: detect missing toolchain
authorWilly Tarreau <w@1wt.eu>
Sun, 8 Sep 2024 10:00:12 +0000 (12:00 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Wed, 8 Jan 2025 21:02:54 +0000 (22:02 +0100)
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>
tools/testing/selftests/nolibc/run-tests.sh

index e7ecda4ae796fbf0d389f20144511e66ce4f0b30..0f67e80051dcff486df90d30ea201cea97c46f0b 100755 (executable)
@@ -143,6 +143,13 @@ test_arch() {
        arch=$1
        ct_arch=$(crosstool_arch "$arch")
        ct_abi=$(crosstool_abi "$1")
+
+       if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
+               echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
+               echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
+               return 1
+       fi
+
        cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
        build_dir="${build_location}/${arch}"
        if [ "$werror" -ne 0 ]; then