Skip to content

Commit fac9097

Browse files
committed
Disable tool initialization in tests which don't need it
1 parent 4f44a22 commit fac9097

File tree

10 files changed

+320
-319
lines changed

10 files changed

+320
-319
lines changed

test/Actions/addpost-link.py

Lines changed: 75 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,75 @@
1-
#!/usr/bin/env python
2-
#
3-
# __COPYRIGHT__
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining
6-
# a copy of this software and associated documentation files (the
7-
# "Software"), to deal in the Software without restriction, including
8-
# without limitation the rights to use, copy, modify, merge, publish,
9-
# distribute, sublicense, and/or sell copies of the Software, and to
10-
# permit persons to whom the Software is furnished to do so, subject to
11-
# the following conditions:
12-
#
13-
# The above copyright notice and this permission notice shall be included
14-
# in all copies or substantial portions of the Software.
15-
#
16-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17-
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18-
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
#
24-
25-
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26-
27-
"""
28-
Verify that AddPostAction() on a program target doesn't interfere with
29-
linking.
30-
31-
This is a test for fix of Issue 1004, reported by Matt Doar and
32-
packaged by Gary Oberbrunner.
33-
"""
34-
35-
import TestSCons
36-
37-
_python_ = TestSCons._python_
38-
39-
test = TestSCons.TestSCons()
40-
41-
test.dir_fixture('addpost-link-fixture')
42-
43-
test.write('SConstruct', """\
44-
env = Environment()
45-
46-
mylib = env.StaticLibrary('mytest', 'test_lib.c')
47-
48-
myprog = env.Program('test1.c',
49-
LIBPATH = ['.'],
50-
LIBS = ['mytest'],
51-
OBJSUFFIX = '.obj',
52-
PROGSUFFIX = '.exe')
53-
if ARGUMENTS['case']=='2':
54-
AddPostAction(myprog, Action(r'%(_python_)s strip.py ' + myprog[0].get_abspath()))
55-
""" % locals())
56-
57-
test.run(arguments="-Q case=1", stderr=None)
58-
59-
test.run(arguments="-Q -c case=1")
60-
61-
test.must_not_exist('test1.obj')
62-
63-
test.run(arguments="-Q case=2", stderr=None)
64-
65-
expect = 'strip.py: %s' % test.workpath('test1.exe')
66-
test.must_contain_all_lines(test.stdout(), [expect])
67-
68-
test.pass_test()
69-
70-
# Local Variables:
71-
# tab-width:4
72-
# indent-tabs-mode:nil
73-
# End:
74-
# vim: set expandtab tabstop=4 shiftwidth=4:
1+
#!/usr/bin/env python
2+
#
3+
# __COPYRIGHT__
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining
6+
# a copy of this software and associated documentation files (the
7+
# "Software"), to deal in the Software without restriction, including
8+
# without limitation the rights to use, copy, modify, merge, publish,
9+
# distribute, sublicense, and/or sell copies of the Software, and to
10+
# permit persons to whom the Software is furnished to do so, subject to
11+
# the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included
14+
# in all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17+
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
#
24+
25+
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26+
27+
"""
28+
Verify that AddPostAction() on a program target doesn't interfere with
29+
linking.
30+
31+
This is a test for fix of Issue 1004, reported by Matt Doar and
32+
packaged by Gary Oberbrunner.
33+
"""
34+
35+
import TestSCons
36+
37+
_python_ = TestSCons._python_
38+
39+
test = TestSCons.TestSCons()
40+
41+
test.dir_fixture('addpost-link-fixture')
42+
43+
test.write('SConstruct', """\
44+
DefaultEnvironment(tools=[])
45+
env = Environment()
46+
47+
mylib = env.StaticLibrary('mytest', 'test_lib.c')
48+
49+
myprog = env.Program('test1.c',
50+
LIBPATH = ['.'],
51+
LIBS = ['mytest'],
52+
OBJSUFFIX = '.obj',
53+
PROGSUFFIX = '.exe')
54+
if ARGUMENTS['case']=='2':
55+
AddPostAction(myprog, Action(r'%(_python_)s strip.py ' + myprog[0].get_abspath()))
56+
""" % locals())
57+
58+
test.run(arguments="-Q case=1", stderr=None)
59+
60+
test.run(arguments="-Q -c case=1")
61+
62+
test.must_not_exist('test1.obj')
63+
64+
test.run(arguments="-Q case=2", stderr=None)
65+
66+
expect = 'strip.py: %s' % test.workpath('test1.exe')
67+
test.must_contain_all_lines(test.stdout(), [expect])
68+
69+
test.pass_test()
70+
71+
# Local Variables:
72+
# tab-width:4
73+
# indent-tabs-mode:nil
74+
# End:
75+
# vim: set expandtab tabstop=4 shiftwidth=4:

test/Actions/append.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
test.dir_fixture('append-fixture')
4242

