summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2022-05-01 13:15:37 +0200
committerJoel Rosdahl <joel@rosdahl.net>2022-05-01 13:29:41 +0200
commitf2ff4b90b8767ea0bc2d49162d85d5f08d72f24c (patch)
tree62ea8fc7d48a3aa287d363ed0e8ae79fa6b177f3
parent292b39dda8b4895b78f6ebff22409f40319e02e9 (diff)
downloadccache-f2ff4b90b8767ea0bc2d49162d85d5f08d72f24c.tar.gz
fix: Isolate inode cache file in tests
All test suites use the default temporary directory location /run/user/<UID>/ccache-tmp when possible, which means that the inode cache file is shared between all test suites. This is problematic when running test suites in parallel since one test suite may run “ccache -C” (which removes the inode cache file) between two compilations in the inode_cache suite, thus making the second compilation not behave as expected, failing the test. Fix this by putting the temporary directory inside the test-specific ccache directory instead of using the default global location. Fixes #1045.
-rw-r--r--test/suites/inode_cache.bash7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/suites/inode_cache.bash b/test/suites/inode_cache.bash
index e328ac66..54dd287e 100644
--- a/test/suites/inode_cache.bash
+++ b/test/suites/inode_cache.bash
@@ -4,10 +4,8 @@ SUITE_inode_cache_PROBE() {
return
fi
- temp_dir=$(dirname $($CCACHE -k temporary_dir))
- fs=$(stat -fLc %T $temp_dir)
- if [ "$fs" = "nfs" ]; then
- echo "ccache temporary directory is on NFS"
+ if [ "$(stat -fLc %T "${CCACHE_DIR}")" = "nfs" ]; then
+ echo "ccache directory is on NFS"
fi
}
@@ -15,6 +13,7 @@ SUITE_inode_cache_SETUP() {
export CCACHE_INODECACHE=1
export CCACHE_DEBUG=1
unset CCACHE_NODIRECT
+ export CCACHE_TEMPDIR="${CCACHE_DIR}/tmp" # isolate inode cache file
}
SUITE_inode_cache() {