diff options
Diffstat (limited to 'test')
125 files changed, 1791 insertions, 573 deletions
diff --git a/test/Alias/Alias.py b/test/Alias/Alias.py index b53b8ce..0af4dc2 100644 --- a/test/Alias/Alias.py +++ b/test/Alias/Alias.py @@ -133,7 +133,7 @@ test.run(arguments = 'f1.out', test.up_to_date(arguments = 'f1.out') test.write('SConstruct', """ -TargetSignatures('content') +Decider('content') B = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES') env = Environment() env['BUILDERS']['B'] = B diff --git a/test/Alias/errors.py b/test/Alias/errors.py index f2ca950..1205b29 100644 --- a/test/Alias/errors.py +++ b/test/Alias/errors.py @@ -33,7 +33,7 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ env=Environment() -TargetSignatures('content') +Decider('content') env.Alias('C', 'D') env.Alias('B', 'C') env.Alias('A', 'B') diff --git a/test/Alias/srcdir.py b/test/Alias/srcdir.py index 2251165..2d7a154 100644 --- a/test/Alias/srcdir.py +++ b/test/Alias/srcdir.py @@ -25,13 +25,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that an Alias for a BuildDir()'s source directory works as +Verify that an Alias for a VariantDir()'s source directory works as expected. This tests for a 0.96.93 bug uncovered by the LilyPond project's build. The specific problem is that, in 0.96.93, the simple act of trying to -disambiguate a target file in the BuildDir() would call srcnode(), which +disambiguate a target file in the VariantDir() would call srcnode(), which would create a "phantom" Node for the target in the *source* directory: +-minimal @@ -81,7 +81,7 @@ Export ('env') b = 'python/out-scons' -env.BuildDir(b, 'python', duplicate=0) +env.VariantDir(b, 'python', duplicate=0) SConscript(b + '/SConscript') """) diff --git a/test/CPPPATH/CPPPATH.py b/test/CPPPATH/CPPPATH.py index 80b4aa7..1146ee0 100644 --- a/test/CPPPATH/CPPPATH.py +++ b/test/CPPPATH/CPPPATH.py @@ -51,7 +51,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.c') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(CPPPATH=[include, '#foobar', '#subdir']) SConscript('variant/SConscript', "env") @@ -251,7 +251,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.c') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(CPPPATH=['inc2', include, '#foobar', '#subdir']) SConscript('variant/SConscript', "env") diff --git a/test/CPPPATH/match-dir.py b/test/CPPPATH/match-dir.py index f8501c6..6305d0c 100644 --- a/test/CPPPATH/match-dir.py +++ b/test/CPPPATH/match-dir.py @@ -38,7 +38,7 @@ test.subdir(['src'], ['src', 'inc', 'inc2']) test.write('SConstruct', """\ -SConscript('src/SConscript', build_dir = 'build', duplicate = 0) +SConscript('src/SConscript', variant_dir = 'build', duplicate = 0) """) test.write(['src', 'SConscript'], """\ diff --git a/test/CacheDir/BuildDir.py b/test/CacheDir/VariantDir.py index a41d397..b5650c1 100644 --- a/test/CacheDir/BuildDir.py +++ b/test/CacheDir/VariantDir.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test retrieving derived files from a CacheDir when a BuildDir is used. +Test retrieving derived files from a CacheDir when a VariantDir is used. """ import os.path @@ -68,7 +68,7 @@ test.write(['src', 'ccc.in'], "ccc.in\n") test.write('SConstruct', """\ env = Environment(TWO = '2') CacheDir(r'%s') -BuildDir('build', 'src', duplicate=0) +VariantDir('build', 'src', duplicate=0) SConscript('build/SConscript') """ % test.workpath('cache${TWO}')) diff --git a/test/Chmod.py b/test/Chmod.py index 92fa639..61d21eb 100644 --- a/test/Chmod.py +++ b/test/Chmod.py @@ -61,6 +61,11 @@ env.Command('f6.out', 'f6.in', [Chmod('$FILE', 0666), Cat]) env.Command('f7.out', 'f7.in', [Cat, Chmod('Chmod-$SOURCE', 0666), Chmod('${TARGET}-Chmod', 0666)]) + +# Make sure Chmod works with a list of arguments +env = Environment(FILE = 'f9') +env.Command('f8.out', 'f8.in', [Chmod(['$FILE', File('f10')], 0666), Cat]) +Execute(Chmod(['d11', Dir('d12')], 0777)) """) test.write('f1', "f1\n") @@ -78,6 +83,11 @@ test.write('f6.in', "f6.in\n") test.write('f7.in', "f7.in\n") test.write('Chmod-f7.in', "Chmod-f7.in\n") test.write('f7.out-Chmod', "f7.out-Chmod\n") +test.write('f8.in', "f8.in\n") +test.write('f9', "f9\n") +test.write('f10', "f10\n") +test.subdir('d11') +test.subdir('d12') os.chmod(test.workpath('f1'), 0444) os.chmod(test.workpath('f1-File'), 0444) @@ -88,12 +98,17 @@ os.chmod(test.workpath('d4'), 0555) os.chmod(test.workpath('f5'), 0444) os.chmod(test.workpath('Chmod-f7.in'), 0444) os.chmod(test.workpath('f7.out-Chmod'), 0444) +os.chmod(test.workpath('f9'), 0444) +os.chmod(test.workpath('f10'), 0444) +os.chmod(test.workpath('d11'), 0555) +os.chmod(test.workpath('d12'), 0555) expect = test.wrap_stdout(read_str = """\ Chmod("f1", 0666) Chmod("f1-File", 0666) Chmod("d2", 0777) Chmod("d2-Dir", 0777) +Chmod(["d11", "d12"], 0777) """, build_str = """\ cat(["bar.out"], ["bar.in"]) @@ -104,6 +119,8 @@ cat(["f6.out"], ["f6.in"]) cat(["f7.out"], ["f7.in"]) Chmod("Chmod-f7.in", 0666) Chmod("f7.out-Chmod", 0666) +Chmod(["f9", "f10"], 0666) +cat(["f8.out"], ["f8.in"]) """) test.run(options = '-n', arguments = '.', stdout = expect) @@ -128,6 +145,15 @@ s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in'))[stat.ST_MODE]) test.fail_test(s != 0444) s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE]) test.fail_test(s != 0444) +test.must_not_exist('f8.out') +s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE]) +test.fail_test(s != 0444) +s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE]) +test.fail_test(s != 0444) +s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE]) +test.fail_test(s != 0555) +s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE]) +test.fail_test(s != 0555) test.run() @@ -152,5 +178,14 @@ s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in'))[stat.ST_MODE]) test.fail_test(s != 0666) s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE]) test.fail_test(s != 0666) +test.must_match('f8.out', "f8.in\n") +s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE]) +test.fail_test(s != 0666) +s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE]) +test.fail_test(s != 0666) +s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE]) +test.fail_test(s != 0777) +s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE]) +test.fail_test(s != 0777) test.pass_test() diff --git a/test/Configure/BuildDir-SConscript.py b/test/Configure/VariantDir-SConscript.py index 47b7d82..a9371f9 100644 --- a/test/Configure/BuildDir-SConscript.py +++ b/test/Configure/VariantDir-SConscript.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that Configure calls in SConscript files work when used -with BuildDir. +with VariantDir. """ import os.path @@ -52,7 +52,7 @@ if env['chdir'] == 'yes': SConscriptChdir(1) else: SConscriptChdir(0) -BuildDir( 'build', '.' ) +VariantDir( 'build', '.' ) SConscript( 'build/SConscript' ) """) diff --git a/test/Configure/BuildDir.py b/test/Configure/VariantDir.py index ca3c147..63fcb93 100644 --- a/test/Configure/BuildDir.py +++ b/test/Configure/VariantDir.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that Configure contexts work with basic use of BuildDir. +Verify that Configure contexts work with basic use of VariantDir. """ import os.path @@ -45,7 +45,7 @@ test.write('SConstruct', """\ env = Environment(LOGFILE='build/config.log') import os env.AppendENVPath('PATH', os.environ['PATH']) -BuildDir( 'build', '.' ) +VariantDir( 'build', '.' ) conf = env.Configure(conf_dir='build/config.tests', log_file='$LOGFILE') r1 = conf.CheckCHeader( 'math.h' ) r2 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error diff --git a/test/Configure/cache-not-ok.py b/test/Configure/cache-not-ok.py index 82e32f6..339c464 100644 --- a/test/Configure/cache-not-ok.py +++ b/test/Configure/cache-not-ok.py @@ -45,8 +45,8 @@ NCF = test.NCF # non-cached build failure CF = test.CF # cached build failure test.write('SConstruct', """\ -if int(ARGUMENTS.get('target_signatures_content', 0)): - TargetSignatures('content') +if not int(ARGUMENTS.get('target_signatures_content', 0)): + Decider('timestamp-newer') env = Environment() import os env.AppendENVPath('PATH', os.environ['PATH']) @@ -59,6 +59,8 @@ if not (not r1 and not r2): Exit(1) """) +# Verify correct behavior when we call Decider('timestamp-newer'). + test.run() test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", "Checking for C library no_c_library_SAFFDG... "], @@ -71,11 +73,11 @@ test.run() test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", "Checking for C library no_c_library_SAFFDG... "], ["no"]*2, - [[((".c", CR), (_obj, CF))], - [((".c", CR), (_obj, CR), (_exe, CF))]], + [[((".c", CR), (_obj, NCF))], + [((".c", CR), (_obj, CR), (_exe, NCF))]], "config.log", ".sconf_temp", "SConstruct") -# same should be true for TargetSignatures('content') +# Same should be true for the default behavior of Decider('content'). test.run(arguments='--config=force target_signatures_content=1') test.checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", diff --git a/test/Configure/cache-ok.py b/test/Configure/cache-ok.py index d8eac77..7c98d0c 100644 --- a/test/Configure/cache-ok.py +++ b/test/Configure/cache-ok.py @@ -43,8 +43,8 @@ NCF = test.NCF # non-cached build failure CF = test.CF # cached build failure test.write('SConstruct', """\ -if int(ARGUMENTS.get('target_signatures_content', 0)): - TargetSignatures('content') +if not int(ARGUMENTS.get('target_signatures_content', 0)): + Decider('timestamp-newer') env = Environment() import os env.AppendENVPath('PATH', os.environ['PATH']) @@ -60,6 +60,8 @@ if not (r1 and r2 and r3 and r4 and r5 and r6): Exit(1) """ % locals()) +# Verify correct behavior when we call Decider('timestamp-newer') + test.run() test.checkLogAndStdout(["Checking for C library %s... " % lib, "Checking for C library None... ", @@ -87,7 +89,7 @@ test.checkLogAndStdout(["Checking for C library %s... " % lib, [[((".cpp", CR), (_obj, CR))]], "config.log", ".sconf_temp", "SConstruct") -# same should be true for TargetSignatures('content') +# same should be true for the default behavior of Decider('content') test.run(arguments='target_signatures_content=1 --config=force') test.checkLogAndStdout(["Checking for C library %s... " % lib, diff --git a/test/Configure/config-h.py b/test/Configure/config-h.py index 7bc8645..95121a9 100644 --- a/test/Configure/config-h.py +++ b/test/Configure/config-h.py @@ -89,18 +89,44 @@ expected_config_h = string.replace("""\ #ifndef CONFIG_H_SEEN #define CONFIG_H_SEEN + +/* Define to 1 if the system has the function `printf'. */ #define HAVE_PRINTF 1 + +/* Define to 1 if the system has the function `noFunctionCall'. */ /* #undef HAVE_NOFUNCTIONCALL */ + +/* Define to 1 if the system has the type `int'. */ #define HAVE_INT 1 + +/* Define to 1 if the system has the type `noType'. */ /* #undef HAVE_NOTYPE */ + +/* Define to 1 if you have the <stdio.h> header file. */ #define HAVE_STDIO_H 1 + +/* Define to 1 if you have the <hopefullynoc-header.h> header file. */ /* #undef HAVE_HOPEFULLYNOC_HEADER_H */ + +/* Define to 1 if you have the <vector> header file. */ #define HAVE_VECTOR 1 + +/* Define to 1 if you have the <hopefullynocxx-header.h> header file. */ /* #undef HAVE_HOPEFULLYNOCXX_HEADER_H */ + +/* Define to 1 if you have the `%(lib)s' library. */ #define HAVE_%(LIB)s 1 + +/* Define to 1 if you have the `hopefullynolib' library. */ /* #undef HAVE_LIBHOPEFULLYNOLIB */ + +/* Define to 1 if you have the `%(lib)s' library. */ #define HAVE_%(LIB)s 1 + +/* Define to 1 if you have the `%(lib)s' library. */ /* #undef HAVE_%(LIB)s */ + +/* Define to 1 if you have the `hopefullynolib2' library. */ /* #undef HAVE_LIBHOPEFULLYNOLIB2 */ #endif /* CONFIG_H_SEEN */ diff --git a/test/Copy.py b/test/Copy-Action.py index 827b912..768d102 100644 --- a/test/Copy.py +++ b/test/Copy-Action.py @@ -25,10 +25,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that the Delete() Action works. +Verify that the Copy() Action works, and preserves file modification +times and modes. """ +import os import os.path +import sys +import stat import TestSCons @@ -58,6 +62,8 @@ env.Command('f9.out', 'f9.in', [Cat, Copy('${TARGET}-Copy', '$SOURCE')]) env.CopyTo( 'd4', 'f10.in' ) env.CopyAs( 'd4/f11.out', 'f11.in') env.CopyAs( 'd4/f12.out', 'd5/f12.in') + +env.Command('f 13.out', 'f 13.in', Copy('$TARGET', '$SOURCE')) """) test.write('f1.in', "f1.in\n") @@ -78,6 +84,12 @@ test.write('f10.in', "f10.in\n") test.write('f11.in', "f11.in\n") test.subdir('d5') test.write(['d5', 'f12.in'], "f12.in\n") +test.write('f 13.in', "f 13.in\n") + +os.chmod('f1.in', 0646) +os.chmod('f4.in', 0644) + +test.sleep() d4_f10_in = os.path.join('d4', 'f10.in') d4_f11_out = os.path.join('d4', 'f11.out') @@ -97,11 +109,13 @@ Copy("d6.out", "f6.in") Copy file(s): "f10.in" to "%(d4_f10_in)s" Copy file(s): "f11.in" to "%(d4_f11_out)s" Copy file(s): "%(d5_f12_in)s" to "%(d4_f12_out)s" +Copy("f 13.out", "f 13.in") Copy("f7.out", "f7.in") cat(["f8.out"], ["f8.in"]) cat(["f9.out"], ["f9.in"]) Copy("f9.out-Copy", "f9.in") """ % locals()) + test.run(options = '-n', arguments = '.', stdout = expect) test.must_not_exist('f1.out') @@ -117,6 +131,8 @@ test.must_not_exist('f9.out-Copy') test.must_not_exist('d4/f10.in') test.must_not_exist('d4/f11.out') test.must_not_exist('d4/f12.out') +test.must_not_exist('f 13.out') +test.must_not_exist('f 13.out') test.run() @@ -133,5 +149,40 @@ test.must_match('f9.out-Copy', "f9.in\n") test.must_match('d4/f10.in', 'f10.in\n') test.must_match('d4/f11.out', 'f11.in\n') test.must_match('d4/f12.out', 'f12.in\n') +test.must_match('f 13.out', 'f 13.in\n') + +errors = 0 + +def must_be_same(f1, f2): + global errors + if type(f1) is type([]): + f1 = apply(os.path.join, f1) + if type(f2) is type([]): + f2 = apply(os.path.join, f2) + s1 = os.stat(f1) + s2 = os.stat(f2) + for value in ['ST_MODE', 'ST_MTIME']: + v = getattr(stat, value) + if s1[v] != s2[v]: + msg = '%s[%s] %s != %s[%s] %s\n' % \ + (repr(f1), value, s1[v], + repr(f2), value, s2[v],) + sys.stderr.write(msg) + errors = errors + 1 + +must_be_same('f1.out', 'f1.in') +must_be_same(['d2.out', 'file'], ['d2.in', 'file']) +must_be_same(['d3.out', 'f3.in'], 'f3.in') +must_be_same('f4.out', 'f4.in') +must_be_same(['d5.out', 'file'], ['d5.in', 'file']) +must_be_same(['d6.out', 'f6.in'], 'f6.in') +must_be_same('f7.out', 'f7.in') +must_be_same(['d4', 'f10.in'], 'f10.in') +must_be_same(['d4', 'f11.out'], 'f11.in') +must_be_same(['d4', 'f12.out'], ['d5', 'f12.in']) +must_be_same('f 13.out', 'f 13.in') + +if errors: + test.fail_test() test.pass_test() diff --git a/test/Delete.py b/test/Delete.py index 31febbe..63e4ab6 100644 --- a/test/Delete.py +++ b/test/Delete.py @@ -65,6 +65,10 @@ env.Command('f12-nonexistent.out', 'f12.in', env.Command(Dir('d13-nonexistent.out'), 'd13.in', [Delete("$TARGET", must_exist=0), Mkdir("$TARGET")]) + +# Make sure Delete works with a list of arguments +env = Environment(FILE='f14', DIR='d15') +env.Command('f16.out', 'f16.in', [Delete(["$FILE", "$DIR"]), Cat]) """) test.write('f1', "f1\n") @@ -85,6 +89,9 @@ test.write('f10.in', "f10.in\n") test.subdir('d11.in') test.write('f12.in', "f12.in\n") test.subdir('d13.in') +test.write('f14', "f14\n") +test.subdir('d15') +test.write('f16.in', "f16.in\n") expect = test.wrap_stdout(read_str = """\ Delete("f1") @@ -99,6 +106,8 @@ Delete("f10-nonexistent.out") cat(["f10-nonexistent.out"], ["f10.in"]) Delete("f12-nonexistent.out") cat(["f12-nonexistent.out"], ["f12.in"]) +Delete(["f14", "d15"]) +cat(["f16.out"], ["f16.in"]) cat(["f3.out"], ["f3.in"]) Delete("f4") Delete("d5") @@ -125,6 +134,9 @@ test.must_not_exist('f8.out') test.must_not_exist('f9.out') test.must_exist('Delete-f9.in') test.must_exist('f9.out-Delete') +test.must_exist('f14') +test.must_exist('d15') +test.must_not_exist('f16.out') test.run() @@ -146,6 +158,9 @@ test.must_exist('f10-nonexistent.out') test.must_exist('d11-nonexistent.out') test.must_exist('f12-nonexistent.out') test.must_exist('d13-nonexistent.out') +test.must_not_exist('f14') +test.must_not_exist('d15') +test.must_match('f16.out', "f16.in\n") test.write("SConstruct", """\ def cat(env, source, target): diff --git a/test/Deprecated/BuildDir.py b/test/Deprecated/BuildDir.py new file mode 100644 index 0000000..709ea8b --- /dev/null +++ b/test/Deprecated/BuildDir.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify that the deprecated BuildDir() function and method still +work to create a variant directory tree (by calling VariantDir() +under the covers). + +Note that using BuildDir() does not yet print a deprecation warning. +""" + +import os.path +import string +import sys +import time +import TestSCons + +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + +foo11 = test.workpath('work1', 'build', 'var1', 'foo1' + _exe) +foo12 = test.workpath('work1', 'build', 'var1', 'foo2' + _exe) +foo21 = test.workpath('work1', 'build', 'var2', 'foo1' + _exe) +foo22 = test.workpath('work1', 'build', 'var2', 'foo2' + _exe) +foo31 = test.workpath('work1', 'build', 'var3', 'foo1' + _exe) +foo32 = test.workpath('work1', 'build', 'var3', 'foo2' + _exe) +foo41 = test.workpath('work1', 'build', 'var4', 'foo1' + _exe) +foo42 = test.workpath('work1', 'build', 'var4', 'foo2' + _exe) +foo51 = test.workpath('build', 'var5', 'foo1' + _exe) +foo52 = test.workpath('build', 'var5', 'foo2' + _exe) + +test.subdir('work1') + +test.write(['work1', 'SConstruct'], """ +src = Dir('src') +var2 = Dir('build/var2') +var3 = Dir('build/var3') +var4 = Dir('build/var4') +var5 = Dir('../build/var5') +var6 = Dir('../build/var6') + +env = Environment(BUILD = 'build', SRC = 'src') + +VariantDir('build/var1', src) +VariantDir(var2, src) +VariantDir(var3, src, duplicate=0) +env.VariantDir("$BUILD/var4", "$SRC", duplicate=0) +VariantDir(var5, src, duplicate=0) +VariantDir(var6, src) + +env = Environment(CPPPATH='#src', FORTRANPATH='#src') +SConscript('build/var1/SConscript', "env") +SConscript('build/var2/SConscript', "env") + +env = Environment(CPPPATH=src, FORTRANPATH=src) +SConscript('build/var3/SConscript', "env") +SConscript(File('SConscript', var4), "env") + +env = Environment(CPPPATH='.', FORTRANPATH='.') +SConscript('../build/var5/SConscript', "env") +SConscript('../build/var6/SConscript', "env") +""") + +test.subdir(['work1', 'src']) +test.write(['work1', 'src', 'SConscript'], """ +import os +import os.path + +def buildIt(target, source, env): + if not os.path.exists('build'): + os.mkdir('build') + f1=open(str(source[0]), 'r') + f2=open(str(target[0]), 'w') + f2.write(f1.read()) + f2.close() + f1.close() + return 0 +Import("env") +env.Command(target='f2.c', source='f2.in', action=buildIt) +env.Program(target='foo2', source='f2.c') +env.Program(target='foo1', source='f1.c') +env.Command(target='f3.h', source='f3h.in', action=buildIt) +env.Command(target='f4.h', source='f4h.in', action=buildIt) +env.Command(target='f4.c', source='f4.in', action=buildIt) + +env2=env.Clone(CPPPATH='.') +env2.Program(target='foo3', source='f3.c') +env2.Program(target='foo4', source='f4.c') +""") + +test.write(['work1', 'src', 'f1.c'], r""" +#include <stdio.h> +#include <stdlib.h> + +#include "f1.h" + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf(F1_STR); + exit (0); +} +""") + +test.write(['work1', 'src', 'f2.in'], r""" +#include <stdio.h> +#include <stdlib.h> + +#include "f2.h" + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf(F2_STR); + exit (0); +} +""") + +test.write(['work1', 'src', 'f3.c'], r""" +#include <stdio.h> +#include <stdlib.h> + +#include "f3.h" + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf(F3_STR); + exit (0); +} +""") + +test.write(['work1', 'src', 'f4.in'], r""" +#include <stdio.h> +#include <stdlib.h> + +#include "f4.h" + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf(F4_STR); + exit (0); +} +""") + +test.write(['work1', 'src', 'f1.h'], r""" +#define F1_STR "f1.c\n" +""") + +test.write(['work1', 'src', 'f2.h'], r""" +#define F2_STR "f2.c\n" +""") + +test.write(['work1', 'src', 'f3h.in'], r""" +#define F3_STR "f3.c\n" +""") + +test.write(['work1', 'src', 'f4h.in'], r""" +#define F4_STR "f4.c\n" +""") + +# Some releases of freeBSD seem to have library complaints about +# tempnam(). Filter out these annoying messages before checking for +# error output. +def blank_output(err): + if not err: + return 1 + stderrlines = filter(lambda l: l, string.split(err, '\n')) + msg = "warning: tempnam() possibly used unsafely" + stderrlines = filter(lambda l, msg=msg: string.find(l, msg) == -1, + stderrlines) + return len(stderrlines) == 0 + +test.run(chdir='work1', arguments = '. ../build', stderr=None) + +test.fail_test(not blank_output(test.stderr())) + +test.run(program = foo11, stdout = "f1.c\n") +test.run(program = foo12, stdout = "f2.c\n") +test.run(program = foo41, stdout = "f1.c\n") +test.run(program = foo42, stdout = "f2.c\n") + +test.run(chdir='work1', arguments='. ../build', stdout=test.wrap_stdout("""\ +scons: `.' is up to date. +scons: `%s' is up to date. +""" % test.workpath('build'))) + +import os +import stat +def equal_stats(x,y): + x = os.stat(x) + y = os.stat(y) + return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and + x[stat.ST_MTIME] == y[stat.ST_MTIME]) + +# Make sure we did duplicate the source files in build/var2, +# and that their stats are the same: +test.must_exist(['work1', 'build', 'var2', 'f1.c']) +test.must_exist(['work1', 'build', 'var2', 'f2.in']) +test.fail_test(not equal_stats(test.workpath('work1', 'build', 'var2', 'f1.c'), test.workpath('work1', 'src', 'f1.c'))) +test.fail_test(not equal_stats(test.workpath('work1', 'build', 'var2', 'f2.in'), test.workpath('work1', 'src', 'f2.in'))) + +# Make sure we didn't duplicate the source files in build/var3. +test.must_not_exist(['work1', 'build', 'var3', 'f1.c']) +test.must_not_exist(['work1', 'build', 'var3', 'f2.in']) +test.must_not_exist(['work1', 'build', 'var3', 'b1.f']) +test.must_not_exist(['work1', 'build', 'var3', 'b2.in']) + +# Make sure we didn't duplicate the source files in build/var4. +test.must_not_exist(['work1', 'build', 'var4', 'f1.c']) +test.must_not_exist(['work1', 'build', 'var4', 'f2.in']) +test.must_not_exist(['work1', 'build', 'var4', 'b1.f']) +test.must_not_exist(['work1', 'build', 'var4', 'b2.in']) + +# Make sure we didn't duplicate the source files in build/var5. +test.must_not_exist(['build', 'var5', 'f1.c']) +test.must_not_exist(['build', 'var5', 'f2.in']) +test.must_not_exist(['build', 'var5', 'b1.f']) +test.must_not_exist(['build', 'var5', 'b2.in']) + +# verify that header files in the source directory are scanned properly: +test.write(['work1', 'src', 'f1.h'], r""" +#define F1_STR "f1.c 2\n" +""") + +test.write(['work1', 'src', 'f3h.in'], r""" +#define F3_STR "f3.c 2\n" +""") + +test.write(['work1', 'src', 'f4h.in'], r""" +#define F4_STR "f4.c 2\n" +""") + +test.run(chdir='work1', arguments = '../build/var5', stderr=None) + +test.fail_test(not blank_output(test.stderr())) + +test.run(program = foo51, stdout = "f1.c 2\n") +test.run(program = test.workpath('build', 'var5', 'foo3' + _exe), + stdout = "f3.c 2\n") +test.run(program = test.workpath('build', 'var5', 'foo4' + _exe), + stdout = "f4.c 2\n") + +test.run(chdir='work1', arguments='../build/var5', stdout=test.wrap_stdout("""\ +scons: `%s' is up to date. +""" % test.workpath('build', 'var5'))) + +test.pass_test() diff --git a/test/CacheDir/timestamp-content.py b/test/Deprecated/CacheDir/timestamp-content.py index 6434d0c..850c369 100644 --- a/test/CacheDir/timestamp-content.py +++ b/test/Deprecated/CacheDir/timestamp-content.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ +SetOption('warn', 'no-deprecated') SourceSignatures('timestamp') TargetSignatures('content') CacheDir('cache') diff --git a/test/CacheDir/timestamp-timestamp.py b/test/Deprecated/CacheDir/timestamp-timestamp.py index 2bef1cd..73dce09 100644 --- a/test/CacheDir/timestamp-timestamp.py +++ b/test/Deprecated/CacheDir/timestamp-timestamp.py @@ -34,6 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write(['SConstruct'], """\ +SetOption('warn', 'no-deprecated') SourceSignatures('timestamp') TargetSignatures('timestamp') CacheDir('cache') diff --git a/test/Deprecated/Copy.py b/test/Deprecated/Copy.py new file mode 100644 index 0000000..f17fc9f --- /dev/null +++ b/test/Deprecated/Copy.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify the message about the deprecated env.Copy() message, and the +ability to suppress it. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConstruct', """ +env = Environment().Copy() +env.Copy() +""") + +expect = """ +scons: warning: The env.Copy() method is deprecated; use the env.Clone() method instead. +""" + +test.run(arguments = '.', + stderr = TestSCons.re_escape(expect) + TestSCons.file_expr) + +test.run(arguments = '--warn=no-deprecated .') + +test.run(arguments = '--warn=no-deprecated-copy .') + +test.pass_test() diff --git a/test/BuildDir/Sconscript-build_dir.py b/test/Deprecated/SConscript-build_dir.py index 50e2c4f..1e623af 100644 --- a/test/BuildDir/Sconscript-build_dir.py +++ b/test/Deprecated/SConscript-build_dir.py @@ -25,7 +25,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that specifying a build_dir argument to SConscript works properly. +Verify that specifying a build_dir argument to SConscript still works. + +Note that the build_dir argument does not yet print a deprecation warning. """ import TestSCons @@ -75,7 +77,7 @@ SConscript('src/SConscript', build_dir='build/var2', src_dir=src) SConscript('src/SConscript', build_dir='build/var3', duplicate=0) -#XXX We can't support var4 and var5 yet, because our BuildDir linkage +#XXX We can't support var4 and var5 yet, because our VariantDir linkage #XXX is to an entire source directory. We haven't yet generalized our #XXX infrastructure to be able to take the SConscript file from one source #XXX directory, but the rest of the files from a different one. @@ -92,7 +94,7 @@ env.SConscript('src/SConscript', build_dir='../$BUILD/var8', duplicate=0) # we set the path of the SConscript accordingly. The below is # equivalent to saying: # -# BuildDir('build/var9', '.') +# VariantDir('build/var9', '.') # SConscript('build/var9/src/SConscript') SConscript('src/SConscript', build_dir='build/var9', src_dir='.') """) @@ -123,7 +125,7 @@ all_alt = "test/alt/aaa.in\ntest/alt/bbb.in\ntest/alt/ccc.in\n" test.must_match(all1, all_src) test.must_match(all2, all_src) test.must_match(all3, all_src) -#XXX We can't support var4 and var5 yet, because our BuildDir linkage +#XXX We can't support var4 and var5 yet, because our VariantDir linkage #XXX is to an entire source directory. We haven't yet generalized our #XXX infrastructure to be able to take the SConscript file from one source #XXX directory, but the rest of the files from a different one. @@ -161,7 +163,7 @@ test.must_not_exist(test.workpath('test', 'build', 'var3', 'aaa.in')) test.must_not_exist(test.workpath('test', 'build', 'var3', 'bbb.in')) test.must_not_exist(test.workpath('test', 'build', 'var3', 'ccc.in')) -#XXX We can't support var4 and var5 yet, because our BuildDir linkage +#XXX We can't support var4 and var5 yet, because our VariantDir linkage #XXX is to an entire source directory. We haven't yet generalized our #XXX infrastructure to be able to take the SConscript file from one source #XXX directory, but the rest of the files from a different one. @@ -170,7 +172,7 @@ test.must_not_exist(test.workpath('test', 'build', 'var3', 'ccc.in')) #XXXtest.must_not_exist(test.workpath('test', 'build', 'var4', 'bbb.in')) #XXXtest.must_not_exist(test.workpath('test', 'build', 'var4', 'ccc.in')) -#XXX We can't support var4 and var5 yet, because our BuildDir linkage +#XXX We can't support var4 and var5 yet, because our VariantDir linkage #XXX is to an entire source directory. We haven't yet generalized our #XXX infrastructure to be able to take the SConscript file from one source #XXX directory, but the rest of the files from a different one. diff --git a/test/SourceSignatures/basic.py b/test/Deprecated/SourceSignatures/basic.py index 7042fac..5012296 100644 --- a/test/SourceSignatures/basic.py +++ b/test/Deprecated/SourceSignatures/basic.py @@ -26,14 +26,16 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path +import re import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) base_sconstruct_contents = """\ +SetOption('warn', 'no-deprecated-source-signatures') def build(env, target, source): open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) B = Builder(action = build) @@ -59,15 +61,17 @@ test.write('f2.in', "f2.in\n") test.write('f3.in', "f3.in\n") test.write('f4.in', "f4.in\n") -test.run(arguments = 'f1.out f3.out') +test.run(arguments = 'f1.out f3.out', + stderr = TestSCons.deprecated_python_expr) test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = test.wrap_stdout("""\ + stdout = re.escape(test.wrap_stdout("""\ scons: `f1.out' is up to date. build(["f2.out"], ["f2.in"]) scons: `f3.out' is up to date. build(["f4.out"], ["f4.in"]) -""")) +""")), + stderr = TestSCons.deprecated_python_expr) @@ -79,12 +83,13 @@ os.utime(test.workpath('f3.in'), os.path.getmtime(test.workpath('f3.in'))+10)) test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = test.wrap_stdout("""\ + stdout = re.escape(test.wrap_stdout("""\ build(["f1.out"], ["f1.in"]) scons: `f2.out' is up to date. build(["f3.out"], ["f3.in"]) scons: `f4.out' is up to date. -""")) +""")), + stderr = TestSCons.deprecated_python_expr) @@ -93,7 +98,8 @@ scons: `f4.out' is up to date. write_SConstruct(test, 'MD5') -test.not_up_to_date(arguments = 'f1.out f2.out f3.out f4.out') +test.not_up_to_date(arguments = 'f1.out f2.out f3.out f4.out', + stderr = TestSCons.deprecated_python_expr) @@ -104,20 +110,20 @@ test.write('f2.in', "f2.in\n") test.write('f3.in', "f3.in\n") test.write('f4.in', "f4.in\n") -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out') +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) test.touch('f1.in', os.path.getmtime(test.workpath('f1.in'))+10) test.touch('f3.in', os.path.getmtime(test.workpath('f3.in'))+10) -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out') +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) write_SConstruct(test, None) -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out') +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) diff --git a/test/SourceSignatures/env.py b/test/Deprecated/SourceSignatures/env.py index 3bef2a6..ec6d3d2 100644 --- a/test/SourceSignatures/env.py +++ b/test/Deprecated/SourceSignatures/env.py @@ -31,17 +31,19 @@ default behavior. import os import os.path +import re import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) base_sconstruct_contents = """\ +SetOption('warn', 'no-deprecated-source-signatures') def build(env, target, source): open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) B = Builder(action = build) env = Environment(BUILDERS = { 'B' : B }) -env2 = env.Copy() +env2 = env.Clone() env2.SourceSignatures('%s') env.B(target = 'f1.out', source = 'f1.in') env.B(target = 'f2.out', source = 'f2.in') @@ -64,15 +66,17 @@ test.write('f2.in', "f2.in\n") test.write('f3.in', "f3.in\n") test.write('f4.in', "f4.in\n") -test.run(arguments = 'f1.out f3.out') +test.run(arguments = 'f1.out f3.out', + stderr = TestSCons.deprecated_python_expr) test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = test.wrap_stdout("""\ + stdout = re.escape(test.wrap_stdout("""\ scons: `f1.out' is up to date. build(["f2.out"], ["f2.in"]) scons: `f3.out' is up to date. build(["f4.out"], ["f4.in"]) -""")) +""")), + stderr = TestSCons.deprecated_python_expr) @@ -82,14 +86,15 @@ test.touch('f1.in') test.touch('f3.in') test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = test.wrap_stdout("""\ + stdout = re.escape(test.wrap_stdout("""\ build(["f1.out"], ["f1.in"]) scons: `f2.out' is up to date. scons: `f3.out' is up to date. scons: `f4.out' is up to date. -""")) +""")), + stderr = TestSCons.deprecated_python_expr) -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out') +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) diff --git a/test/SourceSignatures/implicit-cache.py b/test/Deprecated/SourceSignatures/implicit-cache.py index de66b72..44c30ce 100644 --- a/test/SourceSignatures/implicit-cache.py +++ b/test/Deprecated/SourceSignatures/implicit-cache.py @@ -29,11 +29,14 @@ Test the simultaneous use of implicit_cache and SourceSignatures('timestamp') """ +import re + import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """\ +SetOption('warn', 'no-deprecated-source-signatures') SetOption('implicit_cache', 1) SourceSignatures('timestamp') @@ -44,13 +47,15 @@ env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'both.out', source = 'both.in') """) -both_out_both_in = test.wrap_stdout('build(["both.out"], ["both.in"])\n') +both_out_both_in = re.escape(test.wrap_stdout('build(["both.out"], ["both.in"])\n')) test.write('both.in', "both.in 1\n") -test.run(arguments = 'both.out', stdout = both_out_both_in) +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = TestSCons.deprecated_python_expr) @@ -58,7 +63,9 @@ test.sleep(2) test.write('both.in', "both.in 2\n") -test.run(arguments = 'both.out', stdout = both_out_both_in) +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = TestSCons.deprecated_python_expr) @@ -66,7 +73,9 @@ test.sleep(2) test.write('both.in', "both.in 3\n") -test.run(arguments = 'both.out', stdout = both_out_both_in) +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = TestSCons.deprecated_python_expr) @@ -74,13 +83,15 @@ test.sleep(2) test.write('both.in', "both.in 4\n") -test.run(arguments = 'both.out', stdout = both_out_both_in) +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = TestSCons.deprecated_python_expr) test.sleep(2) -test.up_to_date(arguments = 'both.out') +test.up_to_date(arguments = 'both.out', stderr = None) diff --git a/test/SourceSignatures/no-csigs.py b/test/Deprecated/SourceSignatures/no-csigs.py index 3702901..01d05da 100644 --- a/test/SourceSignatures/no-csigs.py +++ b/test/Deprecated/SourceSignatures/no-csigs.py @@ -28,12 +28,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path +import TestSCons import TestSConsign test = TestSConsign.TestSConsign(match = TestSConsign.match_re) test.write('SConstruct', """\ +SetOption('warn', 'no-deprecated-source-signatures') def build(env, target, source): open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) B = Builder(action = build) @@ -46,7 +48,8 @@ SourceSignatures('timestamp') test.write('f1.in', "f1.in\n") test.write('f2.in', "f2.in\n") -test.run(arguments = '.') +test.run(arguments = '.', + stderr = TestSCons.deprecated_python_expr) diff --git a/test/SourceSignatures/overrides.py b/test/Deprecated/SourceSignatures/overrides.py index cf83488..de1cc95 100644 --- a/test/SourceSignatures/overrides.py +++ b/test/Deprecated/SourceSignatures/overrides.py @@ -34,9 +34,10 @@ content signature.) import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """\ +SetOption('warn', 'no-deprecated-source-signatures') DefaultEnvironment().SourceSignatures('MD5') env = Environment() env.SourceSignatures('timestamp') @@ -45,12 +46,14 @@ env.Command('foo.out', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=1) test.write('foo.in', "foo.in 1\n") -test.run(arguments = 'foo.out') +test.run(arguments = 'foo.out', + stderr = TestSCons.deprecated_python_expr) test.sleep() test.write('foo.in', "foo.in 1\n") -test.not_up_to_date(arguments = 'foo.out') +test.not_up_to_date(arguments = 'foo.out', + stderr = TestSCons.deprecated_python_expr) test.pass_test() diff --git a/test/SourceSignatures/switch-rebuild.py b/test/Deprecated/SourceSignatures/switch-rebuild.py index 85c2b22..07b59fb 100644 --- a/test/SourceSignatures/switch-rebuild.py +++ b/test/Deprecated/SourceSignatures/switch-rebuild.py @@ -28,12 +28,15 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test that switching SourceSignature() types no longer causes rebuilds. """ +import re + import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) base_sconstruct_contents = """\ +SetOption('warn', 'no-deprecated-source-signatures') SourceSignatures('%s') def build(env, target, source): @@ -52,29 +55,33 @@ write_SConstruct(test, 'MD5') test.write('switch.in', "switch.in\n") -switch_out_switch_in = test.wrap_stdout('build(["switch.out"], ["switch.in"])\n') +switch_out_switch_in = re.escape(test.wrap_stdout('build(["switch.out"], ["switch.in"])\n')) -test.run(arguments = 'switch.out', stdout = switch_out_switch_in) +test.run(arguments = 'switch.out', + stdout = switch_out_switch_in, + stderr = TestSCons.deprecated_python_expr) -test.up_to_date(arguments = 'switch.out') +test.up_to_date(arguments = 'switch.out', stderr = None) write_SConstruct(test, 'timestamp') -test.up_to_date(arguments = 'switch.out') +test.up_to_date(arguments = 'switch.out', stderr = None) write_SConstruct(test, 'MD5') -test.not_up_to_date(arguments = 'switch.out') +test.not_up_to_date(arguments = 'switch.out', stderr = None) test.write('switch.in', "switch.in 2\n") -test.run(arguments = 'switch.out', stdout = switch_out_switch_in) +test.run(arguments = 'switch.out', + stdout = switch_out_switch_in, + stderr = TestSCons.deprecated_python_expr) diff --git a/test/TargetSignatures/build-content.py b/test/Deprecated/TargetSignatures/build-content.py index 2cd7a89..6fd031e 100644 --- a/test/TargetSignatures/build-content.py +++ b/test/Deprecated/TargetSignatures/build-content.py @@ -30,13 +30,16 @@ and TargetSignatures('content') settings, overriding one with the other in specific construction environments. """ +import re + import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) sconstruct_contents = """\ +SetOption('warn', 'no-deprecated-target-signatures') env = Environment() def copy1(env, source, target): @@ -72,14 +75,15 @@ test.write('foo.in', 'foo.in') test.write('bar.in', 'bar.in') test.run(arguments="bar.out foo.out", - stdout=test.wrap_stdout("""\ + stdout=re.escape(test.wrap_stdout("""\ copy2(["bar.mid"], ["bar.in"]) copy1(["bar.out"], ["bar.mid"]) copy2(["foo.mid"], ["foo.in"]) copy1(["foo.out"], ["foo.mid"]) -""")) +""")), + stderr = TestSCons.deprecated_python_expr) -test.up_to_date(arguments='bar.out foo.out') +test.up_to_date(arguments='bar.out foo.out', stderr=None) @@ -89,12 +93,13 @@ test.up_to_date(arguments='bar.out foo.out') write_SConstruct(test, 'x = 2 # added this line', 'build', 'content') test.run(arguments="bar.out foo.out", - stdout=test.wrap_stdout("""\ + stdout=re.escape(test.wrap_stdout("""\ copy2(["bar.mid"], ["bar.in"]) copy1(["bar.out"], ["bar.mid"]) copy2(["foo.mid"], ["foo.in"]) scons: `foo.out' is up to date. -""")) +""")), + stderr = TestSCons.deprecated_python_expr) @@ -103,7 +108,7 @@ scons: `foo.out' is up to date. write_SConstruct(test, 'x = 2 # added this line', 'content', 'build') -test.up_to_date(arguments="bar.out foo.out") +test.up_to_date(arguments="bar.out foo.out", stderr=None) @@ -113,12 +118,13 @@ test.up_to_date(arguments="bar.out foo.out") write_SConstruct(test, '', 'content', 'build') test.run(arguments='bar.out foo.out', - stdout=test.wrap_stdout("""\ + stdout=re.escape(test.wrap_stdout("""\ copy2(["bar.mid"], ["bar.in"]) scons: `bar.out' is up to date. copy2(["foo.mid"], ["foo.in"]) copy1(["foo.out"], ["foo.mid"]) -""")) +""")), + stderr = TestSCons.deprecated_python_expr) diff --git a/test/TargetSignatures/content.py b/test/Deprecated/TargetSignatures/content.py index 8d9f213..4de1422 100644 --- a/test/TargetSignatures/content.py +++ b/test/Deprecated/TargetSignatures/content.py @@ -31,11 +31,13 @@ SourceSignatures('timestamp') settings. import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """\ +SetOption('warn', 'no-deprecated-source-signatures') +SetOption('warn', 'no-deprecated-target-signatures') env = Environment() def copy(env, source, target): @@ -65,14 +67,14 @@ test.write('foo.in', "foo.in\n") test.write('bar.in', "bar.in\n") test.write('extra.in', "extra.in 1\n") -test.run() +test.run(stderr = TestSCons.deprecated_python_expr) test.must_match('final', "foo.in\nbar.in\nextra.in 1\n") test.sleep() test.write('extra.in', "extra.in 2\n") -test.run() +test.run(stderr = TestSCons.deprecated_python_expr) test.must_match('final', "foo.in\nbar.in\nextra.in 1\n") diff --git a/test/TargetSignatures/overrides.py b/test/Deprecated/TargetSignatures/overrides.py index 5d9dd99..327218e 100644 --- a/test/TargetSignatures/overrides.py +++ b/test/Deprecated/TargetSignatures/overrides.py @@ -33,9 +33,10 @@ behavior like infinite recursion. import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """\ +SetOption('warn', 'no-deprecated-target-signatures') env = Environment() env.TargetSignatures('content') env.Command('foo.out', 'foo.mid', Copy('$TARGET', '$SOURCE'), FOO=1) @@ -44,7 +45,8 @@ env.Command('foo.mid', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=2) test.write('foo.in', "foo.in\n") -test.run(arguments = '.') +test.run(arguments = '.', + stderr = TestSCons.deprecated_python_expr) test.must_match('foo.mid', "foo.in\n") test.must_match('foo.out', "foo.in\n") diff --git a/test/option/debug-dtree.py b/test/Deprecated/debug-dtree.py index 3ef396e..2aec880 100644 --- a/test/option/debug-dtree.py +++ b/test/Deprecated/debug-dtree.py @@ -35,7 +35,7 @@ import string import re import time -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """ env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx') @@ -73,13 +73,20 @@ test.write('bar.h', """ #endif """) +expect = """ +scons: warning: The --debug=dtree option is deprecated; please use --tree=derived instead. +""" + +stderr = TestSCons.re_escape(expect) + TestSCons.file_expr + dtree1 = """ +-foo.xxx +-foo.ooo +-bar.ooo """ -test.run(arguments = "--debug=dtree foo.xxx") +test.run(arguments = "--debug=dtree foo.xxx", + stderr = stderr) test.fail_test(string.find(test.stdout(), dtree1) == -1) dtree2 = """ @@ -90,7 +97,8 @@ dtree2 = """ +-foo.ooo +-bar.ooo """ -test.run(arguments = "--debug=dtree .") +test.run(arguments = "--debug=dtree .", + stderr = stderr) test.fail_test(string.find(test.stdout(), dtree2) == -1) # Make sure we print the debug stuff even if there's a build failure. diff --git a/test/option/debug-nomemoizer.py b/test/Deprecated/debug-nomemoizer.py index 3a927e5..3a927e5 100644 --- a/test/option/debug-nomemoizer.py +++ b/test/Deprecated/debug-nomemoizer.py diff --git a/test/option/debug-stree.py b/test/Deprecated/debug-stree.py index bf65dbb..8907c6c 100644 --- a/test/option/debug-stree.py +++ b/test/Deprecated/debug-stree.py @@ -35,7 +35,7 @@ import string import re import time -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) CC = test.detect('CC') LINK = test.detect('LINK') @@ -77,6 +77,12 @@ test.write('bar.h', """ #endif """) +expect = """ +scons: warning: The --debug=stree option is deprecated; please use --tree=all,status instead. +""" + +stderr = TestSCons.re_escape(expect) + TestSCons.file_expr + stree = """ [E B C ]+-foo.xxx [E B C ] +-foo.ooo @@ -92,7 +98,8 @@ stree = """ [E C ] +-%(LINK)s """ % locals() -test.run(arguments = "--debug=stree foo.xxx") +test.run(arguments = "--debug=stree foo.xxx", + stderr = stderr) test.fail_test(string.find(test.stdout(), stree) == -1) stree2 = """ @@ -123,7 +130,8 @@ stree2 = """ test.run(arguments = '-c foo.xxx') -test.run(arguments = "--no-exec --debug=stree foo.xxx") +test.run(arguments = "--no-exec --debug=stree foo.xxx", + stderr = stderr) test.fail_test(string.find(test.stdout(), stree2) == -1) test.pass_test() diff --git a/test/option/debug-tree.py b/test/Deprecated/debug-tree.py index f581bc4..0703a16 100644 --- a/test/option/debug-tree.py +++ b/test/Deprecated/debug-tree.py @@ -35,7 +35,7 @@ import string import re import time -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) CC = test.detect('CC') LINK = test.detect('LINK') @@ -81,6 +81,12 @@ test.write('Bar.h', """ #endif """) +expect = """ +scons: warning: The --debug=tree option is deprecated; please use --tree=all instead. +""" + +stderr = TestSCons.re_escape(expect) + TestSCons.file_expr + tree1 = """ +-Foo.xxx +-Foo.ooo @@ -96,7 +102,8 @@ tree1 = """ +-%(LINK)s """ % locals() -test.run(arguments = "--debug=tree Foo.xxx") +test.run(arguments = "--debug=tree Foo.xxx", + stderr = stderr) if string.find(test.stdout(), tree1) == -1: sys.stdout.write('Did not find expected tree in the following output:\n') sys.stdout.write(test.stdout()) @@ -133,7 +140,8 @@ tree2 = """ +-SConstruct """ % locals() -test.run(arguments = "--debug=tree .") +test.run(arguments = "--debug=tree .", + stderr = stderr) if string.find(test.stdout(), tree2) == -1: sys.stdout.write('Did not find expected tree in the following output:\n') sys.stdout.write(test.stdout()) diff --git a/test/Dir/source.py b/test/Dir/source.py index 9852660..68165f3 100644 --- a/test/Dir/source.py +++ b/test/Dir/source.py @@ -37,10 +37,10 @@ import TestSCons test = TestSCons.TestSCons() -test.subdir('bsig', [ 'bsig', 'subdir' ], - 'csig', [ 'csig', 'subdir' ], - 'cmd-bsig', [ 'cmd-bsig', 'subdir' ], - 'cmd-csig', [ 'cmd-csig', 'subdir' ]) +test.subdir('tstamp', [ 'tstamp', 'subdir' ], + 'content', [ 'content', 'subdir' ], + 'cmd-tstamp', [ 'cmd-tstamp', 'subdir' ], + 'cmd-content', [ 'cmd-content', 'subdir' ]) test.write('SConstruct', """\ def writeTarget(target, source, env): @@ -57,114 +57,114 @@ env = Environment() env['BUILDERS']['TestDir'] = test_bld_dir env['BUILDERS']['TestFile'] = test_bld_file -env_bsig = env.Clone() -env_bsig.TargetSignatures('build') -env_bsig.TestFile(source='junk.txt', target='bsig/junk.out') -env_bsig.TestDir(source='bsig', target='bsig.out') -env_bsig.Command('cmd-bsig-noscan.out', 'cmd-bsig', writeTarget) -env_bsig.Command('cmd-bsig.out', 'cmd-bsig', writeTarget, +env_tstamp = env.Clone() +env_tstamp.Decider('timestamp-newer') +env_tstamp.TestFile(source='junk.txt', target='tstamp/junk.out') +env_tstamp.TestDir(source='tstamp', target='tstamp.out') +env_tstamp.Command('cmd-tstamp-noscan.out', 'cmd-tstamp', writeTarget) +env_tstamp.Command('cmd-tstamp.out', 'cmd-tstamp', writeTarget, source_scanner=DirScanner) -env_csig = env.Clone() -env_csig.TargetSignatures('content') -env_csig.TestFile(source='junk.txt', target='csig/junk.out') -env_csig.TestDir(source='csig', target='csig.out') -env_csig.Command('cmd-csig-noscan.out', 'cmd-csig', writeTarget) -env_csig.Command('cmd-csig.out', 'cmd-csig', writeTarget, +env_content = env.Clone() +env_content.Decider('content') +env_content.TestFile(source='junk.txt', target='content/junk.out') +env_content.TestDir(source='content', target='content.out') +env_content.Command('cmd-content-noscan.out', 'cmd-content', writeTarget) +env_content.Command('cmd-content.out', 'cmd-content', writeTarget, source_scanner=DirScanner) """) -test.write([ 'bsig', 'foo.txt' ], 'foo.txt 1\n') -test.write([ 'bsig', '#hash.txt' ], 'hash.txt 1\n') -test.write([ 'bsig', 'subdir', 'bar.txt'], 'bar.txt 1\n') -test.write([ 'bsig', 'subdir', '#hash.txt'], 'hash.txt 1\n') -test.write([ 'csig', 'foo.txt' ], 'foo.txt 1\n') -test.write([ 'csig', '#hash.txt' ], 'hash.txt 1\n') -test.write([ 'csig', 'subdir', 'bar.txt' ], 'bar.txt 1\n') -test.write([ 'csig', 'subdir', '#hash.txt' ], 'hash.txt 1\n') -test.write([ 'cmd-bsig', 'foo.txt' ], 'foo.txt 1\n') -test.write([ 'cmd-bsig', '#hash.txt' ], 'hash.txt 1\n') -test.write([ 'cmd-bsig', 'subdir', 'bar.txt' ], 'bar.txt 1\n') -test.write([ 'cmd-bsig', 'subdir', '#hash.txt' ], 'hash.txt 1\n') -test.write([ 'cmd-csig', 'foo.txt' ], 'foo.txt 1\n') -test.write([ 'cmd-csig', '#hash.txt' ], '#hash.txt 1\n') -test.write([ 'cmd-csig', 'subdir', 'bar.txt' ], 'bar.txt 1\n') -test.write([ 'cmd-csig', 'subdir', '#hash.txt' ], 'hash.txt 1\n') +test.write([ 'tstamp', 'foo.txt' ], 'foo.txt 1\n') +test.write([ 'tstamp', '#hash.txt' ], 'hash.txt 1\n') +test.write([ 'tstamp', 'subdir', 'bar.txt'], 'bar.txt 1\n') +test.write([ 'tstamp', 'subdir', '#hash.txt'], 'hash.txt 1\n') +test.write([ 'content', 'foo.txt' ], 'foo.txt 1\n') +test.write([ 'content', '#hash.txt' ], 'hash.txt 1\n') +test.write([ 'content', 'subdir', 'bar.txt' ], 'bar.txt 1\n') +test.write([ 'content', 'subdir', '#hash.txt' ], 'hash.txt 1\n') +test.write([ 'cmd-tstamp', 'foo.txt' ], 'foo.txt 1\n') +test.write([ 'cmd-tstamp', '#hash.txt' ], 'hash.txt 1\n') +test.write([ 'cmd-tstamp', 'subdir', 'bar.txt' ], 'bar.txt 1\n') +test.write([ 'cmd-tstamp', 'subdir', '#hash.txt' ], 'hash.txt 1\n') +test.write([ 'cmd-content', 'foo.txt' ], 'foo.txt 1\n') +test.write([ 'cmd-content', '#hash.txt' ], '#hash.txt 1\n') +test.write([ 'cmd-content', 'subdir', 'bar.txt' ], 'bar.txt 1\n') +test.write([ 'cmd-content', 'subdir', '#hash.txt' ], 'hash.txt 1\n') test.write('junk.txt', 'junk.txt\n') test.run(arguments=".", stderr=None) -test.must_match('bsig.out', 'stuff\n') -test.must_match('csig.out', 'stuff\n') -test.must_match('cmd-bsig.out', 'stuff\n') -test.must_match('cmd-csig.out', 'stuff\n') -test.must_match('cmd-bsig-noscan.out', 'stuff\n') -test.must_match('cmd-csig-noscan.out', 'stuff\n') +test.must_match('tstamp.out', 'stuff\n') +test.must_match('content.out', 'stuff\n') +test.must_match('cmd-tstamp.out', 'stuff\n') +test.must_match('cmd-content.out', 'stuff\n') +test.must_match('cmd-tstamp-noscan.out', 'stuff\n') +test.must_match('cmd-content-noscan.out', 'stuff\n') -test.up_to_date(arguments='bsig.out') -test.up_to_date(arguments='csig.out') -test.up_to_date(arguments='cmd-bsig.out') -test.up_to_date(arguments='cmd-csig.out') -test.up_to_date(arguments='cmd-bsig-noscan.out') -test.up_to_date(arguments='cmd-csig-noscan.out') +test.up_to_date(arguments='tstamp.out') +test.up_to_date(arguments='content.out') +test.up_to_date(arguments='cmd-tstamp.out') +test.up_to_date(arguments='cmd-content.out') +test.up_to_date(arguments='cmd-tstamp-noscan.out') +test.up_to_date(arguments='cmd-content-noscan.out') -test.write([ 'bsig', 'foo.txt' ], 'foo.txt 2\n') -test.not_up_to_date(arguments='bsig.out') +test.write([ 'tstamp', 'foo.txt' ], 'foo.txt 2\n') +test.not_up_to_date(arguments='tstamp.out') -test.write([ 'bsig', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='bsig.out') +test.write([ 'tstamp', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='tstamp.out') -test.write([ 'csig', 'foo.txt' ], 'foo.txt 2\n') -test.not_up_to_date(arguments='csig.out') +test.write([ 'content', 'foo.txt' ], 'foo.txt 2\n') +test.not_up_to_date(arguments='content.out') -test.write([ 'csig', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='csig.out') +test.write([ 'content', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='content.out') -test.write([ 'cmd-bsig', 'foo.txt' ], 'foo.txt 2\n') -test.not_up_to_date(arguments='cmd-bsig.out') -test.up_to_date(arguments='cmd-bsig-noscan.out') +test.write([ 'cmd-tstamp', 'foo.txt' ], 'foo.txt 2\n') +test.not_up_to_date(arguments='cmd-tstamp.out') +test.up_to_date(arguments='cmd-tstamp-noscan.out') -test.write([ 'cmd-bsig', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='cmd-bsig.out') -test.up_to_date(arguments='cmd-bsig-noscan.out') +test.write([ 'cmd-tstamp', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='cmd-tstamp.out') +test.up_to_date(arguments='cmd-tstamp-noscan.out') -test.write([ 'cmd-csig', 'foo.txt' ], 'foo.txt 2\n') -test.not_up_to_date(arguments='cmd-csig.out') -test.up_to_date(arguments='cmd-csig-noscan.out') +test.write([ 'cmd-content', 'foo.txt' ], 'foo.txt 2\n') +test.not_up_to_date(arguments='cmd-content.out') +test.up_to_date(arguments='cmd-content-noscan.out') -test.write([ 'cmd-csig', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='cmd-csig.out') -test.up_to_date(arguments='cmd-csig-noscan.out') +test.write([ 'cmd-content', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='cmd-content.out') +test.up_to_date(arguments='cmd-content-noscan.out') -test.write([ 'bsig', 'subdir', 'bar.txt' ], 'bar.txt 2\n') -test.not_up_to_date(arguments='bsig.out') +test.write([ 'tstamp', 'subdir', 'bar.txt' ], 'bar.txt 2\n') +test.not_up_to_date(arguments='tstamp.out') -test.write([ 'bsig', 'subdir', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='bsig.out') +test.write([ 'tstamp', 'subdir', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='tstamp.out') -test.write([ 'csig', 'subdir', 'bar.txt' ], 'bar.txt 2\n') -test.not_up_to_date(arguments='csig.out') +test.write([ 'content', 'subdir', 'bar.txt' ], 'bar.txt 2\n') +test.not_up_to_date(arguments='content.out') -test.write([ 'csig', 'subdir', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='csig.out') +test.write([ 'content', 'subdir', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='content.out') -test.write([ 'cmd-bsig', 'subdir', 'bar.txt' ], 'bar.txt 2\n') -test.not_up_to_date(arguments='cmd-bsig.out') -test.up_to_date(arguments='cmd-bsig-noscan.out') +test.write([ 'cmd-tstamp', 'subdir', 'bar.txt' ], 'bar.txt 2\n') +test.not_up_to_date(arguments='cmd-tstamp.out') +test.up_to_date(arguments='cmd-tstamp-noscan.out') -test.write([ 'cmd-bsig', 'subdir', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='cmd-bsig.out') -test.up_to_date(arguments='cmd-bsig-noscan.out') +test.write([ 'cmd-tstamp', 'subdir', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='cmd-tstamp.out') +test.up_to_date(arguments='cmd-tstamp-noscan.out') -test.write([ 'cmd-csig', 'subdir', 'bar.txt' ], 'bar.txt 2\n') -test.not_up_to_date(arguments='cmd-csig.out') -test.up_to_date(arguments='cmd-csig-noscan.out') +test.write([ 'cmd-content', 'subdir', 'bar.txt' ], 'bar.txt 2\n') +test.not_up_to_date(arguments='cmd-content.out') +test.up_to_date(arguments='cmd-content-noscan.out') -test.write([ 'cmd-csig', 'subdir', 'new.txt' ], 'new.txt\n') -test.not_up_to_date(arguments='cmd-csig.out') -test.up_to_date(arguments='cmd-csig-noscan.out') +test.write([ 'cmd-content', 'subdir', 'new.txt' ], 'new.txt\n') +test.not_up_to_date(arguments='cmd-content.out') +test.up_to_date(arguments='cmd-content-noscan.out') test.write('junk.txt', 'junk.txt 2\n') -test.not_up_to_date(arguments='bsig.out') -test.not_up_to_date(arguments='csig.out') +test.not_up_to_date(arguments='tstamp.out') +test.not_up_to_date(arguments='content.out') test.pass_test() diff --git a/test/Fortran/F77PATH.py b/test/Fortran/F77PATH.py index 4dd8f51..738954f 100644 --- a/test/Fortran/F77PATH.py +++ b/test/Fortran/F77PATH.py @@ -58,7 +58,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.f77') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(F77PATH=[include, '#foobar', '#subdir'], LIBS = %s, @@ -246,7 +246,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.f77') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(F77PATH=['inc2', include, '#foobar', '#subdir'], LIBS = %s, diff --git a/test/Fortran/F90PATH.py b/test/Fortran/F90PATH.py index f1fac46..fb159cf 100644 --- a/test/Fortran/F90PATH.py +++ b/test/Fortran/F90PATH.py @@ -78,7 +78,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.f90') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(F90 = r'%s', F90PATH=[include, '#foobar', '#subdir'], @@ -270,7 +270,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.f90') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(F90 = r'%s', F90PATH=['inc2', include, '#foobar', '#subdir'], diff --git a/test/Fortran/FORTRANPATH.py b/test/Fortran/FORTRANPATH.py index 20a92d2..5f9d022 100644 --- a/test/Fortran/FORTRANPATH.py +++ b/test/Fortran/FORTRANPATH.py @@ -56,7 +56,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.f') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(FORTRANPATH=[include, '#foobar', '#subdir'], LIBS = %s) @@ -242,7 +242,7 @@ obj = env.Object(target='foobar/prog', source='subdir/prog.f') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(FORTRANPATH=['inc2', include, '#foobar', '#subdir'], LIBS = %s) diff --git a/test/GetBuildFailures/parallel.py b/test/GetBuildFailures/parallel.py index cfadd0d..789cfbf 100644 --- a/test/GetBuildFailures/parallel.py +++ b/test/GetBuildFailures/parallel.py @@ -98,25 +98,34 @@ test.write('f4.in', "f4.in\n") test.write('f5.in', "f5.in\n") test.write('f6.in', "f6.in\n") -expect_stdout = """\ -scons: Reading SConscript files ... -scons: done reading SConscript files. -scons: Building targets ... -scons: building terminated because of errors. -f4 failed: Error 1 -f5 failed: Error 1 -""" % locals() - expect_stderr = """\ scons: *** [f4] Error 1 scons: *** [f5] Error 1 """ -test.run(arguments = '-j 4 .', +test.run(arguments = '-Q -j 4 .', status = 2, - stdout = expect_stdout, stderr = expect_stderr) +# We jump through hoops above to try to make sure that the individual +# commands execute and exit in the order we want, but we still can't be +# 100% sure that SCons will actually detect and record the failures in +# that order; the thread for f5 may detect its command's failure before +# the thread for f4. Just sidestep the issue by allowing the failure +# strings in the output to come in either order. If there's a genuine +# problem in the way things get ordered, it'll show up in stderr. + +f4_failed = "f4 failed: Error 1\n" +f5_failed = "f5 failed: Error 1\n" + +failed_45 = f4_failed + f5_failed +failed_54 = f5_failed + f4_failed + +if test.stdout() not in [failed_45, failed_54]: + print "Did not find the following output in list of expected strings:" + print test.stdout(), + test.fail_test() + test.must_match(test.workpath('f3'), 'f3.in\n') test.must_not_exist(test.workpath('f4')) test.must_not_exist(test.workpath('f5')) diff --git a/test/Glob/BuildDir.py b/test/Glob/VariantDir.py index 274ca49..5f29b21 100644 --- a/test/Glob/BuildDir.py +++ b/test/Glob/VariantDir.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that default use of the Glob() function within a BuildDir() +Verify that default use of the Glob() function within a VariantDir() finds the local file Nodes. """ @@ -36,8 +36,8 @@ test = TestSCons.TestSCons() test.subdir('src') test.write('SConstruct', """\ -BuildDir('var1', 'src') -BuildDir('var2', 'src') +VariantDir('var1', 'src') +VariantDir('var2', 'src') SConscript('var1/SConscript') SConscript('var2/SConscript') diff --git a/test/Glob/source.py b/test/Glob/source.py index b82e1d9..4142fc0 100644 --- a/test/Glob/source.py +++ b/test/Glob/source.py @@ -25,9 +25,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that use of the Glob() function within a BuildDir() returns the +Verify that use of the Glob() function within a VariantDir() returns the file Nodes in the source directory when the source= keyword argument is -specified (and duplicate=0 is specified for the BuildDir()). +specified (and duplicate=0 is specified for the VariantDir()). """ import TestSCons @@ -49,8 +49,8 @@ env['BUILDERS']['Concatenate'] = Builder(action=concatenate) Export("env") -BuildDir('var1', 'src', duplicate=0) -BuildDir('var2', 'src', duplicate=0) +VariantDir('var1', 'src', duplicate=0) +VariantDir('var2', 'src', duplicate=0) SConscript('var1/SConscript') SConscript('var2/SConscript') diff --git a/test/Glob/strings.py b/test/Glob/strings.py index d9f8ff1..4852790 100644 --- a/test/Glob/strings.py +++ b/test/Glob/strings.py @@ -37,8 +37,8 @@ test = TestSCons.TestSCons() test.subdir('src') test.write('SConstruct', """\ -BuildDir('var1', 'src') -BuildDir('var2', 'src') +VariantDir('var1', 'src') +VariantDir('var2', 'src') SConscript('var1/SConscript') SConscript('var2/SConscript') diff --git a/test/IDL/midl.py b/test/IDL/midl.py index 15ac086..810edc1 100644 --- a/test/IDL/midl.py +++ b/test/IDL/midl.py @@ -49,10 +49,10 @@ env = Environment(CCFLAGS = ' -nologo ', MSVS_USE_MFC_DIRS = 1) Export('env') -BuildDir('build', 'src') +VariantDir('build', 'src') SConscript(os.path.join('build','SConscript')) -BuildDir('build2', 'src', duplicate=0) +VariantDir('build2', 'src', duplicate=0) SConscript(os.path.join('build2','SConscript')) """) diff --git a/test/Install/Install.py b/test/Install/Install.py index 6d44c45..c38edaa 100644 --- a/test/Install/Install.py +++ b/test/Install/Install.py @@ -82,6 +82,11 @@ env1.Install('.', r'%(f5_txt)s') env1.Install('export', r'%(f5_txt)s') env1.Install('.', r'%(f6_sep)s') env1.Install('export', r'%(f6_sep)s') + +# test passing a keyword arg (not used, but should be accepted) +env7 = env1.Clone(EXPORT='export') +env7.Install(dir='$EXPORT', source='./f1.in', FOO="bar") + """ % locals()) test.write(['work', 'f1.in'], "f1.in\n") @@ -103,6 +108,7 @@ test.must_match(['work', 'f6.txt'], "f6.txt\n") test.must_match(['work', 'export', 'f6.txt'], "f6.txt\n") test.must_match(['work', 'my_install.out'], os.path.join('export', 'f3.out')) +test.must_match(['work', 'export', 'f1.in'], "f1.in\n") # make sure the programs didn't get rebuilt, because nothing changed: oldtime1 = os.path.getmtime(f1_out) diff --git a/test/Install/InstallAs.py b/test/Install/InstallAs.py index 7a6c9f6..0b810f0 100644 --- a/test/Install/InstallAs.py +++ b/test/Install/InstallAs.py @@ -50,6 +50,8 @@ env = Environment(INSTALLDIR=r'%(install)s', SUBDIR='subdir') InstallAs(r'%(install_file1_out)s', 'file1.in') env.InstallAs([r'%(_INSTALLDIR_file2_out)s', r'%(install_file3_out)s'], ['file2.in', r'%(_SUBDIR_file3_in)s']) +# test passing a keyword arg (not used, but should be accepted) +env.InstallAs('install/f1.out', './file1.in', FOO="bar") """ % locals()) test.write('file1.in', "file1.in\n") @@ -59,10 +61,12 @@ test.write(['subdir', 'file3.in'], "subdir/file3.in\n") install_file1_out = os.path.join('install', 'file1.out') install_file2_out = os.path.join('install', 'file2.out') install_file3_out = os.path.join('install', 'file3.out') +install_file1a_out = os.path.join('install', 'f1.out') subdir_file3_in = os.path.join('subdir', 'file3.in') expect = test.wrap_stdout("""\ +Install file: "file1.in" as "install/f1.out" Install file: "file1.in" as "%(install_file1_out)s" Install file: "file2.in" as "%(install_file2_out)s" Install file: "%(subdir_file3_in)s" as "%(install_file3_out)s" @@ -73,6 +77,7 @@ test.run(arguments = '.', stdout=expect) test.fail_test(test.read(install_file1_out) != "file1.in\n") test.fail_test(test.read(install_file2_out) != "file2.in\n") test.fail_test(test.read(install_file3_out) != "subdir/file3.in\n") +test.fail_test(test.read(install_file1a_out) != "file1.in\n") test.up_to_date(arguments = '.') diff --git a/test/Install/wrap-by-attribute.py b/test/Install/wrap-by-attribute.py new file mode 100644 index 0000000..f586618 --- /dev/null +++ b/test/Install/wrap-by-attribute.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" + +Verify that we handle the case where Install() and InstallAs() +Builder instances are saved and then re-used from a different, Clone()d +construction environment, after the .Install() and .InstallAs() methods +are replaced by wrappers that fetch the saved methods from a different +environment. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.subdir('outside', 'sub') + +test.write('SConstruct', """\ +def cat(env, source, target): + target = str(target[0]) + source = map(str, source) + f = open(target, "wb") + for src in source: + f.write(open(src, "rb").read()) + f.close() + +env = Environment(DESTDIR='dest') +env.Append(BUILDERS={'Cat':Builder(action=cat)}) + +env.SconsInternalInstallFunc = env.Install +env.SconsInternalInstallAsFunc = env.InstallAs + +def InstallWithDestDir(dir, source): + return env.SconsInternalInstallFunc('$DESTDIR'+env.Dir(dir).abspath, source) +def InstallAsWithDestDir(target, source): + return env.SconsInternalInstallAsFunc('$DESTDIR'+env.File(target).abspath, source) + +# Add the wrappers directly as attributes. +env.Install = InstallWithDestDir +env.InstallAs = InstallAsWithDestDir + +e1 = env + +t = e1.Cat(target='f1.out', source='f1.in') +e1.Install('export', source=t) +t = e1.Cat(target='f2.out', source='f2.in') +e1.InstallAs('export/f2-new.out', source=t) + +e2 = env.Clone() + +t = e2.Cat(target='f3.out', source='f3.in') +e2.Install('export', source=t) +t = e2.Cat(target='f4.out', source='f4.in') +e2.InstallAs('export/f4-new.out', source=t) + +""") + +test.write('f1.in', "f1.in\n") +test.write('f2.in', "f2.in\n") +test.write('f3.in', "f3.in\n") +test.write('f4.in', "f4.in\n") + +test.run(arguments = '.') + +f1_out = test.workpath('dest') + test.workpath('export', 'f1.out') +f2_new_out = test.workpath('dest') + test.workpath('export', 'f2-new.out') +f3_out = test.workpath('dest') + test.workpath('export', 'f3.out') +f4_new_out = test.workpath('dest') + test.workpath('export', 'f4-new.out') + +test.must_match(f1_out, "f1.in\n") +test.must_match(f2_new_out, "f2.in\n") +test.must_match(f3_out, "f3.in\n") +test.must_match(f4_new_out, "f4.in\n") + +test.up_to_date(arguments = '.') + +test.pass_test() diff --git a/test/Interactive/implicit-BuildDir.py b/test/Interactive/implicit-VariantDir.py index 7b7aa4b..b69264b 100644 --- a/test/Interactive/implicit-BuildDir.py +++ b/test/Interactive/implicit-VariantDir.py @@ -30,8 +30,8 @@ This is a regression test for a bug in earlier versions of the submitted by Adam Simpkins, who created this test case). It tests to make sure that cached state is cleared between files for -nodes in both the build tree and the source tree when BuildDirs are used. -This is needed especially with BuildDirs created with duplicate=0, since +nodes in both the build tree and the source tree when VariantDirs are used. +This is needed especially with VariantDirs created with duplicate=0, since the scanners scan the files in the source tree. Any cached implicit deps must be cleared on the source files. """ @@ -55,7 +55,7 @@ hdr_dir = '#build/include' BUILD_ENV['HDR_DIR'] = hdr_dir BUILD_ENV.Append(CPPPATH = hdr_dir) -BUILD_ENV.BuildDir('build', 'src', duplicate = 0) +BUILD_ENV.VariantDir('build', 'src', duplicate = 0) SConscript('build/SConscript') Command('1', [], Touch('$TARGET')) diff --git a/test/Java/multi-step.py b/test/Java/multi-step.py index 9cac759..cfa6906 100644 --- a/test/Java/multi-step.py +++ b/test/Java/multi-step.py @@ -35,6 +35,7 @@ test = TestSCons.TestSCons() where_javac, java_version = test.java_where_javac() where_javah = test.java_where_javah() +where_java_include=test.java_where_includes() swig = test.where_is('swig') if not swig: @@ -64,6 +65,7 @@ test.subdir(['src'], test.write(['SConstruct'], """\ import os,sys env=Environment(tools = ['default', 'javac', 'javah'], + CPPPATH=%(where_java_include)s, JAVAC = r'%(where_javac)s', JAVAH = r'%(where_javah)s') Export('env') @@ -79,7 +81,7 @@ env.Append(SWIGFLAGS=['-c++','$_CPPINCFLAGS']) env.Append(CPPPATH='.') -env.BuildDir('buildout', 'src', duplicate=0) +env.VariantDir('buildout', 'src', duplicate=0) if sys.platform=='darwin': env.Append(CPPPATH=['/System/Library/Frameworks/JavaVM.framework/Headers']) @@ -110,7 +112,7 @@ test.write(['src', 'HelloApplet', 'Hello.html'], """\ test.write(['src', 'HelloApplet', 'SConscript'], """\ import os Import ("env") -denv=env.Copy() +denv=env.Clone() classes=denv.Java(target='classes',source=['com']) #set correct path for jar denv['JARCHDIR']=os.path.join(denv.Dir('.').get_abspath(),'classes') @@ -165,7 +167,7 @@ public class MyID test.write(['src', 'javah', 'SConscript'], """\ Import('env') -denv=env.Copy() +denv=env.Clone() denv['JARCHDIR']=denv.Dir('.').get_abspath() denv.Jar('myid','MyID.java') denv.JavaH(denv.Dir('.').get_abspath(),'MyID.java') @@ -362,7 +364,7 @@ private: test.write(['src', 'jni', 'SConscript'], """\ Import ("env") -denv=env.Copy() +denv=env.Clone() denv.Append(SWIGFLAGS=['-java']) denv.SharedLibrary('scons',['JniWrapper.cc','Sample.i']) diff --git a/test/Java/swig-dependencies.py b/test/Java/swig-dependencies.py index 5477a2d..cc54180 100644 --- a/test/Java/swig-dependencies.py +++ b/test/Java/swig-dependencies.py @@ -42,6 +42,7 @@ if not swig: where_javac, java_version = test.java_where_javac() where_javah = test.java_where_javah() where_jar = test.java_where_jar() +where_java_include=test.java_where_includes() test.subdir(['foo'], ['java'], @@ -51,6 +52,7 @@ test.write(['SConstruct'], """\ import os env = Environment(ENV = os.environ, + CPPPATH=%(where_java_include)s, JAVAC = r'%(where_javac)s', JAVAH = r'%(where_javah)s') @@ -92,7 +94,7 @@ import os Import('env') # unnecessary? -env = env.Copy() +env = env.Clone() env.Prepend(CPPPATH = ['#foo',]) diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py index 857b6bd..48e47f6 100644 --- a/test/MSVC/msvc.py +++ b/test/MSVC/msvc.py @@ -191,7 +191,7 @@ test.run(program=test.workpath('test.exe'), stdout='2003 test 2\n') test.subdir('src', 'build', 'out') test.write('SConstruct',""" -BuildDir('build', 'src', duplicate=0) +VariantDir('build', 'src', duplicate=0) SConscript('build/SConscript') """) diff --git a/test/MSVC/pdb-BuildDir-path.py b/test/MSVC/pdb-VariantDir-path.py index 223e535..028b2de 100644 --- a/test/MSVC/pdb-BuildDir-path.py +++ b/test/MSVC/pdb-VariantDir-path.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
-Verify that .pdb files get put in a build_dir correctly.
+Verify that .pdb files get put in a variant_dir correctly.
"""
import sys
@@ -47,7 +47,7 @@ env = Environment() env.Append(BINDIR = '#bin')
Export('env')
-SConscript('#src/SConscript', duplicate = 0, build_dir = '#.build')
+SConscript('#src/SConscript', duplicate = 0, variant_dir = '#.build')
""")
test.write(['src', 'SConscript'], """\
diff --git a/test/MSVS/vs-6.0-files.py b/test/MSVS/vs-6.0-files.py index 04e7c93..2863428 100644 --- a/test/MSVS/vs-6.0-files.py +++ b/test/MSVS/vs-6.0-files.py @@ -241,7 +241,7 @@ test.must_not_exist(test.workpath('work1', 'Test.dsw')) test.subdir('work2', ['work2', 'src']) test.write(['work2', 'SConstruct'], """\ -SConscript('src/SConscript', build_dir='build') +SConscript('src/SConscript', variant_dir='build') """) test.write(['work2', 'src', 'SConscript'], SConscript_contents) diff --git a/test/MSVS/vs-7.0-files.py b/test/MSVS/vs-7.0-files.py index aaffd7d..71b16ef 100644 --- a/test/MSVS/vs-7.0-files.py +++ b/test/MSVS/vs-7.0-files.py @@ -222,7 +222,7 @@ os.environ['PYTHON_ROOT'] = '' test.subdir('work2', ['work2', 'src']) test.write(['work2', 'SConstruct'], """\ -SConscript('src/SConscript', build_dir='build') +SConscript('src/SConscript', variant_dir='build') """) test.write(['work2', 'src', 'SConscript'], SConscript_contents) diff --git a/test/MSVS/vs-7.1-files.py b/test/MSVS/vs-7.1-files.py index 98bd9da..e6a5926 100644 --- a/test/MSVS/vs-7.1-files.py +++ b/test/MSVS/vs-7.1-files.py @@ -224,7 +224,7 @@ os.environ['PYTHON_ROOT'] = '' test.subdir('work2', ['work2', 'src']) test.write(['work2', 'SConstruct'], """\ -SConscript('src/SConscript', build_dir='build') +SConscript('src/SConscript', variant_dir='build') """) test.write(['work2', 'src', 'SConscript'], SConscript_contents) diff --git a/test/MSVS/vs-8.0-files.py b/test/MSVS/vs-8.0-files.py index d7aa0d9..7a4fdaa 100644 --- a/test/MSVS/vs-8.0-files.py +++ b/test/MSVS/vs-8.0-files.py @@ -231,7 +231,7 @@ os.environ['PYTHON_ROOT'] = '' test.subdir('work2', ['work2', 'src']) test.write(['work2', 'SConstruct'], """\ -SConscript('src/SConscript', build_dir='build') +SConscript('src/SConscript', variant_dir='build') """) test.write(['work2', 'src', 'SConscript'], SConscript_contents) diff --git a/test/Mkdir.py b/test/Mkdir.py index 00b222b..e6aeadc 100644 --- a/test/Mkdir.py +++ b/test/Mkdir.py @@ -59,13 +59,20 @@ env.Command('f6.out', 'f6.in', [Cat, # directory for another target. env.Command(Dir('hello'), None, [Mkdir('$TARGET')]) env.Command('hello/world', None, [Touch('$TARGET')]) + +# Make sure Mkdir works with a list of arguments +Execute(Mkdir(['d7', Dir('d8')])) """) test.write(['work1', 'f2.in'], "f2.in\n") test.write(['work1', 'f5.in'], "f5.in\n") test.write(['work1', 'f6.in'], "f6.in\n") -expect = test.wrap_stdout(read_str = 'Mkdir("d1")\nMkdir("d1-Dir")\n', +expect = test.wrap_stdout(read_str = """\ +Mkdir("d1") +Mkdir("d1-Dir") +Mkdir(["d7", "d8"]) +""", build_str = """\ cat(["f2.out"], ["f2.in"]) Mkdir("d3") @@ -88,6 +95,8 @@ test.must_not_exist(['work1', 'f5.out']) test.must_not_exist(['work1', 'f6.out']) test.must_not_exist(['work1', 'Mkdir-f6.in']) test.must_not_exist(['work1', 'f6.out-Mkdir']) +test.must_not_exist(['work1', 'd7']) +test.must_not_exist(['work1', 'd8']) test.run(chdir = 'work1') @@ -102,6 +111,8 @@ test.must_exist(['work1', 'Mkdir-f6.in']) test.must_exist(['work1', 'f6.out-Mkdir']) test.must_exist(['work1', 'hello']) test.must_exist(['work1', 'hello/world']) +test.must_exist(['work1', 'd7']) +test.must_exist(['work1', 'd8']) test.write(['work1', 'd1', 'file'], "d1/file\n") test.write(['work1', 'd3', 'file'], "d3/file\n") diff --git a/test/NodeOps.py b/test/NodeOps.py index b23a8d4..d00f726 100644 --- a/test/NodeOps.py +++ b/test/NodeOps.py @@ -27,7 +27,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # This test is used to verify that the Buildability of a set of nodes # is unaffected by various querying operations on those nodes: # -# 1) Calling exists() on a Node (e.g. from find_file) in a BuildDir +# 1) Calling exists() on a Node (e.g. from find_file) in a VariantDir # will cause that node to be duplicated into the builddir. # However, this should *not* occur during a dryrun (-n). When not # performed during a dryrun, this should not affect buildability. @@ -62,7 +62,7 @@ sconstruct = r""" foo = Environment(SHOBJPREFIX='', SHCXXFLAGS = '%(fooflags)s', WINDOWS_INSERT_DEF=1) bar = Environment(SHOBJPREFIX='', SHCXXFLAGS = '%(barflags)s', WINDOWS_INSERT_DEF=1) src = Dir('src') -BuildDir('bld', src, duplicate=1) +VariantDir('bld', src, duplicate=1) Nodes=[] Nodes.extend(foo.SharedObject(target = 'foo%(_obj)s', source = 'prog.cpp')) Nodes.extend(bar.SharedObject(target = 'bar%(_obj)s', source = 'prog.cpp')) @@ -82,11 +82,11 @@ fooMain = foo.Clone(LIBS='foo', LIBPATH='.') foo_obj = fooMain.Object(target='foomain', source='main.c') fooMain.Program(target='fooprog', source=foo_obj) -barMain = bar.Copy(LIBS='bar', LIBPATH='.') +barMain = bar.Clone(LIBS='bar', LIBPATH='.') bar_obj = barMain.Object(target='barmain', source='main.c') barMain.Program(target='barprog', source=bar_obj) -gooMain = foo.Copy(LIBS='goo', LIBPATH='bld') +gooMain = foo.Clone(LIBS='goo', LIBPATH='bld') goo_obj = gooMain.Object(target='goomain', source='main.c') gooMain.Program(target='gooprog', source=goo_obj) """ @@ -138,7 +138,7 @@ def mycopy(env, source, target): open(str(target[0]),'w').write(open(str(source[0]),'r').read()) def exists_test(node): - before = os.path.exists(str(node)) # doesn't exist yet in BuildDir + before = os.path.exists(str(node)) # doesn't exist yet in VariantDir via_node = node.exists() # side effect causes copy from src after = os.path.exists(str(node)) node.is_derived() @@ -146,12 +146,12 @@ def exists_test(node): if GetOption('no_exec'): if (before,via_node,after) != (False,False,False): import sys - sys.stderr.write('BuildDir exists() populated during dryrun!\n') + sys.stderr.write('VariantDir exists() populated during dryrun!\n') sys.exit(-2) else: if (before,via_node,after) != (False,True,True): import sys - sys.stderr.write('BuildDir exists() population did not occur! (%%s:%%s,%%s,%%s)\n'%%(str(node),before,via_node,after)) + sys.stderr.write('VariantDir exists() population did not occur! (%%s:%%s,%%s,%%s)\n'%%(str(node),before,via_node,after)) sys.exit(-2) goo = Environment(CPPFLAGS = '%(fooflags)s') @@ -310,7 +310,7 @@ for name in build_nodes: cleanup_test() -### Next pass: do an up-build from a BuildDir src +### Next pass: do an up-build from a VariantDir src for name in build_nodes: @@ -332,7 +332,7 @@ for name in build_nodes: cleanup_test() -### Next pass: do an up-build from a BuildDir src with Node Ops +### Next pass: do an up-build from a VariantDir src with Node Ops ### side-effects for name in build_nodes: diff --git a/test/Options/ListOption.py b/test/Options/ListOption.py index b6ba306..3a95b8a 100644 --- a/test/Options/ListOption.py +++ b/test/Options/ListOption.py @@ -49,7 +49,8 @@ from SCons.Options import ListOption list_of_libs = Split('x11 gl qt ical') -opts = Options(args=ARGUMENTS) +optsfile = 'scons.options' +opts = Options(optsfile, args=ARGUMENTS) opts.AddOptions( ListOption('shared', 'libraries to build as shared libraries', @@ -59,6 +60,7 @@ opts.AddOptions( ) env = Environment(options=opts) +opts.Save(optsfile, env) Help(opts.GenerateHelpText(env)) print env['shared'] @@ -68,35 +70,45 @@ for x in env['shared']: print x, print print env.subst('$shared') +# Test subst_path() because it's used in $CPPDEFINES expansions. +print env.subst_path('$shared') Default(env.Alias('dummy', None)) """) test.run() -check(['all', '1', 'gl ical qt x11', 'gl ical qt x11']) +check(['all', '1', 'gl ical qt x11', 'gl ical qt x11', + "['gl ical qt x11']"]) + +test.must_match(test.workpath('scons.options'), "shared = 'all'\n") + +check(['all', '1', 'gl ical qt x11', 'gl ical qt x11', + "['gl ical qt x11']"]) test.run(arguments='shared=none') -check(['none', '0', '', '']) +check(['none', '0', '', '', "['']"]) test.run(arguments='shared=') -check(['none', '0', '', '']) +check(['none', '0', '', '', "['']"]) test.run(arguments='shared=x11,ical') -check(['ical,x11', '1', 'ical x11', 'ical x11']) +check(['ical,x11', '1', 'ical x11', 'ical x11', + "['ical x11']"]) test.run(arguments='shared=x11,,ical,,') -check(['ical,x11', '1', 'ical x11', 'ical x11']) +check(['ical,x11', '1', 'ical x11', 'ical x11', + "['ical x11']"]) test.run(arguments='shared=GL') check(['gl', '0', 'gl', 'gl']) test.run(arguments='shared=QT,GL') -check(['gl,qt', '0', 'gl qt', 'gl qt']) +check(['gl,qt', '0', 'gl qt', 'gl qt', "['gl qt']"]) expect_stderr = """ scons: *** Error converting option: shared Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 14) +""" + test.python_file_line(SConstruct_path, 15) test.run(arguments='shared=foo', stderr=expect_stderr, status=2) @@ -105,28 +117,28 @@ test.run(arguments='shared=foo', stderr=expect_stderr, status=2) expect_stderr = """ scons: *** Error converting option: shared Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 14) +""" + test.python_file_line(SConstruct_path, 15) test.run(arguments='shared=foo,ical', stderr=expect_stderr, status=2) expect_stderr = """ scons: *** Error converting option: shared Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 14) +""" + test.python_file_line(SConstruct_path, 15) test.run(arguments='shared=ical,foo', stderr=expect_stderr, status=2) expect_stderr = """ scons: *** Error converting option: shared Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 14) +""" + test.python_file_line(SConstruct_path, 15) test.run(arguments='shared=ical,foo,x11', stderr=expect_stderr, status=2) expect_stderr = """ scons: *** Error converting option: shared Invalid value(s) for option: foo,bar -""" + test.python_file_line(SConstruct_path, 14) +""" + test.python_file_line(SConstruct_path, 15) test.run(arguments='shared=foo,x11,,,bar', stderr=expect_stderr, status=2) diff --git a/test/QT/QTFLAGS.py b/test/QT/QTFLAGS.py index ba08739..5656b08 100644 --- a/test/QT/QTFLAGS.py +++ b/test/QT/QTFLAGS.py @@ -134,12 +134,12 @@ env = Environment(QTDIR = r'%s', QT_UIC = r'%s', %s tools=['default','qt']) -if ARGUMENTS.get('build_dir', 0): +if ARGUMENTS.get('variant_dir', 0): if ARGUMENTS.get('chdir', 0): SConscriptChdir(1) else: SConscriptChdir(0) - BuildDir('build', '.', duplicate=1) + VariantDir('build', '.', duplicate=1) sconscript = Dir('build').File('SConscript') else: sconscript = File('SConscript') diff --git a/test/QT/installed.py b/test/QT/installed.py index d746d9e..25e8b91 100644 --- a/test/QT/installed.py +++ b/test/QT/installed.py @@ -73,7 +73,7 @@ if not conf.CheckLib(env.subst("$QT_LIB"), autoadd=0): if not conf.CheckLib(env.subst("$QT_LIB"), autoadd=0): Exit(0) env = conf.Finish() -BuildDir('bld', '.') +VariantDir('bld', '.') env.Program('bld/test_realqt', ['bld/mocFromCpp.cpp', 'bld/mocFromH.cpp', 'bld/anUiFile.ui', diff --git a/test/QT/moc-from-cpp.py b/test/QT/moc-from-cpp.py index 359a241..1936a72 100644 --- a/test/QT/moc-from-cpp.py +++ b/test/QT/moc-from-cpp.py @@ -81,15 +81,15 @@ test.not_up_to_date(options = '-n', arguments = moc) test.run(options = '-c', arguments = lib_aaa) -test.run(arguments = "build_dir=1 " + test.workpath('build', lib_aaa), +test.run(arguments = "variant_dir=1 " + test.workpath('build', lib_aaa), stderr=TestSCons.noisy_ar, match=TestSCons.match_re_dotall) -test.run(arguments = "build_dir=1 chdir=1 " + test.workpath('build', lib_aaa)) +test.run(arguments = "variant_dir=1 chdir=1 " + test.workpath('build', lib_aaa)) test.must_exist(test.workpath('build', moc)) -test.run(arguments = "build_dir=1 dup=0 " + +test.run(arguments = "variant_dir=1 dup=0 " + test.workpath('build_dup0', lib_aaa), stderr=TestSCons.noisy_ar, match=TestSCons.match_re_dotall) diff --git a/test/QT/moc-from-header.py b/test/QT/moc-from-header.py index 9936490..102facc 100644 --- a/test/QT/moc-from-header.py +++ b/test/QT/moc-from-header.py @@ -85,13 +85,13 @@ test.not_up_to_date(options='-n', arguments = moc) test.run(program = test.workpath(aaa_exe), stdout = 'aaa.h\n') -test.run(arguments = "build_dir=1 " + build_aaa_exe) +test.run(arguments = "variant_dir=1 " + build_aaa_exe) -test.run(arguments = "build_dir=1 chdir=1 " + build_aaa_exe) +test.run(arguments = "variant_dir=1 chdir=1 " + build_aaa_exe) test.must_exist(test.workpath('build', moc)) -test.run(arguments = "build_dir=1 chdir=1 dup=0 " + +test.run(arguments = "variant_dir=1 chdir=1 dup=0 " + test.workpath('build_dup0', aaa_exe) ) test.must_exist(['build_dup0', moc]) diff --git a/test/QT/source-from-ui.py b/test/QT/source-from-ui.py index 9ffe0aa..874285d 100644 --- a/test/QT/source-from-ui.py +++ b/test/QT/source-from-ui.py @@ -115,7 +115,7 @@ test.not_up_to_date(options = '-n', arguments = moc) # clean up test.run(arguments = '-c ' + aaa_dll) -test.run(arguments = "build_dir=1 " + +test.run(arguments = "variant_dir=1 " + test.workpath('build', aaa_dll) ) test.must_exist(test.workpath('build', moc)) @@ -128,7 +128,7 @@ test.must_not_exist(test.workpath(h)) cppContents = test.read(test.workpath('build', cpp)) test.fail_test(string.find(cppContents, '#include "aaa.ui.h"') == -1) -test.run(arguments = "build_dir=1 chdir=1 " + +test.run(arguments = "variant_dir=1 chdir=1 " + test.workpath('build', aaa_dll) ) test.must_exist(test.workpath('build', moc)) @@ -138,7 +138,7 @@ test.must_not_exist(test.workpath(moc)) test.must_not_exist(test.workpath(cpp)) test.must_not_exist(test.workpath(h)) -test.run(arguments = "build_dir=1 chdir=1 dup=0 " + +test.run(arguments = "variant_dir=1 chdir=1 dup=0 " + test.workpath('build_dup0', aaa_dll) ) test.must_exist(test.workpath('build_dup0',moc)) diff --git a/test/Repository/Java.py b/test/Repository/Java.py index 67ef605..e964456 100644 --- a/test/Repository/Java.py +++ b/test/Repository/Java.py @@ -40,6 +40,10 @@ test = TestSCons.TestSCons() where_javac, java_version = test.java_where_javac() where_java = test.java_where_java() +# where_java_home=test.java_where_java_home() +os.environ['JAVA_HOME'] = test.java_where_java_home() + + java = where_java javac = where_javac @@ -105,7 +109,6 @@ test.writable('repository', 0) # test.run(chdir = 'work1', options = opts, arguments = ".") -os.environ['JAVA_HOME'] = '/usr/lib/jvm/java-1.5.0-sun-1.5.0.11' test.run(program = java, arguments = "-cp %s Foo1" % work1_classes, diff --git a/test/Repository/Local.py b/test/Repository/Local.py index 5962095..b7f4e33 100644 --- a/test/Repository/Local.py +++ b/test/Repository/Local.py @@ -58,7 +58,7 @@ env.Build('aaa.out', 'aaa.mid') Local('aaa.out') Export("env") -BuildDir('build', 'src') +VariantDir('build', 'src') SConscript('build/SConscript') """) diff --git a/test/Repository/M4.py b/test/Repository/M4.py index 15d8abb..3178fbb 100644 --- a/test/Repository/M4.py +++ b/test/Repository/M4.py @@ -57,7 +57,7 @@ opts = "-Y " + test.workpath('repository') test.write(['repository', 'SConstruct'], """\ env = Environment(M4 = r'%(_python_)s %(mym4_py)s', tools=['default', 'm4']) env.M4(target = 'aaa.x', source = 'aaa.x.m4') -SConscript('src/SConscript', "env", build_dir="build") +SConscript('src/SConscript', "env", variant_dir="build") """ % locals()) test.write(['repository', 'aaa.x.m4'], """\ diff --git a/test/Repository/BuildDir.py b/test/Repository/VariantDir.py index eaafc09..2766c80 100644 --- a/test/Repository/BuildDir.py +++ b/test/Repository/VariantDir.py @@ -38,8 +38,8 @@ opts = "-Y " + test.workpath('repository') # test.write(['repository', 'SConstruct'], r""" -BuildDir('build0', 'src', duplicate=0) -BuildDir('build1', 'src', duplicate=1) +VariantDir('build0', 'src', duplicate=0) +VariantDir('build1', 'src', duplicate=1) SConscript('build0/SConscript') SConscript('build1/SConscript') """) diff --git a/test/Repository/variants.py b/test/Repository/variants.py index d124431..a85d095 100644 --- a/test/Repository/variants.py +++ b/test/Repository/variants.py @@ -86,7 +86,7 @@ ccflags = { } env1 = Environment(CCFLAGS = default.subst('$CCFLAGS %s' % ccflags[OS]), CPPPATH = build1_os) -BuildDir(build1_os, 'src1') +VariantDir(build1_os, 'src1') SConscript(build1_os + '/SConscript', "env1") SConscript('build2/foo/SConscript') @@ -99,7 +99,7 @@ env1.Program('xxx', ['aaa.c', 'bbb.c', 'main.c']) """) test.write(['repository', 'build2', 'foo', 'SConscript'], r""" -BuildDir('src2', '#src2') +VariantDir('src2', '#src2') default = Environment() env2 = Environment(CCFLAGS = default.subst('$CCFLAGS -DFOO'), @@ -109,7 +109,7 @@ SConscript('src2/xxx/SConscript', "env2") """) test.write(['repository', 'build2', 'bar', 'SConscript'], r""" -BuildDir('src2', '#src2') +VariantDir('src2', '#src2') default = Environment() env2 = Environment(CCFLAGS = default.subst('$CCFLAGS -DBAR'), diff --git a/test/SCONSFLAGS.py b/test/SCONSFLAGS.py index d6e5f91..fd0049c 100644 --- a/test/SCONSFLAGS.py +++ b/test/SCONSFLAGS.py @@ -24,12 +24,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import TestCmd -import TestSCons import os import string -test = TestSCons.TestSCons() +import TestCmd +import TestSCons + +test = TestSCons.TestSCons(match = TestCmd.match_re_dotall) wpath = test.workpath() @@ -46,12 +47,18 @@ Use scons -H for help about command-line options. os.environ['SCONSFLAGS'] = '' -test.run(arguments = '-h', stdout = expect) +test.run(arguments = '-h', + stdout = expect, + stderr = TestSCons.deprecated_python_expr) os.environ['SCONSFLAGS'] = '-h' -test.run(stdout = expect) +test.run(stdout = expect, + stderr = TestSCons.deprecated_python_expr) +# No TestSCons.deprecated_python_expr because the -H option gets +# processed before the SConscript files and therefore before we check +# for the deprecation warning. test.run(arguments = "-H") test.fail_test(string.find(test.stdout(), 'Help text.') >= 0) @@ -59,10 +66,12 @@ test.fail_test(string.find(test.stdout(), '-H, --help-options') == -1) os.environ['SCONSFLAGS'] = '-Z' -test.run(arguments = "-H", status = 2, - stderr = r"""usage: scons [OPTION] [TARGET] ... +expect = r"""usage: scons [OPTION] [TARGET] ... SCons error: no such option: -Z -""") +""" + +test.run(arguments = "-H", status = 2, + stderr = TestSCons.re_escape(expect)) test.pass_test() diff --git a/test/SConscript/src_dir.py b/test/SConscript/src_dir.py index aaf3bcb..6e48e06 100644 --- a/test/SConscript/src_dir.py +++ b/test/SConscript/src_dir.py @@ -46,7 +46,7 @@ env = Environment() for src_dir in ['src','samples']: SConscript('build/glob_build.py', src_dir=src_dir, - build_dir='build/output/'+src_dir, + variant_dir='build/output/'+src_dir, duplicate=0, exports=['env']) """) diff --git a/test/SWIG/SWIGOUTDIR.py b/test/SWIG/SWIGOUTDIR.py index b638a3b..e0f3f25 100644 --- a/test/SWIG/SWIGOUTDIR.py +++ b/test/SWIG/SWIGOUTDIR.py @@ -42,10 +42,15 @@ swig = test.where_is('swig') if not swig: test.skip_test('Can not find installed "swig", skipping test.\n') +where_java_include=test.java_where_includes() +if not where_java_include: + test.skip_test('Can not find installed Java include files, skipping test.\n') test.write(['SConstruct'], """\ -env = Environment(tools = ['default', 'swig']) +env = Environment(tools = ['default', 'swig'], + CPPPATH=%(where_java_include)s, + ) Java_foo_interface = env.SharedLibrary( 'Java_foo_interface', diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py index 58ad0cd..8f122af 100644 --- a/test/SWIG/build-dir.py +++ b/test/SWIG/build-dir.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Make sure SWIG works when a BuildDir (or build_dir) is used. +Make sure SWIG works when a VariantDir (or variant_dir) is used. Test case courtesy Joe Maruszewski. """ @@ -82,7 +82,7 @@ Export("env") # # Build the libraries. # -SConscript("source/SConscript", build_dir = "build") +SConscript("source/SConscript", variant_dir = "build") """ % locals()) test.write(['source', 'SConscript'], """\ diff --git a/test/Scanner/generated.py b/test/Scanner/generated.py index ef91189..eb66fd2 100644 --- a/test/Scanner/generated.py +++ b/test/Scanner/generated.py @@ -77,7 +77,7 @@ e["EXPORT_INCLUDE"] = os.path.join(experimenttop, "export", "include") e["EXPORT_LIB"] = os.path.join(experimenttop, "export", "lib") e["INSTALL_BIN"] = os.path.join(experimenttop, "install", "bin") -build_dir = os.path.join(experimenttop, "tmp-bld-dir") +variant_dir = os.path.join(experimenttop, "tmp-bld-dir") src_dir = os.path.join(experimenttop, "src") env.Append(CPPPATH = [e["EXPORT_INCLUDE"]]) diff --git a/test/SideEffect/build_dir.py b/test/SideEffect/variant_dir.py index d33e3d4..44fbd79 100644 --- a/test/SideEffect/build_dir.py +++ b/test/SideEffect/variant_dir.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify correct operation of SideEffect() when an SConscript() -build_dir is used. +variant_dir is used. """ import os.path @@ -49,7 +49,7 @@ def build(env, source, target): Build = Builder(action=build) env = Environment(BUILDERS={'Build':Build}) Export('env') -SConscript('SConscript', build_dir='build', duplicate=0)""") +SConscript('SConscript', variant_dir='build', duplicate=0)""") test.write('SConscript', """ Import('env') diff --git a/test/TARGET-dir.py b/test/TARGET-dir.py index 09f20f0..7155f93 100644 --- a/test/TARGET-dir.py +++ b/test/TARGET-dir.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test use of ${TARGET.dir} to specify a CPPPATH directory in -combination BuildDirs and a generated .h file. +combination VariantDirs and a generated .h file. """ import TestSCons @@ -51,9 +51,9 @@ def cat(env, source, target): env = Environment(CPPPATH='${TARGET.dir}') env.Append(BUILDERS = {'Cat' : Builder(action=cat)}) Export('env') -BuildDir('build1', 'src') +VariantDir('build1', 'src') SConscript('build1/SConscript') -BuildDir('build2', 'src') +VariantDir('build2', 'src') SConscript('build2/SConscript', duplicate=0) """) diff --git a/test/TEX/auxiliaries.py b/test/TEX/auxiliaries.py index 8df2e79..01d1465 100644 --- a/test/TEX/auxiliaries.py +++ b/test/TEX/auxiliaries.py @@ -59,7 +59,7 @@ env = Environment(tools = ['pdftex', 'dvipdf', 'dvips', 'tex', 'latex'], # Use 'duplicate=1' because LaTeX toolchain does not work properly for # input/output files outside of the current directory -env.BuildDir('$BUILD_DIR', 'docs', duplicate=1) +env.VariantDir('$BUILD_DIR', 'docs', duplicate=1) env.SConscript('$BUILD_DIR/SConscript', exports = ['env']) """) diff --git a/test/TEX/build_dir.py b/test/TEX/variant_dir.py index 4967533..084fb2b 100644 --- a/test/TEX/build_dir.py +++ b/test/TEX/variant_dir.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test creation of a fully-featured TeX document (with bibliography -and index) in a build_dir. +and index) in a variant_dir. Test courtesy Rob Managan. """ @@ -50,7 +50,7 @@ env = Environment(ENV = { 'PATH' : os.environ['PATH'] }, Export(['env']) SConscript(os.path.join('docs', 'SConscript'), - build_dir=os.path.join('mybuild','docs'), + variant_dir=os.path.join('mybuild','docs'), duplicate=1) """) @@ -237,7 +237,7 @@ All done now. test.run(arguments = '.', stderr=None) -# All (?) the files we expect will get created in the build_dir +# All (?) the files we expect will get created in the variant_dir # (mybuild/docs) and not in the srcdir (docs). files = [ 'test.aux', diff --git a/test/TEX/build_dir_dup0.py b/test/TEX/variant_dir_dup0.py index 8035957..c37a13b 100644 --- a/test/TEX/build_dir_dup0.py +++ b/test/TEX/variant_dir_dup0.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test creation of a fully-featured TeX document (with bibliography -and index) in a build_dir. +and index) in a variant_dir. Test courtesy Rob Managan. """ @@ -53,7 +53,7 @@ env = Environment(ENV = { 'PATH' : os.environ['PATH'] }, Export(['env']) SConscript(os.path.join('docs', 'SConscript'), - build_dir=os.path.join('mybuild','docs'), + variant_dir=os.path.join('mybuild','docs'), duplicate=0) """) @@ -233,7 +233,7 @@ All done now. test.run(arguments = '.', stderr=None) -# All (?) the files we expect will get created in the build_dir +# All (?) the files we expect will get created in the variant_dir # (mybuild/docs) and not in the srcdir (docs). files = [ 'test.aux', diff --git a/test/Touch.py b/test/Touch.py index 6ecc3ff..fc7c3f8 100644 --- a/test/Touch.py +++ b/test/Touch.py @@ -52,6 +52,13 @@ env.Command('f5.out', 'f5.in', [Touch("$FILE"), Cat]) env.Command('f6.out', 'f6.in', [Cat, Touch("Touch-$SOURCE"), Touch("$TARGET-Touch")]) + +# Make sure Touch works with a list of arguments +env = Environment() +env.Command('f7.out', 'f7.in', [Cat, + Touch(["Touch-$SOURCE", + "$TARGET-Touch", + File("f8")])]) """) test.write('f1', "f1\n") @@ -59,6 +66,7 @@ test.write('f1-File', "f1-File\n") test.write('f2.in', "f2.in\n") test.write('f5.in', "f5.in\n") test.write('f6.in', "f6.in\n") +test.write('f7.in', "f7.in\n") old_f1_time = os.path.getmtime(test.workpath('f1')) old_f1_File_time = os.path.getmtime(test.workpath('f1-File')) @@ -75,6 +83,8 @@ cat(["f5.out"], ["f5.in"]) cat(["f6.out"], ["f6.in"]) Touch("Touch-f6.in") Touch("f6.out-Touch") +cat(["f7.out"], ["f7.in"]) +Touch(["Touch-f7.in", "f7.out-Touch", "f8"]) """) test.run(options = '-n', arguments = '.', stdout = expect) @@ -92,6 +102,10 @@ test.must_not_exist(test.workpath('f5.out')) test.must_not_exist(test.workpath('f6.out')) test.must_not_exist(test.workpath('Touch-f6.in')) test.must_not_exist(test.workpath('f6.out-Touch')) +test.must_not_exist(test.workpath('f7.out')) +test.must_not_exist(test.workpath('Touch-f7.in')) +test.must_not_exist(test.workpath('f7.out-Touch')) +test.must_not_exist(test.workpath('f8')) test.run() @@ -107,5 +121,9 @@ test.must_match('f5.out', "f5.in\n") test.must_match('f6.out', "f6.in\n") test.must_exist(test.workpath('Touch-f6.in')) test.must_exist(test.workpath('f6.out-Touch')) +test.must_match('f7.out', "f7.in\n") +test.must_exist(test.workpath('Touch-f7.in')) +test.must_exist(test.workpath('f7.out-Touch')) +test.must_exist(test.workpath('f8')) test.pass_test() diff --git a/test/Value.py b/test/Value.py index fd7afb7..72d499e 100644 --- a/test/Value.py +++ b/test/Value.py @@ -38,7 +38,7 @@ test = TestSCons.TestSCons(match=TestCmd.match_re) python = TestSCons.python SConstruct_content = """ -SourceSignatures(r'%(source_signature)s') +Decider(r'%(source_signature)s') class Custom: def __init__(self, value): self.value = value @@ -82,7 +82,7 @@ open(sys.argv[-1],'wb').write(string.join(sys.argv[1:-2])) # Run all of the tests with both types of source signature # to make sure there's no difference in behavior. -for source_signature in ['MD5', 'timestamp']: +for source_signature in ['MD5', 'timestamp-newer']: print "Testing Value node with source signatures:", source_signature diff --git a/test/BuildDir/CPPPATH-subdir.py b/test/VariantDir/CPPPATH-subdir.py index 9d3bb98..25ebb40 100644 --- a/test/BuildDir/CPPPATH-subdir.py +++ b/test/VariantDir/CPPPATH-subdir.py @@ -40,7 +40,7 @@ test.subdir('src', ['src', 'glscry']) test.write('SConstruct', """\ env = Environment() Export('env') -SConscript(dirs=['src'], build_dir='build', duplicate=0) +SConscript(dirs=['src'], variant_dir='build', duplicate=0) """) diff --git a/test/BuildDir/Clean.py b/test/VariantDir/Clean.py index f4a8c48..3f065e5 100644 --- a/test/BuildDir/Clean.py +++ b/test/VariantDir/Clean.py @@ -25,10 +25,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that we can Clean() files in a BuildDir() that's underneath us. +Verify that we can Clean() files in a VariantDir() that's underneath us. (At one point this didn't work because we were using str() instead of abspath to remove the files, which would interfere with the removal by -returning a path relative to the BuildDir(), not the top-level SConstruct +returning a path relative to the VariantDir(), not the top-level SConstruct directory, if the source directory was the top-level directory.) """ @@ -37,8 +37,8 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -BuildDir('build0', '.', duplicate=0) -BuildDir('build1', '.', duplicate=1) +VariantDir('build0', '.', duplicate=0) +VariantDir('build1', '.', duplicate=1) def build_sample(target, source, env): targetdir = str(target[0].dir) diff --git a/test/BuildDir/File-create.py b/test/VariantDir/File-create.py index 0a838be..ea4e61b 100644 --- a/test/BuildDir/File-create.py +++ b/test/VariantDir/File-create.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that explicit use of File() Nodes in a BuildDir, followed by +Verify that explicit use of File() Nodes in a VariantDir, followed by *direct* creation of the file by Python in the SConscript file itself, works correctly, with both duplicate=0 and duplicate=1. @@ -42,8 +42,8 @@ test = TestSCons.TestSCons() test.subdir('src') test.write('SConstruct', """\ -SConscript('src/SConscript', build_dir='build0', chdir=1, duplicate=0) -SConscript('src/SConscript', build_dir='build1', chdir=1, duplicate=1) +SConscript('src/SConscript', variant_dir='build0', chdir=1, duplicate=0) +SConscript('src/SConscript', variant_dir='build1', chdir=1, duplicate=1) """) test.write(['src', 'SConscript'], """\ diff --git a/test/VariantDir/SConscript-variant_dir.py b/test/VariantDir/SConscript-variant_dir.py new file mode 100644 index 0000000..cba6c2f --- /dev/null +++ b/test/VariantDir/SConscript-variant_dir.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify that specifying a variant_dir argument to SConscript works properly. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +all1 = test.workpath('test', 'build', 'var1', 'all') +all2 = test.workpath('test', 'build', 'var2', 'all') +all3 = test.workpath('test', 'build', 'var3', 'all') +all4 = test.workpath('test', 'build', 'var4', 'all') +all5 = test.workpath('build', 'var5', 'all') +all6 = test.workpath('build', 'var6', 'all') +all7 = test.workpath('build', 'var7', 'all') +all8 = test.workpath('build', 'var8', 'all') +all9 = test.workpath('test', 'build', 'var9', 'src', 'all') + +test.subdir('test') + +test.write(['test', 'SConstruct'], """ +src = Dir('src') +alt = Dir('alt') +var1 = Dir('build/var1') +var2 = Dir('build/var2') +var3 = Dir('build/var3') +var4 = Dir('build/var4') +var5 = Dir('../build/var5') +var6 = Dir('../build/var6') +var7 = Dir('../build/var7') +var8 = Dir('../build/var8') +var9 = Dir('../build/var9') + +def cat(env, source, target): + target = str(target[0]) + source = map(str, source) + f = open(target, "wb") + for src in source: + f.write(open(src, "rb").read()) + f.close() + +env = Environment(BUILDERS={'Cat':Builder(action=cat)}, + BUILD='build') + +Export("env") + +SConscript('src/SConscript', variant_dir=var1) +SConscript('src/SConscript', variant_dir='build/var2', src_dir=src) + +SConscript('src/SConscript', variant_dir='build/var3', duplicate=0) + +#XXX We can't support var4 and var5 yet, because our VariantDir linkage +#XXX is to an entire source directory. We haven't yet generalized our +#XXX infrastructure to be able to take the SConscript file from one source +#XXX directory, but the rest of the files from a different one. +#XXX SConscript('src/SConscript', variant_dir=var4, src_dir=alt, duplicate=0) + +#XXX SConscript('src/SConscript', variant_dir='../build/var5', src_dir='alt') +SConscript('src/SConscript', variant_dir=var6) + +SConscript('src/SConscript', variant_dir=var7, src_dir=src, duplicate=0) +env.SConscript('src/SConscript', variant_dir='../$BUILD/var8', duplicate=0) + +# This tests the fact that if you specify a src_dir that is above +# the dir a SConscript is in, that we do the intuitive thing, i.e., +# we set the path of the SConscript accordingly. The below is +# equivalent to saying: +# +# VariantDir('build/var9', '.') +# SConscript('build/var9/src/SConscript') +SConscript('src/SConscript', variant_dir='build/var9', src_dir='.') +""") + +test.subdir(['test', 'src'], ['test', 'alt']) + +test.write(['test', 'src', 'SConscript'], """ +Import("env") +env.Cat('aaa.out', 'aaa.in') +env.Cat('bbb.out', 'bbb.in') +env.Cat('ccc.out', 'ccc.in') +env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) +""") + +test.write('test/src/aaa.in', "test/src/aaa.in\n") +test.write('test/src/bbb.in', "test/src/bbb.in\n") +test.write('test/src/ccc.in', "test/src/ccc.in\n") + +test.write('test/alt/aaa.in', "test/alt/aaa.in\n") +test.write('test/alt/bbb.in', "test/alt/bbb.in\n") +test.write('test/alt/ccc.in', "test/alt/ccc.in\n") + +test.run(chdir='test', arguments = '. ../build') + +all_src = "test/src/aaa.in\ntest/src/bbb.in\ntest/src/ccc.in\n" +all_alt = "test/alt/aaa.in\ntest/alt/bbb.in\ntest/alt/ccc.in\n" + +test.must_match(all1, all_src) +test.must_match(all2, all_src) +test.must_match(all3, all_src) +#XXX We can't support var4 and var5 yet, because our VariantDir linkage +#XXX is to an entire source directory. We haven't yet generalized our +#XXX infrastructure to be able to take the SConscript file from one source +#XXX directory, but the rest of the files from a different one. +#XXX test.must_match(all4, all_alt) +#XXX test.must_match(all5, all_alt) +test.must_match(all6, all_src) +test.must_match(all7, all_src) +test.must_match(all8, all_src) +test.must_match(all9, all_src) + +import os +import stat +def equal_stats(x,y): + x = os.stat(x) + y = os.stat(y) + return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and + x[stat.ST_MTIME] == y[stat.ST_MTIME]) + +# Make sure we did duplicate the source files in build/var1, +# and that their stats are the same: +for file in ['aaa.in', 'bbb.in', 'ccc.in']: + test.must_exist(test.workpath('test', 'build', 'var1', file)) + test.fail_test(not equal_stats(test.workpath('test', 'build', 'var1', file), + test.workpath('test', 'src', file))) + +# Make sure we did duplicate the source files in build/var2, +# and that their stats are the same: +for file in ['aaa.in', 'bbb.in', 'ccc.in']: + test.must_exist(test.workpath('test', 'build', 'var2', file)) + test.fail_test(not equal_stats(test.workpath('test', 'build', 'var2', file), + test.workpath('test', 'src', file))) + +# Make sure we didn't duplicate the source files in build/var3. +test.must_not_exist(test.workpath('test', 'build', 'var3', 'aaa.in')) +test.must_not_exist(test.workpath('test', 'build', 'var3', 'bbb.in')) +test.must_not_exist(test.workpath('test', 'build', 'var3', 'ccc.in')) + +#XXX We can't support var4 and var5 yet, because our VariantDir linkage +#XXX is to an entire source directory. We haven't yet generalized our +#XXX infrastructure to be able to take the SConscript file from one source +#XXX directory, but the rest of the files from a different one. +#XXX Make sure we didn't duplicate the source files in build/var4. +#XXXtest.must_not_exist(test.workpath('test', 'build', 'var4', 'aaa.in')) +#XXXtest.must_not_exist(test.workpath('test', 'build', 'var4', 'bbb.in')) +#XXXtest.must_not_exist(test.workpath('test', 'build', 'var4', 'ccc.in')) + +#XXX We can't support var4 and var5 yet, because our VariantDir linkage +#XXX is to an entire source directory. We haven't yet generalized our +#XXX infrastructure to be able to take the SConscript file from one source +#XXX directory, but the rest of the files from a different one. +#XXX Make sure we did duplicate the source files in build/var5, +#XXX and that their stats are the same: +#XXXfor file in ['aaa.in', 'bbb.in', 'ccc.in']: +#XXX test.must_exist(test.workpath('build', 'var5', file)) +#XXX test.fail_test(not equal_stats(test.workpath('build', 'var5', file), +#XXX test.workpath('test', 'src', file))) + +# Make sure we did duplicate the source files in build/var6, +# and that their stats are the same: +for file in ['aaa.in', 'bbb.in', 'ccc.in']: + test.must_exist(test.workpath('build', 'var6', file)) + test.fail_test(not equal_stats(test.workpath('build', 'var6', file), + test.workpath('test', 'src', file))) + +# Make sure we didn't duplicate the source files in build/var7. +test.must_not_exist(test.workpath('build', 'var7', 'aaa.in')) +test.must_not_exist(test.workpath('build', 'var7', 'bbb.in')) +test.must_not_exist(test.workpath('build', 'var7', 'ccc.in')) + +# Make sure we didn't duplicate the source files in build/var8. +test.must_not_exist(test.workpath('build', 'var8', 'aaa.in')) +test.must_not_exist(test.workpath('build', 'var8', 'bbb.in')) +test.must_not_exist(test.workpath('build', 'var8', 'ccc.in')) + +################### +test.subdir('test2') + +test.write(['test2', 'SConstruct'], """\ +SConscript('SConscript', variant_dir='Build', src_dir='.', duplicate=0) +""") + +test.write(['test2', 'SConscript'], """\ +env = Environment() +foo_obj = env.Object('foo.c') +env.Program('foo', [foo_obj, 'bar.c']) +""") + +test.write(['test2', 'bar.c'], r""" +#include <stdio.h> +#include <stdlib.h> + +void +bar(void) { + printf("bar.c\n"); +} +""") + +test.write(['test2', 'foo.c'], r""" +#include <stdio.h> +#include <stdlib.h> + +extern void +bar(void); + +int +main(int argc, char *argv[]) { + bar(); + printf("foo.c\n"); +} +""") + +test.run(chdir="test2") + +_obj = TestSCons._obj + +test.must_not_exist(test.workpath('test2', 'foo' + _obj)) +test.must_not_exist(test.workpath('test2', 'bar' + _obj)) +test.must_exist(test.workpath('test2', 'Build', 'foo' + _obj)) +test.must_exist(test.workpath('test2', 'Build', 'bar' + _obj)) + +################### +# Make sure that directories for subsidiary SConscript() calls +# in a variant_dir get created if they don't already exist. +test.subdir('test3') + +test.subdir(['test3', 'src'], ['test3', 'src', '_glscry']) + +test.write(['test3', 'SConstruct'], """\ +SConscript(dirs=['src'], variant_dir='build', duplicate=0) +""") + +test.write(['test3', 'src', 'SConscript'], """\ +SConscript(dirs=['_glscry']) +""") + +test.write(['test3', 'src', '_glscry', 'SConscript'], """\ +""") + +test.write(['test3', 'src', 'file.in'], "file.in\n") + +test.write(['test3', 'src', '_glscry', 'file.in'], "file.in\n") + +test.run(chdir='test3') + + +test.pass_test() diff --git a/test/BuildDir/BuildDir.py b/test/VariantDir/VariantDir.py index f308579..3906cd7 100644 --- a/test/BuildDir/BuildDir.py +++ b/test/VariantDir/VariantDir.py @@ -71,12 +71,12 @@ var6 = Dir('../build/var6') env = Environment(BUILD = 'build', SRC = 'src') -BuildDir('build/var1', src) -BuildDir(var2, src) -BuildDir(var3, src, duplicate=0) -env.BuildDir("$BUILD/var4", "$SRC", duplicate=0) -BuildDir(var5, src, duplicate=0) -BuildDir(var6, src) +VariantDir('build/var1', src) +VariantDir(var2, src) +VariantDir(var3, src, duplicate=0) +env.VariantDir("$BUILD/var4", "$SRC", duplicate=0) +VariantDir(var5, src, duplicate=0) +VariantDir(var6, src) env = Environment(CPPPATH='#src', FORTRANPATH='#src') SConscript('build/var1/SConscript', "env") @@ -356,7 +356,7 @@ test.up_to_date(chdir='work2', arguments='.') # test.write(['work2', 'SConstruct'], """\ env = Environment() -BuildDir('build', '.') +VariantDir('build', '.') Export('env') SConscript('build/SConscript') """) @@ -372,13 +372,13 @@ test.fail_test(not blank_output(test.stderr())) test.run(chdir='work2', arguments='.', stdout=test.wrap_stdout("""\ -scons: building associated BuildDir targets: build +scons: building associated VariantDir targets: build scons: `.' is up to date. """)) test.write( ['work3', 'SConstruct'], """\ SConscriptChdir(0) -BuildDir('build', '.', duplicate=1 ) +VariantDir('build', '.', duplicate=1 ) SConscript( 'build/SConscript' ) """) @@ -397,7 +397,7 @@ test.write( ['work3', 'existing.h'], """\ test.run(chdir='work3', stdout=test.wrap_stdout("""\ -scons: building associated BuildDir targets: build +scons: building associated VariantDir targets: build scons: `.' is up to date. """), stderr="""\ diff --git a/test/BuildDir/errors.py b/test/VariantDir/errors.py index 3954f2b..22a4821 100644 --- a/test/BuildDir/errors.py +++ b/test/VariantDir/errors.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Validate successful handling of errors when duplicating things in -BuildDirs. This is generally when the BuildDir, or something in it, +VariantDirs. This is generally when the VariantDir, or something in it, is read-only. """ @@ -43,7 +43,7 @@ for dir in ['normal', 'ro-dir', 'ro-SConscript', 'ro-src']: test.write([dir, 'SConstruct'], """\ import os.path -BuildDir('build', 'src') +VariantDir('build', 'src') SConscript(os.path.join('build', 'SConscript')) """) @@ -81,7 +81,7 @@ test.run(chdir = 'normal', arguments = ".") test.fail_test(test.read(['normal', 'build', 'file.out']) != "normal/src/file.in\n") -# Verify the error when the BuildDir itself is read-only. Don't bother +# Verify the error when the VariantDir itself is read-only. Don't bother # to test this on Windows, because the ACL (I think) still allows the # owner to create files in the directory even when it's read-only. if sys.platform != 'win32': @@ -94,7 +94,7 @@ if sys.platform != 'win32': status = 2, stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) -# Verify the error when the SConscript file within the BuildDir is +# Verify the error when the SConscript file within the VariantDir is # read-only. Note that we have to make the directory read-only too, # because otherwise our duplication logic will be able to unlink # the read-only SConscript and duplicate the new one. @@ -119,11 +119,11 @@ test.run(chdir = 'ro-SConscript', status = 2, stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) -# Verify the error when the source file within the BuildDir is +# Verify the error when the source file within the VariantDir is # read-only. Note that we have to make the directory read-only too, # because otherwise our duplication logic will be able to unlink the # read-only source file and duplicate the new one. But because we've -# made the BuildDir read-only, we must also create a writable SConscript +# made the VariantDir read-only, we must also create a writable SConscript # file there so it can be duplicated from the source directory. dir = os.path.join('ro-src', 'build') test.subdir(dir) @@ -158,8 +158,8 @@ test.subdir('duplicate', ['duplicate', 'src1'], ['duplicate', 'src2']) duplicate_SConstruct_path = test.workpath('duplicate', 'SConstruct') test.write(duplicate_SConstruct_path, """\ -BuildDir('build', 'src1') -BuildDir('build', 'src2') +VariantDir('build', 'src1') +VariantDir('build', 'src2') """) expect_stderr = """ diff --git a/test/BuildDir/guess-subdir.py b/test/VariantDir/guess-subdir.py index 8523da6..672e157 100644 --- a/test/BuildDir/guess-subdir.py +++ b/test/VariantDir/guess-subdir.py @@ -25,8 +25,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test that the logic that "guesses" the associated BuildDir for a -subdirectory correctly builds targets in the BuildDir subdirectory. +Test that the logic that "guesses" the associated VariantDir for a +subdirectory correctly builds targets in the VariantDir subdirectory. """ import TestSCons @@ -37,7 +37,7 @@ test.subdir(['work'], ['work', 'src']) test.write(['work', 'SConstruct'], """ c_builddir = r'%s' -BuildDir(c_builddir, '.', duplicate=0) +VariantDir(c_builddir, '.', duplicate=0) SConscript(c_builddir + '/SConscript') """ % test.workpath('debug')) diff --git a/test/BuildDir/nested-sconscripts.py b/test/VariantDir/nested-sconscripts.py index f6dd13b..c1d1557 100644 --- a/test/BuildDir/nested-sconscripts.py +++ b/test/VariantDir/nested-sconscripts.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test that nested SConscript files in a BuildDir don't throw +Test that nested SConscript files in a VariantDir don't throw an OSError exception looking for the wrong file. """ @@ -47,7 +47,7 @@ for flavor in ['prod', 'debug']: # In real life, we would modify build_env appropriately here FLAVOR_DIR = BUILD_DIR + '/' + flavor Export('build_env') - BuildDir(FLAVOR_DIR, 'md', duplicate=0) + VariantDir(FLAVOR_DIR, 'md', duplicate=0) SConscript(FLAVOR_DIR + '/SConscript') """) diff --git a/test/BuildDir/reflect.py b/test/VariantDir/reflect.py index 9a25029..8fcca56 100644 --- a/test/BuildDir/reflect.py +++ b/test/VariantDir/reflect.py @@ -25,10 +25,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -This test validates the correct operation of a BuildDir specification -in avoiding reflection: reflection is the case where the build_dir is +This test validates the correct operation of a VariantDir specification +in avoiding reflection: reflection is the case where the variant_dir is located under the corresponding source dir, and trying to use elements -in the build_dir as sources for that same build dir. +in the variant_dir as sources for that same build dir. Test based on bug #1055521 filed by Gary Oberbrunner. """ @@ -58,7 +58,7 @@ env = Environment(CC = r'%(_python_)s mycc.py', INCSUFFIX = '_CNI', CPPPATH='%(cpppath)s') # note no leading '#' Export("env") -SConscript('SConscript', build_dir="dir1/dir2", src_dir=".") +SConscript('SConscript', variant_dir="dir1/dir2", src_dir=".") """ test.write('SConscript', """\ @@ -89,7 +89,7 @@ INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2', 'dir1', 'dir2_CNI')) # The .+ after mycc\\.py below handles /nologo flags from Visual C/C++. expect = test.wrap_stdout("""\ -scons: building associated BuildDir targets: %(targets)s +scons: building associated VariantDir targets: %(targets)s "%(re_python)s" mycc\\.py.* %(INC_CNI)s .+ Compile "%(re_python)s" mylink\\.py .+ @@ -119,7 +119,7 @@ INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2_CNI')) # The .* after mycc\\.py below handles /nologo flags from Visual C/C++. test.run(arguments = '', stdout=test.wrap_stdout("""\ -scons: building associated BuildDir targets: %(targets)s +scons: building associated VariantDir targets: %(targets)s "%(re_python)s" mycc\\.py.* %(INC_CNI)s .+ Compile "%(re_python)s" mylink\\.py .+ diff --git a/test/BuildDir/removed-files.py b/test/VariantDir/removed-files.py index 3f528a3..9f16740 100644 --- a/test/BuildDir/removed-files.py +++ b/test/VariantDir/removed-files.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test BuildDir handling of removal of source files. +Test VariantDir handling of removal of source files. A C++ Program is created and compiled. First, a header is missing. Then the header is added and the compilation should succeed, then the header @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) test.write('SConstruct', """ env = Environment() -env.BuildDir('bin', 'src') +env.VariantDir('bin', 'src') o = env.Object('bin/dep', 'bin/dep.cpp') env.Program('bin/dep', o) """) diff --git a/test/BuildDir/under.py b/test/VariantDir/under.py index 9a3d561..355f2b3 100644 --- a/test/BuildDir/under.py +++ b/test/VariantDir/under.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test various combinations of build_dir when the source directory is, +Test various combinations of variant_dir when the source directory is, or is not, underneath the SConstruct directory. """ @@ -45,7 +45,7 @@ test.write(['work', 'file.in'], "work/file.in\n") test.write(['work', 'sub', 'SConstruct'], """\ -SConscript('../SConscript', build_dir='build1') +SConscript('../SConscript', variant_dir='build1') """) test.run(chdir='work/sub') @@ -55,7 +55,7 @@ test.must_match(['work', 'sub', 'build1', 'file.out'], "work/file.in\n") test.write(['work', 'sub', 'SConstruct'], """ -SConscript('../SConscript', build_dir='../build2') +SConscript('../SConscript', variant_dir='../build2') """) test.run(chdir='work/sub') @@ -65,7 +65,7 @@ test.must_match(['work', 'build2', 'file.out'], "work/file.in\n") test.write(['work', 'sub', 'SConstruct'], """ -SConscript('../SConscript', build_dir='../../build3') +SConscript('../SConscript', variant_dir='../../build3') """) test.run(chdir='work/sub') @@ -75,7 +75,7 @@ test.must_match(['build3', 'file.out'], "work/file.in\n") test.write(['work', 'SConstruct'], """ -SConscript('../other/SConscript', build_dir='build4') +SConscript('../other/SConscript', variant_dir='build4') """) test.write(['other', 'SConscript'], """\ diff --git a/test/emitter.py b/test/emitter.py index ebe230e..a7f6b3f 100644 --- a/test/emitter.py +++ b/test/emitter.py @@ -33,8 +33,8 @@ test = TestSCons.TestSCons() test.subdir('src') test.write('SConstruct',""" -BuildDir('var1', 'src', duplicate=0) -BuildDir('var2', 'src', duplicate=1) +VariantDir('var1', 'src', duplicate=0) +VariantDir('var2', 'src', duplicate=1) SConscript('src/SConscript') SConscript('var1/SConscript') SConscript('var2/SConscript') @@ -67,7 +67,7 @@ test.write(['src', 'g.in'], 'g.in') test.write(['src', 'h.in'], 'h.in') # Do 'src' last so that creation of the emitter files in there doesn't -# interfere with searching for them in the BuildDirs. +# interfere with searching for them in the VariantDirs. test.run(arguments='var2') diff --git a/test/explain/basic.py b/test/explain/basic.py index 3366359..e1e3aec 100644 --- a/test/explain/basic.py +++ b/test/explain/basic.py @@ -39,6 +39,7 @@ test = TestSCons.TestSCons() test.subdir(['src'], ['src', 'subdir']) +subdir_file8 = os.path.join('subdir', 'file8') subdir_file7 = os.path.join('subdir', 'file7') subdir_file7_in = os.path.join('subdir', 'file7.in') @@ -91,9 +92,10 @@ kscan = Scanner(name = 'kfile', skeys = ['.k']) cat = Builder(action = r'%(_python_)s %(cat_py)s $TARGET $SOURCES') +one_cat = Builder( action = r'%(_python_)s %(cat_py)s $TARGET ${SOURCES[0]}') env = Environment() -env.Append(BUILDERS = {'Cat':cat}, +env.Append(BUILDERS = {'Cat':cat, 'OneCat':one_cat}, SCANNERS = kscan) Export("env") @@ -106,7 +108,8 @@ env.InstallAs('../inc/eee', 'eee.in') test.write(['src', 'SConstruct'], SConstruct_contents) -test.write(['src', 'SConscript'], """\ +def WriteInitialTest( valueDict ) : + test.write(['src', 'SConscript'], """\ Import("env") env.Cat('file1', 'file1.in') env.Cat('file2', 'file2.k') @@ -118,7 +121,11 @@ env.Cat('file5', 'file5.k') file6 = env.Cat('file6', 'file6.in') AlwaysBuild(file6) env.Cat('subdir/file7', 'subdir/file7.in') -""" % locals()) +env.OneCat('subdir/file8', ['subdir/file7.in', env.Value(%(test_value)s)] ) +""" % valueDict ) + +test_value = '"first"' +WriteInitialTest( locals() ) test.write(['src', 'aaa'], "aaa 1\n") test.write(['src', 'bbb.k'], """\ @@ -186,6 +193,8 @@ scons: building `file6' because it doesn't exist %(_python_)s %(cat_py)s file6 file6.in scons: building `%(subdir_file7)s' because it doesn't exist %(_python_)s %(cat_py)s %(subdir_file7)s %(subdir_file7_in)s +scons: building `%(subdir_file8)s' because it doesn't exist +%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -217,6 +226,9 @@ test.write(['src', 'yyy'], "yyy 2\n") test.write(['src', 'zzz'], "zzz 2\n") test.write(['src', 'bbb.k'], "bbb.k 2\ninclude ccc\n") +test_value = '"second"' +WriteInitialTest( locals() ) + expect = test.wrap_stdout("""\ scons: rebuilding `file1' because `file1.in' changed %(_python_)s %(cat_py)s file1 file1.in @@ -235,6 +247,10 @@ scons: rebuilding `file5' because `%(inc_bbb_k)s' changed %(_python_)s %(cat_py)s file5 file5.k scons: rebuilding `file6' because AlwaysBuild() is specified %(_python_)s %(cat_py)s file6 file6.in +scons: rebuilding `%(subdir_file8)s' because: + `"'first'"' is no longer a dependency + `'second'' is a new dependency +%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) diff --git a/test/implicit-cache/basic.py b/test/implicit-cache/basic.py index 265f589..d03cd9b 100644 --- a/test/implicit-cache/basic.py +++ b/test/implicit-cache/basic.py @@ -24,6 +24,16 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +""" +Verify basic interactions of the --implicit-cache-* options. + +This test used to set TargetSignatures('build') because we were +relying on the old behavior of non-essential changes in .h files +propagate to cause a rebuilt executable. We now just rely on +the default Decider('content') behavior and only check for the +rebuild of the object file itself when necessary. +""" + import os.path import TestSCons @@ -34,6 +44,7 @@ _obj = TestSCons._obj prog = 'prog' + _exe subdir_prog = os.path.join('subdir', 'prog' + _exe) variant_prog = os.path.join('variant', 'prog' + _exe) +variant_prog_obj = os.path.join('variant', 'prog' + _obj) args = prog + ' ' + subdir_prog + ' ' + variant_prog @@ -41,19 +52,13 @@ test = TestSCons.TestSCons() test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2') -# Set TargetSignatures('build') because a lot of the test below expect -# the old behavior of non-essential changes in .h files will propagate -# and cause the executable file to be re-linked as well (even if the -# object file was rebuilt to the exact same contents as last time). - test.write('SConstruct', """ -TargetSignatures('build') env = Environment(CPPPATH = Split('inc2 include')) obj = env.Object(target='prog', source='subdir/prog.c') env.Program(target='prog', source=obj) SConscript('subdir/SConscript', "env") -BuildDir('variant', 'subdir', 0) +VariantDir('variant', 'subdir', 0) include = Dir('include') env = Environment(CPPPATH=['inc2', include]) SConscript('variant/SConscript', "env") @@ -278,7 +283,7 @@ test.write(['include', 'foo.h'], r""" """) test.not_up_to_date(options = "--implicit-deps-unchanged", - arguments = variant_prog) + arguments = variant_prog_obj) test.write(['include', 'baz.h'], r""" #define BAZ_STRING "include/baz.h 2\n" @@ -287,7 +292,7 @@ test.write(['include', 'baz.h'], r""" test.up_to_date(options = "--implicit-deps-unchanged", arguments = variant_prog) -test.not_up_to_date(arguments = variant_prog) +test.not_up_to_date(arguments = variant_prog_obj) @@ -306,17 +311,17 @@ test.write(['include', 'foo.h'], r""" """) test.not_up_to_date(options = "--implicit-deps-unchanged", - arguments = variant_prog) + arguments = variant_prog_obj) test.write(['include', 'baz.h'], r""" #define BAZ_STRING "include/baz.h 2\n" """) test.up_to_date(options = "--implicit-deps-unchanged", - arguments = variant_prog) + arguments = variant_prog_obj) test.not_up_to_date(options = "--implicit-deps-changed", - arguments = variant_prog) + arguments = variant_prog_obj) diff --git a/test/no-global-dependencies.py b/test/no-global-dependencies.py index 3cdea1b..168a880 100644 --- a/test/no-global-dependencies.py +++ b/test/no-global-dependencies.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test that files are correctly located in the build directory even when +Test that files are correctly located in the variant directory even when Scons does not have a global view of all targets. Sometimes, it might be interesting to not tell scons about every @@ -48,13 +48,13 @@ test.write('SConstruct', """\ opts = Options() opts.AddOptions( BoolOption('view_all_dependencies', 'View all dependencies', True), - BoolOption('duplicate', 'Duplicate sources to build dir', True) + BoolOption('duplicate', 'Duplicate sources to variant dir', True) ) env = Environment(options=opts) Export('env') -SConscript(dirs='.', build_dir='build', duplicate=env['duplicate']) +SConscript(dirs='.', variant_dir='build', duplicate=env['duplicate']) """ % locals()) diff --git a/test/option--U.py b/test/option--U.py index 3b0cc0d..4781d35 100644 --- a/test/option--U.py +++ b/test/option--U.py @@ -52,7 +52,7 @@ Default(env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')) Export('env') SConscript('sub2/SConscript') Default(env.B(target = 'sub3/baz.out', source = 'sub3/baz.in')) -BuildDir('sub2b', 'sub2') +VariantDir('sub2b', 'sub2') SConscript('sub2b/SConscript') Default(env.B(target = 'sub2/xxx.out', source = 'xxx.in')) SConscript('SConscript') diff --git a/test/option--duplicate.py b/test/option--duplicate.py index f589ae0..c8874e7 100644 --- a/test/option--duplicate.py +++ b/test/option--duplicate.py @@ -46,7 +46,7 @@ try: SetOption('duplicate', duplicate) except KeyError: pass -BuildDir('build', '.', duplicate=1) +VariantDir('build', '.', duplicate=1) SConscript('build/SConscript') """) diff --git a/test/option--warn.py b/test/option--warn.py deleted file mode 100644 index 4b81e25..0000000 --- a/test/option--warn.py +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# 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__" - -import os.path -import sys - -import TestSCons -import TestCmd - -test = TestSCons.TestSCons(match = TestCmd.match_re_dotall) - -# How to warn about deprecated features (whenever we have one again). -# -#test.write("SConstruct",""" -#b=Builder(name='b', action='foo') -#""") -# -#test.run(arguments='.', stderr=r""" -#scons: warning: The use of the 'name' parameter to Builder\(\) is deprecated\. -#File "SConstruct", line 2, in \? -#""") -# -#test.run(arguments='--warn=no-deprecated .', stderr='') -# -#test.run(arguments='--warn=no-all .', stderr='') -# -#test.run(arguments='--warn=no-all --warn=deprecated .', stderr=r""" -#scons: warning: The use of the 'name' parameter to Builder\(\) is deprecated\. -#File "SConstruct", line 2, in \? -#""") - - - -test.write("SConstruct", """\ -import SCons.Defaults - -def build(target, source, env): - pass - -env=Environment() -env['BUILDERS']['test'] = Builder(action=build, - source_scanner=SCons.Defaults.ObjSourceScan) -env.test(target='foo', source='foo.c') -""") - -test.write("foo.c",""" -#include "not_there.h" -""") - -test.run(arguments='--warn=dependency .', stderr=r""" -scons: warning: No dependency generated for file: not_there\.h \(included from: foo\.c\) \-\- file not found -""" + TestSCons.file_expr) - -test.run(arguments='--warn=all .', stderr=r""" -scons: warning: No dependency generated for file: not_there\.h \(included from: foo\.c\) \-\- file not found -""" + TestSCons.file_expr) - -test.run(arguments='--warn=all --warn=no-dependency .', stderr="") - -test.run(arguments='--warn=no-dependency --warn=all .', stderr=r""" -scons: warning: No dependency generated for file: not_there\.h \(included from: foo\.c\) \-\- file not found -""" + TestSCons.file_expr) - - - -test.write("SConstruct", """\ -def build(target, source, env): - pass - -env=Environment() -env['BUILDERS']['test'] = Builder(action=build) -env.test(target='foo', source='foo.c') -SConscript('no_such_file') -""") - -test.run(arguments = '--warn=missing-sconscript .', stderr = r""" -scons: warning: Ignoring missing SConscript 'no_such_file' -""" + TestSCons.file_expr) - -test.run(arguments = '--warn=no-missing-sconscript .', stderr = "") - - - -test.write('SConstruct', """ -def build(env, target, source): - file = open(str(target[0]), 'wb') - for s in source: - file.write(open(str(s), 'rb').read()) - -B = Builder(action=build, multi=1) -env = Environment(BUILDERS = { 'B' : B }) -env2 = env.Clone(DIFFERENT_VARIABLE = 'true') -env.B(target = 'file1.out', source = 'file1a.in') -env2.B(target = 'file1.out', source = 'file1b.in') -""") - -test.write('file1a.in', 'file1a.in\n') -test.write('file1b.in', 'file1b.in\n') - -test.run(arguments='file1.out', - stderr=r""" -scons: warning: Two different environments were specified for target file1.out, -\tbut they appear to have the same action: build\(target, source, env\) -""" + TestSCons.file_expr) - -test.must_match('file1.out', "file1a.in\nfile1b.in\n") - -test.run(arguments='--warn=duplicate-environment file1.out', - stderr=r""" -scons: warning: Two different environments were specified for target file1.out, -\tbut they appear to have the same action: build\(target, source, env\) -""" + TestSCons.file_expr) - -test.run(arguments='--warn=no-duplicate-environment file1.out') - - - -test.write('SConstruct', """ -def build(env, target, source): - file = open(str(target[0]), 'wb') - for s in source: - file.write(open(str(s), 'rb').read()) - -B = Builder(action=build, multi=1) -env = Environment(BUILDERS = { 'B' : B }) -env.B(targets = 'file3a.out', source = 'file3a.in') -env.B(target = 'file3b.out', sources = 'file3b.in') -""") - -test.write('file3a.in', 'file3a.in\n') -test.write('file3b.out', 'file3b.out\n') - -test.run(arguments='.', - stderr=r""" -scons: warning: Did you mean to use `(target|source)' instead of `(targets|sources)'\? -""" + TestSCons.file_expr + r""" -scons: warning: Did you mean to use `(target|source)' instead of `(targets|sources)'\? -""" + TestSCons.file_expr) - -test.must_match(['file3a'], 'file3a.in\n') -test.must_match(['file3b'], 'file3b.out\n') - -test.run(arguments='--warn=misleading-keywords .', - stderr=r""" -scons: warning: Did you mean to use `(target|source)' instead of `(targets|sources)'\? -""" + TestSCons.file_expr + r"""\ -scons: warning: Did you mean to use `(target|source)' instead of `(targets|sources)'\? -""" + TestSCons.file_expr) - -test.run(arguments='--warn=no-misleading-keywords .') - - -test.pass_test() diff --git a/test/option-n.py b/test/option-n.py index d1f87f0..dd67d27 100644 --- a/test/option-n.py +++ b/test/option-n.py @@ -30,7 +30,7 @@ This test verifies: conjunction with -c; 3) that files installed by the Install() method don't get installed when -n is used; - 4) that source files don't get duplicated in a BuildDir + 4) that source files don't get duplicated in a VariantDir when -n is used. 5) that Configure calls don't build any files. If a file needs to be built (i.e. is not up-to-date), a ConfigureError @@ -67,7 +67,7 @@ env.Tool('install') env.MyBuild(target = 'f1.out', source = 'f1.in') env.MyBuild(target = 'f2.out', source = 'f2.in') env.Install('install', 'f3.in') -BuildDir('build', 'src', duplicate=1) +VariantDir('build', 'src', duplicate=1) SConscript('build/SConscript', "env") """ % locals()) @@ -150,7 +150,7 @@ test.write('f3.in', "f3.in again\n") test.run(arguments = '-n install', stdout = expect) test.fail_test(not os.path.exists(test.workpath('install', 'f3.in'))) -# Make sure duplicate source files in a BuildDir aren't created +# Make sure duplicate source files in a VariantDir aren't created # when the -n option is used. # First, make sure none of the previous non-dryrun invocations caused diff --git a/test/option-u.py b/test/option-u.py index 439daa2..572433f 100644 --- a/test/option-u.py +++ b/test/option-u.py @@ -57,7 +57,7 @@ Export('env') SConscript('sub2/SConscript') f3 = env.Cat(target = 'sub3/f3.out', source = 'sub3/f3.in') env.Alias('my_alias', f3) -BuildDir('build', 'sub4') +VariantDir('build', 'sub4') SConscript('build/SConscript') """) @@ -119,7 +119,7 @@ test.must_not_exist(test.workpath('sub4', 'dir', 'f4b.out')) test.must_not_exist(test.workpath('build', 'f4a.out')) test.must_not_exist(test.workpath('build', 'dir', 'f4b.out')) -# Verify that we build things in a linked BuildDir. +# Verify that we build things in a linked VariantDir. f4a_in = os.path.join('build', 'f4a.in') f4a_out = os.path.join('build', 'f4a.out') f4b_in = os.path.join('build', 'dir', 'f4b.in') @@ -128,7 +128,7 @@ test.run(chdir = 'sub4', arguments = '-u', stdout = "scons: Entering directory `%s'\n" % test.workpath() + \ test.wrap_stdout("""\ -scons: building associated BuildDir targets: build +scons: building associated VariantDir targets: build cat(["%s"], ["%s"]) cat(["%s"], ["%s"]) scons: `sub4' is up to date. diff --git a/test/option/debug-memoizer.py b/test/option/debug-memoizer.py index ad35b5d..7d984de 100644 --- a/test/option/debug-memoizer.py +++ b/test/option/debug-memoizer.py @@ -34,7 +34,7 @@ import string import TestSCons -test = TestSCons.TestSCons(match = TestSCons.match_re) +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) # Find out if we support metaclasses (Python 2.2 and later). diff --git a/test/option/warn-dependency.py b/test/option/warn-dependency.py new file mode 100644 index 0000000..b849bed --- /dev/null +++ b/test/option/warn-dependency.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify use of the --warn=dependency option. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + + + +test.write("SConstruct", """\ +import SCons.Defaults + +def build(target, source, env): + pass + +env=Environment() +env['BUILDERS']['test'] = Builder(action=build, + source_scanner=SCons.Defaults.ObjSourceScan) +env.test(target='foo', source='foo.c') +""") + +test.write("foo.c",""" +#include "not_there.h" +""") + + + +expect = r""" +scons: warning: No dependency generated for file: not_there\.h \(included from: foo\.c\) \-\- file not found +""" + +test.run(arguments='--warn=dependency .', + stderr=expect + TestSCons.file_expr) + +test.run(arguments='--warn=dependency .', + stderr=expect + TestSCons.file_expr) + +test.run(arguments='--warn=all --warn=no-dependency .', + stderr=TestSCons.deprecated_python_expr) + +test.run(arguments='--warn=no-dependency --warn=all .', + stderr=TestSCons.deprecated_python_expr + expect + TestSCons.file_expr) + + + +test.pass_test() diff --git a/test/option/warn-duplicate-environment.py b/test/option/warn-duplicate-environment.py new file mode 100644 index 0000000..90a7506 --- /dev/null +++ b/test/option/warn-duplicate-environment.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify use of the --warn=duplicate-environment option. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + + + +test.write('SConstruct', """ +def build(env, target, source): + file = open(str(target[0]), 'wb') + for s in source: + file.write(open(str(s), 'rb').read()) + +WARN = ARGUMENTS.get('WARN') +if WARN: + SetOption('warn', WARN) + +B = Builder(action=build, multi=1) +env = Environment(BUILDERS = { 'B' : B }) +env2 = env.Clone(DIFFERENT_VARIABLE = 'true') +env.B(target = 'file1.out', source = 'file1a.in') +env2.B(target = 'file1.out', source = 'file1b.in') +""") + +test.write('file1a.in', 'file1a.in\n') +test.write('file1b.in', 'file1b.in\n') + +expect = r""" +scons: warning: Two different environments were specified for target file1.out, +\tbut they appear to have the same action: build\(target, source, env\) +""" + +test.run(arguments='file1.out', + stderr=expect + TestSCons.file_expr) + +test.must_match('file1.out', "file1a.in\nfile1b.in\n") + +test.run(arguments='--warn=duplicate-environment file1.out', + stderr=expect + TestSCons.file_expr) + +test.run(arguments='--warn=no-duplicate-environment file1.out') + +test.run(arguments='WARN=duplicate-environment file1.out', + stderr=expect + TestSCons.file_expr) + +test.run(arguments='WARN=no-duplicate-environment file1.out', + stderr = TestSCons.deprecated_python_expr) + + + +test.pass_test() diff --git a/test/option/warn-misleading-keywords.py b/test/option/warn-misleading-keywords.py new file mode 100644 index 0000000..f92ccb0 --- /dev/null +++ b/test/option/warn-misleading-keywords.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify use of the --warn=misleading-keywords option. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + + + +test.write('SConstruct', """ +def build(env, target, source): + file = open(str(target[0]), 'wb') + for s in source: + file.write(open(str(s), 'rb').read()) + +WARN = ARGUMENTS.get('WARN') +if WARN: + SetOption('warn', WARN) + +B = Builder(action=build, multi=1) +env = Environment(BUILDERS = { 'B' : B }) +env.B(targets = 'file3a.out', source = 'file3a.in') +env.B(target = 'file3b.out', sources = 'file3b.in') +""") + +test.write('file3a.in', 'file3a.in\n') +test.write('file3b.out', 'file3b.out\n') + +expect = r""" +scons: warning: Did you mean to use `(target|source)' instead of `(targets|sources)'\? +""" + +test.run(arguments='.', + stderr=expect + TestSCons.file_expr + expect + TestSCons.file_expr) + +test.must_match(['file3a'], 'file3a.in\n') +test.must_match(['file3b'], 'file3b.out\n') + +test.run(arguments='--warn=misleading-keywords .', + stderr=expect + TestSCons.file_expr + expect + TestSCons.file_expr) + +test.run(arguments='--warn=no-misleading-keywords .') + +test.run(arguments='WARN=misleading-keywords .', + stderr=expect + TestSCons.file_expr + expect + TestSCons.file_expr) + +test.run(arguments='WARN=no-misleading-keywords .', + stderr = TestSCons.deprecated_python_expr) + + + +test.pass_test() diff --git a/test/option/warn-missing-sconscript.py b/test/option/warn-missing-sconscript.py new file mode 100644 index 0000000..f0aab04 --- /dev/null +++ b/test/option/warn-missing-sconscript.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify use of the --warn=missing-sconscript option. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + + + +test.write("SConstruct", """\ +def build(target, source, env): + pass + +env=Environment() +env['BUILDERS']['test'] = Builder(action=build) +env.test(target='foo', source='foo.c') +WARN = ARGUMENTS.get('WARN') +if WARN: + SetOption('warn', WARN) +SConscript('no_such_file') +""") + +test.write("foo.c",""" +#include "not_there.h" +""") + +test.run(arguments = '--warn=missing-sconscript .', stderr = r""" +scons: warning: Ignoring missing SConscript 'no_such_file' +""" + TestSCons.file_expr) + +test.run(arguments = '--warn=no-missing-sconscript .', stderr = "") + +test.run(arguments = 'WARN=missing-sconscript .', stderr = r""" +scons: warning: Ignoring missing SConscript 'no_such_file' +""" + TestSCons.file_expr) + +test.run(arguments = 'WARN=no-missing-sconscript .', + stderr = TestSCons.deprecated_python_expr) + + + +test.pass_test() diff --git a/test/packaging/use-builddir.py b/test/packaging/use-builddir.py index 50a569a..4d7e887 100644 --- a/test/packaging/use-builddir.py +++ b/test/packaging/use-builddir.py @@ -49,7 +49,7 @@ test.subdir('build') test.write('src/main.c', '') test.write('SConstruct', """ -BuildDir('build', 'src') +VariantDir('build', 'src') env=Environment(tools=['default', 'packaging']) env.Package( NAME = 'libfoo', PACKAGEROOT = 'build/libfoo', @@ -64,7 +64,7 @@ test.run(stderr = None) test.must_exist( 'build/libfoo-1.2.3.zip' ) # TEST: builddir not placed in archive -# XXX: BuildDir should be stripped. +# XXX: VariantDir should be stripped. # test.subdir('src') test.subdir('build') @@ -73,7 +73,7 @@ test.subdir('temp') test.write('src/main.c', '') test.write('SConstruct', """ -BuildDir('build', 'src') +VariantDir('build', 'src') env=Environment(tools=['default', 'packaging']) env.Package( NAME = 'libfoo', VERSION = '1.2.3', diff --git a/test/python-version.py b/test/python-version.py new file mode 100644 index 0000000..a75ccd5 --- /dev/null +++ b/test/python-version.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify the behavior of our check for unsupported or deprecated versions +of Python. +""" + +import os +import re +import string +import sys + +import TestCmd +import TestSCons + +test = TestSCons.TestSCons(match = TestCmd.match_re_dotall) + +test.write('SConstruct', "\n") + +test.write('SetOption-deprecated', "SetOption('warn', 'no-deprecated')\n") + +test.write('SetOption-python', "SetOption('warn', ['no-python-version'])\n") + +if TestSCons.unsupported_python_version(): + + error = "scons: \*\*\* SCons version \S+ does not run under Python version %s." + error = error % re.escape(TestSCons.python_version_string()) + "\n" + test.run(arguments = '-Q', status = 1, stderr = error) + +else: + + if TestSCons.deprecated_python_version(): + + sconsflags = os.environ.get('SCONSFLAGS') + if sconsflags: + sconsflags = string.replace(sconsflags, '--warn=no-python-version', '') + os.environ['SCONSFLAGS'] = sconsflags + + test.run(arguments = '-Q', stderr = TestSCons.deprecated_python_expr) + + else: + + test.run(arguments = '-Q') + + test.run(arguments = '-Q --warn=no-deprecated') + + test.run(arguments = '-f SetOption-deprecated -Q') + + test.run(arguments = '-f SetOption-python -Q') + +test.pass_test() diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py index ab91e87..f575bc8 100644 --- a/test/runtest/baseline/combined.py +++ b/test/runtest/baseline/combined.py @@ -51,7 +51,7 @@ test.write_passing_test(['test', 'pass.py']) # NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both # have spaces at the end. -expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test +expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test --- TEST RESULTS ------------------------------------------------------------- %(test_fail_py)s : FAIL diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py index b61e5da..3a50925 100644 --- a/test/runtest/baseline/fail.py +++ b/test/runtest/baseline/fail.py @@ -38,7 +38,7 @@ test.write_failing_test(['test', 'fail.py']) # NOTE: The "test/fail.py : FAIL" line has spaces at the end. -expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/fail.py +expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/fail.py --- TEST RESULTS ------------------------------------------------------------- test/fail.py : FAIL diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py index 9ef815d..9b1782c 100644 --- a/test/runtest/baseline/no_result.py +++ b/test/runtest/baseline/no_result.py @@ -36,7 +36,7 @@ test.subdir('test') test.write_no_result_test(['test', 'no_result.py']) -expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/no_result.py +expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/no_result.py --- TEST RESULTS ------------------------------------------------------------- test/no_result.py : NO_RESULT diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py index f574e57..1bc6af1 100644 --- a/test/runtest/baseline/pass.py +++ b/test/runtest/baseline/pass.py @@ -38,7 +38,7 @@ test.write_passing_test(['test', 'pass.py']) # NOTE: The "test/pass.py : PASS" line has spaces at the end. -expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/pass.py +expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/pass.py --- TEST RESULTS ------------------------------------------------------------- test/pass.py : PASS diff --git a/test/runtest/fallback.py b/test/runtest/fallback.py index 8b6ae42..76aebe6 100644 --- a/test/runtest/fallback.py +++ b/test/runtest/fallback.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that runtest.py falls back (with a warning) using --noqmtest -if it can't find qmtest.py on the $PATH. +if it can't find qmtest on the $PATH. """ import os @@ -41,14 +41,16 @@ _python_ = TestRuntest._python_ test = TestRuntest.TestRuntest(noqmtest=1) -qmtest_py = test.where_is('qmtest.py') - -if qmtest_py: - dir = os.path.split(qmtest_py)[0] +# qmtest may be in more than one location in your path +while test.where_is('qmtest'): + qmtest=test.where_is('qmtest') + dir = os.path.split(qmtest)[0] path = string.split(os.environ['PATH'], os.pathsep) path.remove(dir) os.environ['PATH'] = string.join(path, os.pathsep) +print "PATH: %s"%os.environ['PATH'] + test.subdir('test') test_pass_py = os.path.join('test', 'pass.py') @@ -92,7 +94,7 @@ NO RESULT from the following test: """ % locals() expect_stderr = """\ -Warning: qmtest.py not found on $PATH, assuming --noqmtest option. +Warning: qmtest not found on $PATH, assuming --noqmtest option. FAILING TEST STDERR NO RESULT TEST STDERR PASSING TEST STDERR diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py index 39bf810..0abfe93 100644 --- a/test/runtest/print_time.py +++ b/test/runtest/print_time.py @@ -52,7 +52,7 @@ test.write_passing_test(['test', 'pass.py']) # NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both # have spaces at the end. -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream\(print_time='1'\)" test +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream\(print_time='1'\)" test --- TEST RESULTS ------------------------------------------------------------- %(test_fail_py)s : FAIL diff --git a/test/runtest/python.py b/test/runtest/python.py index 95b5f0f..aa1af22 100644 --- a/test/runtest/python.py +++ b/test/runtest/python.py @@ -52,7 +52,7 @@ test.write_passing_test(['test', 'pass.py']) # NOTE: The "test/pass.py : PASS" line has spaces at the end. -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" --context python="%(mypython)s" test +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" --context python="%(mypython)s" test --- TEST RESULTS ------------------------------------------------------------- %(test_pass_py)s : PASS diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py index 58d2f27..6bee872 100644 --- a/test/runtest/simple/combined.py +++ b/test/runtest/simple/combined.py @@ -51,7 +51,7 @@ test.write_passing_test(['test', 'pass.py']) # NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both # have spaces at the end. -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test --- TEST RESULTS ------------------------------------------------------------- %(test_fail_py)s : FAIL diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py index ec9f532..1e8e7b6 100644 --- a/test/runtest/simple/fail.py +++ b/test/runtest/simple/fail.py @@ -38,7 +38,7 @@ test.write_failing_test(['test', 'fail.py']) # NOTE: The "test/fail.py : FAIL" line has spaces at the end. -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/fail.py +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/fail.py --- TEST RESULTS ------------------------------------------------------------- test/fail.py : FAIL diff --git a/test/runtest/simple/no_result.py b/test/runtest/simple/no_result.py index 4ec6e78..16499c8 100644 --- a/test/runtest/simple/no_result.py +++ b/test/runtest/simple/no_result.py @@ -36,7 +36,7 @@ test.subdir('test') test.write_no_result_test(['test', 'no_result.py']) -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/no_result.py +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/no_result.py --- TEST RESULTS ------------------------------------------------------------- test/no_result.py : NO_RESULT diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py index c3a8b02..561665a 100644 --- a/test/runtest/simple/pass.py +++ b/test/runtest/simple/pass.py @@ -38,7 +38,7 @@ test.write_passing_test(['test', 'pass.py']) # NOTE: The "test/pass.py : PASS" line has spaces at the end. -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/pass.py +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/pass.py --- TEST RESULTS ------------------------------------------------------------- test/pass.py : PASS diff --git a/test/runtest/src.py b/test/runtest/src.py index 3063a4e..eebdce4 100644 --- a/test/runtest/src.py +++ b/test/runtest/src.py @@ -52,7 +52,7 @@ test.write_passing_test(['src', 'suite', 'passTests.py']) # NOTE: The "test/pass.py : PASS" and "test/passTests.py : PASS" lines # both have spaces at the end. -expect = r"""qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" src +expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" src --- TEST RESULTS ------------------------------------------------------------- %(src_passTests_py)s : PASS diff --git a/test/runtest/testlistfile.py b/test/runtest/testlistfile.py index d738530..0ca822d 100644 --- a/test/runtest/testlistfile.py +++ b/test/runtest/testlistfile.py @@ -55,7 +55,7 @@ test.write('t.txt', """\ # NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both # have spaces at the end. -expect = """qmtest.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" %(test_pass_py)s +expect = """qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" %(test_pass_py)s --- TEST RESULTS ------------------------------------------------------------- %(test_pass_py)s : PASS diff --git a/test/sconsign/ghost-entries.py b/test/sconsign/ghost-entries.py index 45426ad..3fdc9c0 100644 --- a/test/sconsign/ghost-entries.py +++ b/test/sconsign/ghost-entries.py @@ -58,7 +58,7 @@ def cat(target, source, env): env=Environment() Export('env') env['BUILDERS']['Cat']=Builder(action=cat, multi=1) -SConscript('src/SConscript',build_dir='build') +SConscript('src/SConscript',variant_dir='build') """) test.subdir('src') diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py index 27e4867..2690561 100644 --- a/test/sconsign/script/Signatures.py +++ b/test/sconsign/script/Signatures.py @@ -27,8 +27,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that the sconsign script works when using a .sconsign file in each subdirectory (SConsignFile(None)) written with the non-default -SourceSignatures() and TargetSignatures() values (timestamp and content, -respectively). +value of Decider('timestamp-newer'). + +This used to test the non-default combination of +SourceSignatures('timestamp') with TargetSignatures('content'). """ import TestSCons @@ -95,8 +97,7 @@ sys.exit(0) test.write('SConstruct', """ SConsignFile(None) -SourceSignatures('timestamp') -TargetSignatures('content') +Decider('timestamp-newer') env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', CCCOM = r'%(_python_)s fake_cc.py sub2 $TARGET $SOURCE', diff --git a/test/sconsign/script/dblite.py b/test/sconsign/script/dblite.py index 1b359e2..a21ede0 100644 --- a/test/sconsign/script/dblite.py +++ b/test/sconsign/script/dblite.py @@ -48,8 +48,7 @@ sub1_hello_obj = 'sub1/hello.obj' test.write('SConstruct', """ SConsignFile('my_sconsign') -SourceSignatures('timestamp') -TargetSignatures('content') +Decider('timestamp-newer') env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH = ['sub2']) diff --git a/test/srcchange.py b/test/srcchange.py index 7c2e510..0b56442 100644 --- a/test/srcchange.py +++ b/test/srcchange.py @@ -27,6 +27,11 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test changing the C source files based on an always-executed revision extraction and substitution. + +This makes sure we evaluate the content of intermediate files as +expected. We used to configure this explicitly using +TargetSignatures('content') but we now rely on the default behavior +being the equivalent of Decider('content'). """ import os.path @@ -60,7 +65,6 @@ SubRevision = Action(subrevision) env=Environment() content_env=env.Clone() -content_env.TargetSignatures('content') content_env.Command('revision.in', [], '%(_python_)s getrevision > $TARGET') content_env.AlwaysBuild('revision.in') env.Precious('main.c') diff --git a/test/subdivide.py b/test/subdivide.py index 72c7766..64f914a 100644 --- a/test/subdivide.py +++ b/test/subdivide.py @@ -26,8 +26,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that rebuilds do not occur when SConsignFile(None) is used to -put a .sconsign file in each directory, and TargetSignatures('content') -is used to subdivide a dependency tree. +put a .sconsign file in each directory and we subdvide the dependency +tree with subsidiary *SConstruct* files in various subdirectories. + +This depends on using content signatures for evaluation of intermediate +Nodes. We used to configure this explicitly using +TargetSignatures('content'), but we now rely on the default behavior +being the equivalent of Decider('content'). """ import os.path @@ -66,7 +71,6 @@ for s in sys.argv[2:]: test.write('SConstruct', """\ SConsignFile(None) -TargetSignatures('content') env = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', CCCOM = r'%(_python_)s fake_cc.py $TARGET $SOURCES', @@ -77,7 +81,6 @@ env.Object('foo.c') test.write(['src', 'SConstruct'], """\ SConsignFile(None) -TargetSignatures('content') env = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', CCCOM = r'%(_python_)s fake_cc.py $TARGET $SOURCES', diff --git a/test/symlink/BuildDir.py b/test/symlink/VariantDir.py index 6394e0a..a6dd30b 100644 --- a/test/symlink/BuildDir.py +++ b/test/symlink/VariantDir.py @@ -45,7 +45,7 @@ test.subdir('obj', test.write('SConstruct', """ env = Environment() -BuildDir('obj/subdir', 'src') +VariantDir('obj/subdir', 'src') Program('hello', ['obj/subdir/main.c']) """) diff --git a/test/toolpath/BuildDir.py b/test/toolpath/VariantDir.py index a8b8b8a..30f126b 100644 --- a/test/toolpath/BuildDir.py +++ b/test/toolpath/VariantDir.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that toolpath works with BuildDir() for an SConscript. +Verify that toolpath works with VariantDir() for an SConscript. """ import TestSCons @@ -35,7 +35,7 @@ test = TestSCons.TestSCons() test.subdir('subdir', ['subdir', 'src'], ['subdir', 'src', 'tools']) test.write('SConstruct', """\ -BuildDir('build', 'subdir', duplicate=0) +VariantDir('build', 'subdir', duplicate=0) SConscript('build/SConscript') """) @@ -65,7 +65,7 @@ test.must_match(['build', 'src', 'file.out'], "subdir/src/file.in\n") # We should look for the underlying tool in both the build/src/tools # (which doesn't exist) and subdir/src/tools (which still does). If we # don't, the following would fail because the execution directory is -# now relative to the created BuildDir. +# now relative to the created VariantDir. test.run() test.pass_test() |