summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jenkins-helpers.sh10
-rw-r--r--round-robin.sh14
2 files changed, 15 insertions, 9 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index f862a4ab..2b089799 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -817,17 +817,17 @@ print_volume_mounts ()
# Add ccache volume for tcwg_* jobs.
# These jobs depend on ccache for fast rebuilds of LLVM and GCC with
# the host compiler.
- # tcwg_* jobs use per-executor WORKSPACES, and ccache uses separate
- # cache entries for different paths. Therefore we need to use
- # separate caches for different $WORKSPACES. Otherwise we get
- # a lot of cache polution on high-executor machines, e.g., for
- # tcwg_bmk builds on tcwg-x86_64-dev-01 node.
local prefix
if [ x"${WORKSPACE+set}" = x"set" ]; then
prefix=$(basename $WORKSPACE)
else
prefix=$(echo $job | cut -d- -f 1)
fi
+ # tcwg_* jobs use per-executor WORKSPACES, and we configure ccache
+ # to use CCACHE_BASEDIR=$WORKSPACE so that ccache sees same paths
+ # for builds on different executors.
+ # Strip "_$EXECUTOR_NUMBER" from the job/workspace ID.
+ prefix="${prefix%_[0-9]*}"
volume_id=$(print_docker_name "$prefix$suffix")
mounts+=(ccache-"$volume_id":"$HOME"/.ccache)
;;
diff --git a/round-robin.sh b/round-robin.sh
index de33c873..48834ce8 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -184,6 +184,9 @@ prepare_abe ()
clone_or_update_repo abe tested https://git-us.linaro.org/toolchain/abe.git > /dev/null
+ local workspace
+ workspace=$(pwd)
+
cd abe
# Add ccache wrappers.
@@ -193,14 +196,14 @@ prepare_abe ()
cat > "$(pwd)/bin/gcc" <<EOF
#!/bin/sh
-exec ccache /usr/bin/gcc "\$@"
+CCACHE_BASEDIR=$workspace exec ccache /usr/bin/gcc "\$@"
EOF
chmod +x "$(pwd)/bin/gcc"
cp "$(pwd)/bin/gcc" "$(pwd)/bin/cc"
cat > "$(pwd)/bin/g++" <<EOF
#!/bin/sh
-exec ccache /usr/bin/g++ "\$@"
+CCACHE_BASEDIR=$workspace exec ccache /usr/bin/g++ "\$@"
EOF
chmod +x "$(pwd)/bin/g++"
cp "$(pwd)/bin/g++" "$(pwd)/bin/c++"
@@ -479,6 +482,9 @@ build_llvm ()
sanity_check_pwd
+ local workspace
+ workspace=$(pwd)
+
# Setup ccache and ninja wrappers.
# shellcheck disable=SC2115
rm -rf "$(pwd)/bin"
@@ -486,13 +492,13 @@ build_llvm ()
cat > "$(pwd)/bin/cc" <<EOF
#!/bin/sh
-exec ccache /usr/bin/gcc "\$@"
+CCACHE_BASEDIR=$workspace exec ccache /usr/bin/gcc "\$@"
EOF
chmod +x "$(pwd)/bin/cc"
cat > "$(pwd)/bin/c++" <<EOF
#!/bin/sh
-exec ccache /usr/bin/g++ "\$@"
+CCACHE_BASEDIR=$workspace exec ccache /usr/bin/g++ "\$@"
EOF
chmod +x "$(pwd)/bin/c++"