diff options
author | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-10-28 21:35:59 (GMT) |
---|---|---|
committer | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-10-28 21:35:59 (GMT) |
commit | 8e627eb7aec9e58d7128a571aa201830da140825 (patch) | |
tree | a08a2a013a20ce69c57779403426675bd31f4bff /test | |
parent | 55849419b8a1365d5918386c085be55bc9cddd3a (diff) | |
parent | de084c80eb08f44ff55ea15eba275fda7d1382c7 (diff) | |
download | SCons-8e627eb7aec9e58d7128a571aa201830da140825.zip SCons-8e627eb7aec9e58d7128a571aa201830da140825.tar.gz SCons-8e627eb7aec9e58d7128a571aa201830da140825.tar.bz2 |
Merge branch 'master' into jbrill-msvs-tests
Manually resolve conflicts in CHANGES.txt.
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 | ||||
-rw-r--r-- | test/Install/Install.py | 23 | ||||
-rw-r--r-- | test/VariantDir/errors.py | 13 |
19 files changed, 49 insertions, 43 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='.') diff --git a/test/Install/Install.py b/test/Install/Install.py index 2857c72..802b10d 100644 --- a/test/Install/Install.py +++ b/test/Install/Install.py @@ -31,6 +31,7 @@ import os.path import time import TestSCons +from TestCmd import IS_ROOT test = TestSCons.TestSCons() @@ -131,17 +132,17 @@ test.must_match(['work', 'f2.out'], "f2.in\n", mode='r') # if a target can not be unlinked before building it: test.write(['work', 'f1.in'], "f1.in again again\n") -os.chmod(test.workpath('work', 'export'), 0o555) -with open(f1_out, 'rb'): - expect = [ - "Permission denied", - "The process cannot access the file because it is being used by another process", - "Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird", - ] - - test.run(chdir='work', arguments=f1_out, stderr=None, status=2) - - test.must_contain_any_line(test.stderr(), expect) +# This test is not designed to work if running as root +if not IS_ROOT: + os.chmod(test.workpath('work', 'export'), 0o555) + with open(f1_out, 'rb'): + expect = [ + "Permission denied", + "The process cannot access the file because it is being used by another process", + "Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird", + ] + test.run(chdir='work', arguments=f1_out, stderr=None, status=2) + test.must_contain_any_line(test.stderr(), expect) test.pass_test() diff --git a/test/VariantDir/errors.py b/test/VariantDir/errors.py index 26ef4a2..1ff3be3 100644 --- a/test/VariantDir/errors.py +++ b/test/VariantDir/errors.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -# __COPYRIGHT__ +# MIT License +# +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +22,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Validate successful handling of errors when duplicating things in @@ -34,9 +33,13 @@ import os import stat import sys import TestSCons +from TestCmd import IS_ROOT test = TestSCons.TestSCons() +if IS_ROOT: + test.skip_test('SConscript permissions meaningless when running as root; skipping test.\n') + for dir in ['normal', 'ro-dir', 'ro-SConscript', 'ro-src']: test.subdir(dir, [dir, 'src']) @@ -44,7 +47,7 @@ for dir in ['normal', 'ro-dir', 'ro-SConscript', 'ro-src']: import os.path VariantDir('build', 'src') SConscript(os.path.join('build', 'SConscript')) -""") +""") test.write([dir, 'src', 'SConscript'], """\ def fake_scan(node, env, target): |