summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2021-04-09 02:46:05 (GMT)
committerDaniel Moody <daniel.moody@mongodb.com>2021-04-09 02:46:05 (GMT)
commitd4b4b00e81d3de107c451dd38c14aa72360a3c72 (patch)
treea00112e50cd0ccae92ef8a990cc37a6597140c34
parent78ef8f33f83bcaa963a54f9ba53c84b6d9554a0c (diff)
downloadSCons-d4b4b00e81d3de107c451dd38c14aa72360a3c72.zip
SCons-d4b4b00e81d3de107c451dd38c14aa72360a3c72.tar.gz
SCons-d4b4b00e81d3de107c451dd38c14aa72360a3c72.tar.bz2
Extra comments for the DoubleCachedirClass test.
-rw-r--r--test/CacheDir/DoubleCachedirClass.py19
-rw-r--r--test/CacheDir/double_cachedir_fixture/SConstruct4
2 files changed, 22 insertions, 1 deletions
diff --git a/test/CacheDir/DoubleCachedirClass.py b/test/CacheDir/DoubleCachedirClass.py
index af97ec2..976793b 100644
--- a/test/CacheDir/DoubleCachedirClass.py
+++ b/test/CacheDir/DoubleCachedirClass.py
@@ -25,7 +25,24 @@
#
"""
-Test that a custom cache dir is not incorrectly duplicated.
+Test that cache dir is reinitialized correctly when two cachedirs are in use
+and also that the cachedirs are isolated to their own environments.
+
+The core of the test is:
+-----------------------------------------
+env = Environment(tools=[])
+env.CacheDir('cache1', CustomCacheDir1)
+env.CacheDir('cache2', CustomCacheDir2)
+
+cloned = env.Clone()
+cloned.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE'))
+
+env.CacheDir('cache1', CustomCacheDir1)
+-----------------------------------------
+
+Where each cachedir is printing its own name in an overridden copy_to_cache function, so
+since the only command putting something to cache is in the cloned environment, we should
+see only cachedir2 print since that was initialized for that env when the clone happened.
"""
import TestSCons
diff --git a/test/CacheDir/double_cachedir_fixture/SConstruct b/test/CacheDir/double_cachedir_fixture/SConstruct
index bcb39c5..322e286 100644
--- a/test/CacheDir/double_cachedir_fixture/SConstruct
+++ b/test/CacheDir/double_cachedir_fixture/SConstruct
@@ -25,6 +25,10 @@ env = Environment(tools=[])
env.CacheDir('cache1', CustomCacheDir1)
env.CacheDir('cache2', CustomCacheDir2)
+# two cachedirs were initialized, but the second one was the most recent
+# and should remain in the cloned environment, even when we switch the
+# original environment back. The cachedir2 should be the only copy_to_cache
+# function we call.
cloned = env.Clone()
cloned.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE'))