Skip to content

Commit

Permalink
selftests/nolibc: run-tests.sh: detect missing toolchain
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Willy Tarreau authored and Thomas Weißschuh committed Jan 8, 2025
1 parent 40384c8 commit 4b92b79
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/testing/selftests/nolibc/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b92b79

Please sign in to comment.