]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Isolate inode cache file in tests
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 1 May 2022 11:15:37 +0000 (13:15 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 1 May 2022 11:29:41 +0000 (13:29 +0200)
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.

test/suites/inode_cache.bash

index e328ac662fca204bf5a6513756853970482d8b9a..54dd287e835ffc6e204fd851fe2838c4e9278857 100644 (file)
@@ -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() {