4343
test.write('SConstruct', """
44-
44+
DefaultEnvironment(tools=[])
4545
env=Environment()
4646
4747
def before(env, target, source):

test/Actions/exitstatfunc.py

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
#!/usr/bin/env python
2-
#
3-
# __COPYRIGHT__
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining
6-
# a copy of this software and associated documentation files (the
7-
# "Software"), to deal in the Software without restriction, including
8-
# without limitation the rights to use, copy, modify, merge, publish,
9-
# distribute, sublicense, and/or sell copies of the Software, and to
10-
# permit persons to whom the Software is furnished to do so, subject to
11-
# the following conditions:
12-
#
13-
# The above copyright notice and this permission notice shall be included
14-
# in all copies or substantial portions of the Software.
15-
#
16-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17-
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18-
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
#
24-
25-
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26-
27-
"""
28-
Verify that setting exitstatfunc on an Action works as advertised.
29-
"""
30-
31-
import TestSCons
32-
33-
test = TestSCons.TestSCons()
34-
35-
test.write('SConstruct', """\
36-
def always_succeed(s):
37-
# Always return 0, which indicates success.
38-
return 0
39-
40-
def copy_fail(target, source, env):
41-
with open(str(source[0]), 'rb') as infp, open(str(target[0]), 'wb') as f:
42-
f.write(infp.read())
43-
return 2
44-
45-
a = Action(copy_fail, exitstatfunc=always_succeed)
46-
Alias('test1', Command('test1.out', 'test1.in', a))
47-
48-
def fail(target, source, env):
49-
return 2
50-
51-
t2 = Command('test2.out', 'test2.in', Copy('$TARGET', '$SOURCE'))
52-
AddPostAction(t2, Action(fail, exitstatfunc=always_succeed))
53-
Alias('test2', t2)
54-
""")
55-
56-
test.write('test1.in', "test1.in\n")
57-
test.write('test2.in', "test2.in\n")
58-
59-
test.run(arguments = 'test1')
60-
61-
test.must_match('test1.out', "test1.in\n")
62-
63-
test.run(arguments = 'test2')
64-
65-
test.must_match('test2.out', "test2.in\n")
66-
67-
test.pass_test()
68-
69-
# Local Variables:
70-
# tab-width:4
71-
# indent-tabs-mode:nil
72-
# End:
73-
# vim: set expandtab tabstop=4 shiftwidth=4:
1+
#!/usr/bin/env python
2+
#
3+
# MIT License
4+
#
5+
# Copyright The SCons Foundation
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining
8+
# a copy of this software and associated documentation files (the
9+
# "Software"), to deal in the Software without restriction, including
10+
# without limitation the rights to use, copy, modify, merge, publish,
11+
# distribute, sublicense, and/or sell copies of the Software, and to
12+
# permit persons to whom the Software is furnished to do so, subject to
13+
# the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included
16+
# in all copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19+
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25+
26+
"""
27+
Verify that setting exitstatfunc on an Action works as advertised.
28+
"""
29+
30+
import TestSCons
31+
32+
test = TestSCons.TestSCons()
33+
34+
test.write('SConstruct', """\
35+
DefaultEnvironment(tools=[])
36+
def always_succeed(s):
37+
# Always return 0, which indicates success.
38+
return 0
39+
40+
def copy_fail(target, source, env):
41+
with open(str(source[0]), 'rb') as infp, open(str(target[0]), 'wb') as f:
42+
f.write(infp.read())
43+
return 2
44+
45+
a = Action(copy_fail, exitstatfunc=always_succeed)
46+
Alias('test1', Command('test1.out', 'test1.in', a))
47+
48+
def fail(target, source, env):
49+
return 2
50+
51+
t2 = Command('test2.out', 'test2.in', Copy('$TARGET', '$SOURCE'))
52+
AddPostAction(t2, Action(fail, exitstatfunc=always_succeed))
53+
Alias('test2', t2)
54+
""")
55+
56+
test.write('test1.in', "test1.in\n")
57+
test.write('test2.in', "test2.in\n")
58+
59+
test.run(arguments = 'test1')
60+
61+
test.must_match('test1.out', "test1.in\n")
62+
63+
test.run(arguments = 'test2')
64+
65+
test.must_match('test2.out', "test2.in\n")
66+
67+
test.pass_test()
68+
69+
# Local Variables:
70+
# tab-width:4
71+
# indent-tabs-mode:nil
72+
# End:
73+
# vim: set expandtab tabstop=4 shiftwidth=4:

test/Alias/Alias.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
test.write('SConstruct', """
4545
B = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
4646
DefaultEnvironment(tools=[]) # test speedup
47-
env = Environment()
47+
env = Environment(tools=[])
4848
env['BUILDERS']['B'] = B
4949
env.B(target = 'f1.out', source = 'f1.in')
5050
env.B(target = 'f2.out', source = 'f2.in')
@@ -137,7 +137,7 @@
137137
Decider('content')
138138
B = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
139139
DefaultEnvironment(tools=[]) # test speedup
140-
env = Environment()
140+
env = Environment(tools=[])
141141
env['BUILDERS']['B'] = B
142142
env.B(target = 'f1.out', source = 'f1.in')
143143
env.B(target = 'f2.out', source = 'f2.in')

test/Alias/Depends.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
test.write('SConstruct', """
4545
B = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
4646
DefaultEnvironment(tools=[]) # test speedup
47-
env = Environment()
47+
env = Environment(tools=[])
4848
env['BUILDERS']['B'] = B
4949
env.B(target = 'f1.out', source = 'f1.in')
5050
env.B(target = 'f2.out', source = 'f2.in')

0 commit comments

Comments
 (0)