diff options
author | Mats Wichmann <mats@linux.com> | 2024-09-25 14:21:49 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2024-10-28 11:40:39 (GMT) |
commit | 8a3c2a38280633191817a6ac8db11cd293973c11 (patch) | |
tree | 7c0104490eeaee75bf9ffb6820dced1d1364676a /test | |
parent | 4d5ecf6ac6c717a3be32c2d14d397600481dc39f (diff) | |
download | SCons-8a3c2a38280633191817a6ac8db11cd293973c11.zip SCons-8a3c2a38280633191817a6ac8db11cd293973c11.tar.gz SCons-8a3c2a38280633191817a6ac8db11cd293973c11.tar.bz2 |
Add a tag to the cachedir
Since there are now two files to make when a cachedir is created,
use the temporary-dir -> rename technique.
CacheDir tests no longer pre-create the cache directory, they should
be verifying it's created properly upon request (one unit test still
makes sure passing an existing empty directory works, too).
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/CacheDir/CacheDir.py | 10 | ||||
-rw-r--r-- | test/CacheDir/CacheDir_TryCompile.py | 2 | ||||
-rw-r--r-- | test/CacheDir/NoCache.py | 2 | ||||
-rw-r--r-- | test/CacheDir/SideEffect.py | 2 | ||||
-rw-r--r-- | test/CacheDir/VariantDir.py | 2 | ||||
-rw-r--r-- | test/CacheDir/debug.py | 2 | ||||
-rw-r--r-- | test/CacheDir/environment.py | 9 | ||||
-rw-r--r-- | test/CacheDir/multi-targets.py | 2 | ||||
-rw-r--r-- | test/CacheDir/multiple-targets.py | 2 | ||||
-rw-r--r-- | test/CacheDir/option--cd.py | 2 | ||||
-rw-r--r-- | test/CacheDir/option--cf.py | 4 | ||||
-rw-r--r-- | test/CacheDir/option--cr.py | 2 | ||||
-rw-r--r-- | test/CacheDir/option--cs.py | 4 | ||||
-rw-r--r-- | test/CacheDir/scanner-target.py | 2 | ||||
-rw-r--r-- | test/CacheDir/source-scanner.py | 2 | ||||
-rw-r--r-- | test/CacheDir/up-to-date-q.py | 6 | ||||
-rw-r--r-- | test/CacheDir/value_dependencies.py | 1 |
17 files changed, 29 insertions, 27 deletions
diff --git a/test/CacheDir/CacheDir.py b/test/CacheDir/CacheDir.py index bd8d674..05134e6 100644 --- a/test/CacheDir/CacheDir.py +++ b/test/CacheDir/CacheDir.py @@ -41,7 +41,7 @@ src_ccc_out = test.workpath('src', 'ccc.out') src_cat_out = test.workpath('src', 'cat.out') src_all = test.workpath('src', 'all') -test.subdir('cache', 'src') +test.subdir('src') test.write(['src', 'SConstruct'], """\ DefaultEnvironment(tools=[]) @@ -84,8 +84,12 @@ test.must_not_exist(src_bbb_out) test.must_not_exist(src_ccc_out) test.must_not_exist(src_all) # Even if you do -n, the cache will be configured. -test.fail_test(os.listdir(cache) != ['config']) - +expect = ['CACHEDIR.TAG', 'config'] +found = sorted(os.listdir(cache)) +test.fail_test( + expect != found, + message=f"expected cachedir contents {expect}, found {found}", +) # Verify that a normal build works correctly, and clean up. # This should populate the cache with our derived files. test.run(chdir = 'src', arguments = '.') diff --git a/test/CacheDir/CacheDir_TryCompile.py b/test/CacheDir/CacheDir_TryCompile.py index b00c5d4..c9ab126 100644 --- a/test/CacheDir/CacheDir_TryCompile.py +++ b/test/CacheDir/CacheDir_TryCompile.py @@ -38,7 +38,7 @@ test = TestSCons.TestSCons() cache = test.workpath('cache') -test.subdir('cache', 'src') +test.subdir('src') test.write(['src', 'SConstruct'], """\ DefaultEnvironment(tools=[]) diff --git a/test/CacheDir/NoCache.py b/test/CacheDir/NoCache.py index e1cecee..611b555 100644 --- a/test/CacheDir/NoCache.py +++ b/test/CacheDir/NoCache.py @@ -31,7 +31,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'alpha', 'beta') +test.subdir('alpha', 'beta') sconstruct = """ DefaultEnvironment(tools=[]) diff --git a/test/CacheDir/SideEffect.py b/test/CacheDir/SideEffect.py index 61c9bbc..ee808d6 100644 --- a/test/CacheDir/SideEffect.py +++ b/test/CacheDir/SideEffect.py @@ -31,7 +31,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'work') +test.subdir('work') cache = test.workpath('cache') diff --git a/test/CacheDir/VariantDir.py b/test/CacheDir/VariantDir.py index 9fc82c9..8c44917 100644 --- a/test/CacheDir/VariantDir.py +++ b/test/CacheDir/VariantDir.py @@ -33,7 +33,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'src') +test.subdir('src') cache = test.workpath('cache') cat_out = test.workpath('cat.out') diff --git a/test/CacheDir/debug.py b/test/CacheDir/debug.py index 0ba6bbb..a8c4e83 100644 --- a/test/CacheDir/debug.py +++ b/test/CacheDir/debug.py @@ -36,7 +36,7 @@ import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re) -test.subdir('cache', 'src') +test.subdir('src') cache = test.workpath('cache') debug_out = test.workpath('cache-debug.out') diff --git a/test/CacheDir/environment.py b/test/CacheDir/environment.py index 17a4f26..23e3508 100644 --- a/test/CacheDir/environment.py +++ b/test/CacheDir/environment.py @@ -42,7 +42,7 @@ src_ccc_out = test.workpath('src', 'ccc.out') src_cat_out = test.workpath('src', 'cat.out') src_all = test.workpath('src', 'all') -test.subdir('cache', 'src') +test.subdir('src') test.write(['src', 'SConstruct'], """\ DefaultEnvironment(tools=[]) @@ -87,7 +87,12 @@ test.must_not_exist(src_bbb_out) test.must_not_exist(src_ccc_out) test.must_not_exist(src_all) # Even if you do -n, the cache will be configured. -test.fail_test(os.listdir(cache) != ['config']) +expect = ['CACHEDIR.TAG', 'config'] +found = sorted(os.listdir(cache)) +test.fail_test( + expect != found, + message=f"expected cachedir contents {expect}, found {found}", +) # Verify that a normal build works correctly, and clean up. # This should populate the cache with our derived files. diff --git a/test/CacheDir/multi-targets.py b/test/CacheDir/multi-targets.py index 72c7e66..7c606af 100644 --- a/test/CacheDir/multi-targets.py +++ b/test/CacheDir/multi-targets.py @@ -31,7 +31,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'multiple') +test.subdir('multiple') cache = test.workpath('cache') diff --git a/test/CacheDir/multiple-targets.py b/test/CacheDir/multiple-targets.py index 1218e9b..dfde453 100644 --- a/test/CacheDir/multiple-targets.py +++ b/test/CacheDir/multiple-targets.py @@ -32,8 +32,6 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache') - test.write('SConstruct', """\ DefaultEnvironment(tools=[]) def touch(env, source, target): diff --git a/test/CacheDir/option--cd.py b/test/CacheDir/option--cd.py index 692207d..df9ab47 100644 --- a/test/CacheDir/option--cd.py +++ b/test/CacheDir/option--cd.py @@ -33,7 +33,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'src') +test.subdir('src') test.write(['src', 'SConstruct'], """ DefaultEnvironment(tools=[]) diff --git a/test/CacheDir/option--cf.py b/test/CacheDir/option--cf.py index 4750b40..b34d706 100644 --- a/test/CacheDir/option--cf.py +++ b/test/CacheDir/option--cf.py @@ -34,7 +34,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'src') +test.subdir('src') test.write(['src', 'SConstruct'], """ DefaultEnvironment(tools=[]) @@ -88,7 +88,6 @@ test.up_to_date(chdir = 'src', arguments = '.') # Blow away and recreate the CacheDir, then verify that --cache-force # repopulates the cache with the local built targets. DO NOT CLEAN UP. shutil.rmtree(test.workpath('cache')) -test.subdir('cache') test.run(chdir = 'src', arguments = '--cache-force .') @@ -106,7 +105,6 @@ test.fail_test(os.path.exists(test.workpath('src', 'cat.out'))) # Blow away and recreate the CacheDir, then verify that --cache-populate # repopulates the cache with the local built targets. DO NOT CLEAN UP. shutil.rmtree(test.workpath('cache')) -test.subdir('cache') test.run(chdir = 'src', arguments = '--cache-populate .') diff --git a/test/CacheDir/option--cr.py b/test/CacheDir/option--cr.py index 6ff6974..4c423cf 100644 --- a/test/CacheDir/option--cr.py +++ b/test/CacheDir/option--cr.py @@ -33,7 +33,7 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'src') +test.subdir('src') test.write(['src', 'SConstruct'], """ DefaultEnvironment(tools=[]) diff --git a/test/CacheDir/option--cs.py b/test/CacheDir/option--cs.py index ce48ac0..62c0026 100644 --- a/test/CacheDir/option--cs.py +++ b/test/CacheDir/option--cs.py @@ -38,7 +38,7 @@ _obj = TestSCons._obj test = TestSCons.TestSCons() -test.subdir('cache', 'src1', 'src2') +test.subdir('src1', 'src2') test.write(['src1', 'build.py'], r""" import sys @@ -63,7 +63,7 @@ def cat(env, source, target): f.write(f2.read()) DefaultEnvironment(tools=[]) # test speedup -env = Environment(tools=[], +env = Environment(tools=[], BUILDERS={'Internal':Builder(action=cat), 'External':Builder(action=r'%(_python_)s build.py $TARGET $SOURCES')}) env.External('aaa.out', 'aaa.in') diff --git a/test/CacheDir/scanner-target.py b/test/CacheDir/scanner-target.py index dd8791d..4aa3692 100644 --- a/test/CacheDir/scanner-target.py +++ b/test/CacheDir/scanner-target.py @@ -35,8 +35,6 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('cache') - test.write('SConstruct', """\ DefaultEnvironment(tools=[]) import SCons diff --git a/test/CacheDir/source-scanner.py b/test/CacheDir/source-scanner.py index 0dda4f4..2ff19ce 100644 --- a/test/CacheDir/source-scanner.py +++ b/test/CacheDir/source-scanner.py @@ -39,7 +39,7 @@ test = TestSCons.TestSCons() cache = test.workpath('cache') -test.subdir('cache', 'subdir') +test.subdir('subdir') test.write(['subdir', 'SConstruct'], """\ DefaultEnvironment(tools=[]) diff --git a/test/CacheDir/up-to-date-q.py b/test/CacheDir/up-to-date-q.py index c8fa1e3..5c71ab9 100644 --- a/test/CacheDir/up-to-date-q.py +++ b/test/CacheDir/up-to-date-q.py @@ -39,19 +39,19 @@ Thanks to dvitek for the test case. # 1. Set up two identical C project directories called 'alpha' and # 'beta', which use the same cache # 2. Invoke scons on 'alpha' -# 3. Invoke scons on 'beta', which successfully draws output +# 3. Invoke scons on 'beta', which successfully draws output # files from the cache # 4. Invoke scons again, asserting (with -q) that 'beta' is up to date # # Step 4 failed in 0.96.93. In practice, this problem would lead to -# lots of unecessary fetches from the cache during incremental +# lots of unecessary fetches from the cache during incremental # builds (because they behaved like non-incremental builds). import TestSCons test = TestSCons.TestSCons() -test.subdir('cache', 'alpha', 'beta') +test.subdir('alpha', 'beta') foo_c = """ int main(void){ return 0; } diff --git a/test/CacheDir/value_dependencies.py b/test/CacheDir/value_dependencies.py index b34401d..37c6153 100644 --- a/test/CacheDir/value_dependencies.py +++ b/test/CacheDir/value_dependencies.py @@ -37,7 +37,6 @@ import TestSCons test = TestSCons.TestSCons() test.dir_fixture('value_dependencies') -test.subdir('cache') # First build, populates the cache test.run(arguments='.') |