file.write(open(str(s), 'rb').read()) build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write('SConstruct', """\ B = Builder(action='%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file4.out', source = 'file4a.in', foo=3) env.B(target = 'file4.out', source = 'file4b.in', foo=3) """ % locals()) test.write('file4a.in', 'file4a.in\n') test.write('file4b.in', 'file4b.in\n') expect = (""" scons: warning: Two different environments were specified for target file4.out, \tbut they appear to have the same action: %s build.py .foo .TARGET .SOURCES """ % TestSCons.re_escape(_python_)) + TestSCons.file_expr test.run(arguments='file4.out', stderr=expect) test.must_match('file4.out', "3\nfile4a.in\nfile4b.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re) test.write('SConstruct', """\ def build(env, target, source): for t in target: 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(target = ['file12a.out', 'file12b.out'], source = 'file12a.in') env.B(target = 'file12a.out', source = 'file12b.in') """) test.write('file12a.in', 'file12a.in\n') test.write('file12b.in', 'file12b.in\n') expect = TestSCons.re_escape(""" scons: *** Two different target lists have a target in common: file12a.out (from ['file12a.out', 'file12b.out'] and from ['file12a.out']) """) + TestSCons.file_expr test.run(arguments='file12.out', status=2, stderr=expect) test.pass_test()
cat(["bbb.out"], ["%s"]) sc_cat(["%s"], []) cat(["ccc.out"], ["%s"]) cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) sc_cat(["%s"], []) cat(["ddd.out"], ["%s"]) """ % (os.path.join('sub', 'aaa.in'), os.path.join('sub', 'aaa.in'), os.path.join('sub', 'bbb.in'), os.path.join('sub', 'bbb.in'), os.path.join('sub', 'ccc.in'), os.path.join('sub', 'ccc.in'), os.path.join('sub2', 'ddd.in'), os.path.join('sub2', 'ddd.in')) stdout = TestSCons.re_escape(test.wrap_stdout(read_str = read_str, build_str = build_str)) test.run(arguments = '.', stdout = stdout, stderr = 2*warning) test.must_match(['sub', 'SConscript'], "'sub/sc-SConscript'\n") test.must_match('all', "sub/sc-aaa.in\nsub/sc-bbb.in\nsub/sc-ccc.in\n") test.must_match('ddd.out', "sub2/sc-ddd.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
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 = 'file5.out', source = 'file5a.in') env2.B(target = 'file5.out', source = 'file5b.in') """) test.write('file5a.in', 'file5a.in\n') test.write('file5b.in', 'file5b.in\n') expect = TestSCons.re_escape(""" scons: warning: Two different environments were specified for target file5.out, \tbut they appear to have the same action: build(target, source, env) """) + TestSCons.file_expr test.run(arguments='file5.out', stderr=expect) test.must_match('file5.out', "file5a.in\nfile5b.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "test/Deprecated/SourceSignatures/switch-rebuild.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" """ Test that switching SourceSignature() types no longer causes rebuilds. """ import re import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. """) + TestSCons.file_expr base_sconstruct_contents = """\ SetOption('warn', 'deprecated-source-signatures') SourceSignatures('%s') 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 }) env.B(target = 'switch.out', source = 'switch.in') """ def write_SConstruct(test, sig_type):
#include "Bar.h" #endif """) test.write('Bar.h', """ #ifndef BAR_H #define BAR_H #include "Foo.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 | +-Foo.c | +-Foo.h | +-Bar.h | +-%(CC)s +-Bar.ooo | +-Bar.c | +-Bar.h | +-Foo.h | +-%(CC)s +-%(LINK)s """ % locals()
build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write( 'SConstruct', """\ DefaultEnvironment(tools=[]) B = Builder(action=r'%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(tools=[], BUILDERS = { 'B' : B }) env.B(target = 'file03.out', source = 'file03a.in', foo=1) env.B(target = 'file03.out', source = 'file03b.in', foo=2) """ % locals()) test.write('file03a.in', 'file03a.in\n') test.write('file03b.in', 'file03b.in\n') expect = TestSCons.re_escape(""" scons: *** Two environments with different actions were specified for the same target: file03.out (action 1: %s build.py 1 file03.out file03b.in) (action 2: %s build.py 2 file03.out file03b.in) """ % (sys.executable, sys.executable)) + TestSCons.file_expr test.run(arguments='file03.out', status=2, stderr=expect) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write('SConscript', """ SConscript('DummyScript', build_dir = 'build') """) test.write('DummyScript', """ """) msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" test.deprecated_warning('deprecated-build-dir', msg) warning = '\nscons: warning: ' + TestSCons.re_escape(msg) \ + '\n' + TestSCons.file_expr 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'], """
""" import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re) test.write( 'SConstruct', """\ e1 = Environment() e2 = Environment() e1.Command('out.txt', [], 'echo 1 > $TARGET') e2.Command('out.txt', [], 'echo 2 > $TARGET') """) expect = TestSCons.re_escape(""" scons: *** Two environments with different actions were specified for the same target: out.txt (action 1: echo 1 > out.txt) (action 2: echo 2 > out.txt) """) + TestSCons.file_expr test.run(arguments='out.txt', status=2, stderr=expect) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
for s in source: file.write(open(str(s), 'rb').read()) build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write('SConstruct', """\ B = Builder(action=r'%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file03.out', source = 'file03a.in', foo=1) env.B(target = 'file03.out', source = 'file03b.in', foo=2) """ % locals()) test.write('file03a.in', 'file03a.in\n') test.write('file03b.in', 'file03b.in\n') expect = TestSCons.re_escape(""" scons: *** Two environments with different actions were specified for the same target: file03.out (action 1: %s build.py 1 file03.out file03b.in) (action 2: %s build.py 2 file03.out file03b.in) """ % (sys.executable, sys.executable )) + TestSCons.file_expr test.run(arguments='file03.out', status=2, stderr=expect) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
def build2(env, target, source): build(env, target, source) # Put the names on the Builder objects and in the environment so # the error output should be consistent regardless of Python version # or how we mess with the Builder internals. B = Builder(action=build, multi=1, name='B') C = Builder(action=build2, multi=1, name='C') env = Environment(BUILDERS = { 'B' : B, 'C' : C }) env.B(target = 'file8.out', source = 'file8.in') env.C(target = 'file8.out', source = 'file8.in') """) test.write('file8a.in', 'file8a.in\n') test.write('file8b.in', 'file8b.in\n') expect = TestSCons.re_escape(""" scons: *** Two different builders (B and C) were specified for the same target: file8.out """) + TestSCons.file_expr test.run(arguments='file8.out', status=2, stderr=expect) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
Verify that a builder with "multi" not set generates an error on the second call. """ import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re) 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=0) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file2.out', source = 'file2a.in') env.B(target = 'file2.out', source = 'file2b.in') """) test.write('file2a.in', 'file2a.in\n') test.write('file2b.in', 'file2b.in\n') expect = TestSCons.re_escape(""" scons: *** Multiple ways to build the same target were specified for: file2.out (from ['file2a.in'] and from ['file2b.in']) """) + TestSCons.file_expr test.run(arguments='file2.out', status=2, stderr=expect) test.pass_test()
for s in source: file.write(open(str(s), 'rb').read()) build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write( 'SConstruct', """\ B = Builder(action='%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file4.out', source = 'file4a.in', foo=3) env.B(target = 'file4.out', source = 'file4b.in', foo=3) """ % locals()) test.write('file4a.in', 'file4a.in\n') test.write('file4b.in', 'file4b.in\n') python_expr = string.replace(TestSCons.python, '\\', '\\\\') act = TestSCons.re_escape('"%s" build.py \$foo \$TARGET \$SOURCES' % python_expr) expect = (""" scons: warning: Two different environments were specified for target file4.out, \tbut they appear to have the same action: %s """ % act) + TestSCons.file_expr test.run(arguments='file4.out', stderr=expect) test.must_match('file4.out', "3\nfile4a.in\nfile4b.in\n") test.pass_test()
actions generate an error. """ import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re) test.write('SConstruct', """\ e1 = Environment() e2 = Environment() e1.Command('out.txt', [], 'echo 1 > $TARGET') e2.Command('out.txt', [], 'echo 2 > $TARGET') """,'w') expect = TestSCons.re_escape(""" scons: *** Two environments with different actions were specified for the same target: out.txt (action 1: echo 1 > out.txt) (action 2: echo 2 > out.txt) """) + TestSCons.file_expr test.run(arguments='out.txt', status=2, stderr=expect) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write( 'SConstruct', """\ B = Builder(action=r'%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file4.out', source = 'file4a.in', foo=3) env.B(target = 'file4.out', source = 'file4b.in', foo=3) """ % locals()) test.write('file4a.in', 'file4a.in\n') test.write('file4b.in', 'file4b.in\n') expect = (""" scons: warning: Two different environments were specified for target file4.out, \tbut they appear to have the same action: %s build.py .foo .TARGET .SOURCES """ % TestSCons.re_escape(_python_)) + TestSCons.file_expr test.run(arguments='file4.out', stderr=expect) test.must_match('file4.out', "3\nfile4a.in\nfile4b.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
cat(["bbb.out"], ["bbb.in"]) %(_python_)s my-cvs-co-.py ccc.in cat(["ccc.out"], ["ccc.in"]) cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) %(_python_)s my-cvs-co-.py %(sub_ddd_in)s cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"]) cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-cvs-co-.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) """ % locals() ) stdout = test.wrap_stdout(read_str=read_str, build_str=build_str) test.run(arguments=".", stdout=TestSCons.re_escape(stdout), stderr=warn_cvs + warn_sc) test.must_match("all", "CVS/aaa.in\nchecked-out bbb.in\nCVS/ccc.in\n") test.must_match(["sub", "all"], "CVS/sub/ddd.in\nchecked-out sub/eee.in\nCVS/sub/fff.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConscript', """ SConscript('DummyScript', build_dir = 'build') """) test.write('DummyScript', """ """) msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" test.deprecated_warning('deprecated-build-dir', msg) warning = '\nscons: warning: ' + TestSCons.re_escape(msg) \ + '\n' + TestSCons.file_expr 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'], """
os.environ['SCONSFLAGS'] = '-h' 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.must_not_contain_any_line(test.stdout(), ['Help text.']) test.must_contain_all_lines(test.stdout(), ['-H, --help-options']) os.environ['SCONSFLAGS'] = '-Z' 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() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
cat(["bbb.out"], ["bbb.in"]) Checking out ccc.in from our fake RCS cat(["ccc.out"], ["ccc.in"]) cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) Checking out %(sub_ddd_in)s from our fake RCS cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"]) cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) Checking out %(sub_fff_in)s from our fake RCS cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) """ % locals() stdout = test.wrap_stdout(read_str=read_str, build_str=build_str) test.run(arguments='.', stdout=TestSCons.re_escape(stdout), stderr=warn_rcs + warn_sc) test.must_match('all', "RCS/aaa.in\nchecked-out bbb.in\nRCS/ccc.in\n") test.must_match(['sub', 'all'], "RCS/sub/ddd.in\nchecked-out sub/eee.in\nRCS/sub/fff.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
cat(["sub/fff.out"], ["sub/fff.in"]) cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """ stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) stderr = """\ sub/SConscript 1.1 -> 1.2: 5 lines aaa.in 1.1 -> 1.2: 1 lines ccc.in 1.1 -> 1.2: 1 lines sub/ddd.in 1.1 -> 1.2: 1 lines sub/fff.in 1.1 -> 1.2: 1 lines """ test.run(arguments = '.', stdout = TestSCons.re_escape(stdout), stderr = warn_bk + warn_sc + TestSCons.re_escape(stderr)) test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") test.must_be_writable(test.workpath('work1', 'sub', 'SConscript')) test.must_be_writable(test.workpath('work1', 'aaa.in')) test.must_be_writable(test.workpath('work1', 'ccc.in')) test.must_be_writable(test.workpath('work1', 'sub', 'ddd.in')) test.must_be_writable(test.workpath('work1', 'sub', 'fff.in')) # Test using BitKeeper to fetch from RCS/file,v files. rcs = test.where_is('rcs') ci = test.where_is('ci') if not rcs: print "Could not find RCS,\nskipping sub-test of BitKeeper using RCS files."
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=0) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file2.out', source = 'file2a.in') env.B(target = 'file2.out', source = 'file2b.in') """) test.write('file2a.in', 'file2a.in\n') test.write('file2b.in', 'file2b.in\n') expect = TestSCons.re_escape(""" scons: *** Multiple ways to build the same target were specified for: file2.out (from ['file2a.in'] and from ['file2b.in']) """) + TestSCons.file_expr test.run(arguments='file2.out', status=2, stderr=expect) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
cat(["bbb.out"], ["bbb.in"]) %(_python_)s my-bk-get.py ccc.in cat(["ccc.out"], ["ccc.in"]) cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) %(_python_)s my-bk-get.py %(sub_ddd_in)s cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"]) cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-bk-get.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) """ % locals() stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) test.run(arguments = '.', stdout = TestSCons.re_escape(stdout), stderr = warn_bk + warn_sc) test.must_match('all', "BitKeeper/aaa.in\nchecked-out bbb.in\nBitKeeper/ccc.in\n") test.must_match(['sub', 'all'], "BitKeeper/sub/ddd.in\nchecked-out sub/eee.in\nBitKeeper/sub/fff.in\n") test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End:
file = open(str(target), 'wb') file.write('%s\n'%num) for s in source: file.write(open(str(s), 'rb').read()) build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write('SConstruct', """\ B = Builder(action='%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file4.out', source = 'file4a.in', foo=3) env.B(target = 'file4.out', source = 'file4b.in', foo=3) """ % locals()) test.write('file4a.in', 'file4a.in\n') test.write('file4b.in', 'file4b.in\n') python_expr = string.replace(TestSCons.python, '\\', '\\\\') act = TestSCons.re_escape('"%s" build.py \$foo \$TARGET \$SOURCES' % python_expr) expect = (""" scons: warning: Two different environments were specified for target file4.out, \tbut they appear to have the same action: %s """ % act) + TestSCons.file_expr test.run(arguments='file4.out', stderr=expect) test.must_match('file4.out', "3\nfile4a.in\nfile4b.in\n") test.pass_test()
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify basic interaction of the historic TargetSignatures('build') and TargetSignatures('content') settings, overriding one with the other in specific construction environments. """ import re import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) expect = TestSCons.re_escape(""" scons: warning: The env.TargetSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. """) + TestSCons.file_expr sconstruct_contents = """\ SetOption('warn', 'deprecated-target-signatures') env = Environment() def copy1(env, source, target): open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) def copy2(env, source, target): %s return copy1(env, source, target) env['BUILDERS']['Copy1'] = Builder(action=copy1)
#include "bar.h" #endif """) test.write('bar.h', """ #ifndef BAR_H #define BAR_H #include "foo.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", stderr = stderr) test.must_contain_all_lines(test.stdout(), [dtree1]) dtree2 = """ +-. +-bar.ooo +-foo.ooo
_python_ = TestSCons._python_ test.write('build.py', r"""#!/usr/bin/env python import sys def build(num, target, source): file = open(str(target), 'wb') file.write('%s\n'%num) for s in source: file.write(open(str(s), 'rb').read()) build(sys.argv[1],sys.argv[2],sys.argv[3:]) """) test.write('SConstruct', """\ B = Builder(action='%(_python_)s build.py $foo $TARGET $SOURCES', multi=1) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'file03.out', source = 'file03a.in', foo=1) env.B(target = 'file03.out', source = 'file03b.in', foo=2) """ % locals()) test.write('file03a.in', 'file03a.in\n') test.write('file03b.in', 'file03b.in\n') expect = TestSCons.re_escape(""" scons: *** Two environments with different actions were specified for the same target: file03.out """) + TestSCons.file_expr test.run(arguments='file03.out', status=2, stderr=expect) test.pass_test()
cat(["sub/fff.out"], ["sub/fff.in"]) cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """ stdout = test.wrap_stdout(read_str=read_str, build_str=build_str) stderr = """\ sub/SConscript 1.1 -> 1.2: 5 lines aaa.in 1.1 -> 1.2: 1 lines ccc.in 1.1 -> 1.2: 1 lines sub/ddd.in 1.1 -> 1.2: 1 lines sub/fff.in 1.1 -> 1.2: 1 lines """ test.run(arguments='.', stdout=TestSCons.re_escape(stdout), stderr=warn_bk + warn_sc + TestSCons.re_escape(stderr)) test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") test.must_be_writable(test.workpath('work1', 'sub', 'SConscript')) test.must_be_writable(test.workpath('work1', 'aaa.in')) test.must_be_writable(test.workpath('work1', 'ccc.in')) test.must_be_writable(test.workpath('work1', 'sub', 'ddd.in')) test.must_be_writable(test.workpath('work1', 'sub', 'fff.in')) # Test using BitKeeper to fetch from RCS/file,v files. rcs = test.where_is('rcs') ci = test.where_is('ci') if not rcs:
stderr=TestSCons.deprecated_python_expr) os.environ['SCONSFLAGS'] = '-h' 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.must_not_contain_any_line(test.stdout(), ['Help text.']) test.must_contain_all_lines(test.stdout(), ['-H, --help-options']) os.environ['SCONSFLAGS'] = '-Z' 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() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4: