diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2018-12-18 23:14:00 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2018-12-21 19:30:18 +0000 |
commit | 432f1088fd44c6bb5408037e46da14ea16990ab0 (patch) | |
tree | 6d44a60da864caaf254ee9c3a403904f68b72547 /tcwg-benchmark.sh | |
parent | 938eeb83a7b428bbd18624db9aa4669d158985b2 (diff) |
tcwg-benchmark.sh: Determine toolchain_type when toolchain_url is of ssh:// type
Change-Id: Iab7b696ba0972db8e2362aa0896af9a35e179839
Diffstat (limited to 'tcwg-benchmark.sh')
-rwxr-xr-x | tcwg-benchmark.sh | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/tcwg-benchmark.sh b/tcwg-benchmark.sh index 652234db..ee86bf80 100755 --- a/tcwg-benchmark.sh +++ b/tcwg-benchmark.sh @@ -86,6 +86,7 @@ case "$toolchain_url" in echo "ERROR: Unsupported sysroot $sysroot for toolchain_url $toolchain_url" exit 1 fi + toolchaindir="$(dirname $(echo $ccprefix | cut -s -d: -f 3))" ;; "http://"*".tar.xz"|"https://"*".tar.xz") toolchaindir=$(untar_url "$toolchain_url" "$WORKSPACE" "--strip-components 1") @@ -110,13 +111,25 @@ case "$toolchain_url" in esac case "$toolchain_url" in - "http://"*|"https://"*|"rsync://"*) + "http://"*|"https://"*|"rsync://"*|"ssh://"*) + + # In the ssh:// case, we have to perform the 'find' operations + # remotely. + case "$toolchain_url" in + "ssh://"*) + maybe_remote="ssh -p $build_container_port $build_container_host" + ;; + *) + maybe_remote="" + ;; + esac + case "$toolchain_type" in "gnu"|"llvm") ;; "auto") - if [ x"$(find "$toolchaindir" -path "*bin/*gcc" | wc -l)" != x"0" ]; then + if [ x"$($maybe_remote find "$toolchaindir" -path "*bin/*gcc" | wc -l)" != x"0" ]; then toolchain_type="gnu" - elif [ x"$(find "$toolchaindir" -path "*bin/*clang" | wc -l)" != x"0" ]; then + elif [ x"$($maybe_remote find "$toolchaindir" -path "*bin/*clang" | wc -l)" != x"0" ]; then toolchain_type="llvm" else echo "ERROR: Cannot autodetect toolchain type" @@ -133,15 +146,24 @@ case "$toolchain_url" in "gnu") ccname="gcc" ;; "llvm") ccname="clang" ;; esac - ccpath=$(find "$toolchaindir" -path "*bin/*$ccname") + ccpath=$($maybe_remote find "$toolchaindir" -path "*bin/*$ccname") if [ $(echo "$ccpath" | wc -w) -ne 1 ]; then echo "ERROR: found more than one compiler: $ccpath" exit 1 fi - ccprefix=$(echo "$ccpath" | sed -e "s/$ccname\$//") - # Copy toolchain to the build container. - rsync -a --delete -e "ssh -p$build_container_port" "$toolchaindir/" "$build_container_host:$toolchaindir/" - ccprefix="$build_container_host:$build_container_port:$ccprefix" + + # Non-ssh:// cases have to copy the just-copied toolchain to + # the remote build container. For ssh://, we'll access the + # toolchain remotely. + case "$toolchain_url" in + "ssh://"*) ;; + *) + ccprefix=$(echo "$ccpath" | sed -e "s/$ccname\$//") + # Copy toolchain to the build container. + rsync -a --delete -e "ssh -p$build_container_port" "$toolchaindir/" "$build_container_host:$toolchaindir/" + ccprefix="$build_container_host:$build_container_port:$ccprefix" + ;; + esac ;; esac |