11#!/usr/bin/env python
22#
3- # __COPYRIGHT__
3+ # MIT License
4+ #
5+ # Copyright The SCons Foundation
46#
57# Permission is hereby granted, free of charge, to any person obtaining
68# a copy of this software and associated documentation files (the
2022# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2123# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2224# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23- #
24-
25- __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
2625
27- """
28- Test calling the --debug=memoizer option.
29- """
26+ """Test calling the --debug=memoizer option."""
3027
3128import os
3229
3330import TestSCons
3431
35- test = TestSCons .TestSCons (match = TestSCons .match_re_dotall )
36-
32+ test = TestSCons .TestSCons (match = TestSCons .match_re_dotall )
3733
3834test .write ('SConstruct' , """
39- DefaultEnvironment(tools=[])
4035def cat(target, source, env):
4136 with open(str(target[0]), 'wb') as f, open(str(source[0]), 'rb') as infp:
4237 f.write(infp.read())
38+
39+ DefaultEnvironment(tools=[])
4340env = Environment(tools=[], BUILDERS={'Cat':Builder(action=Action(cat))})
4441env.Cat('file.out', 'file.in')
4542""" )
@@ -51,36 +48,35 @@ def cat(target, source, env):
5148# names in the implementation, so if we change them, we'll have to
5249# change this test...
5350expect = [
54- "Memoizer (memory cache) hits and misses" ,
55- "Base.stat()" ,
51+ # "Memoizer (memory cache) hits and misses",
5652 "Dir.srcdir_list()" ,
53+ "File.stat()" ,
5754 "File.exists()" ,
5855 "Node._children_get()" ,
5956]
6057
61-
62- for args in ['-h --debug=memoizer' , '--debug=memoizer' ]:
63- test .run (arguments = args )
64- test .must_contain_any_line (test .stdout (), expect )
65-
58+ test .run (arguments = '--debug=memoizer' )
59+ test .must_contain_any_line (test .stdout (), expect )
6660test .must_match ('file.out' , "file.in\n " )
67-
68-
69-
7061test .unlink ("file.out" )
7162
63+ # make sure it also works if memoizer is not the only debug flag
64+ test .run (arguments = '--debug=sconscript,memoizer' )
65+ test .must_contain_any_line (test .stdout (), expect )
66+ test .must_match ('file.out' , "file.in\n " )
67+ test .unlink ("file.out" )
7268
69+ # memoization should still report even in help mode
70+ test .run (arguments = '-h --debug=memoizer' )
71+ test .must_contain_any_line (test .stdout (), expect )
72+ test .must_not_exist ("file.out" )
7373
74+ # also try setting in SCONSFLAGS
7475os .environ ['SCONSFLAGS' ] = '--debug=memoizer'
75-
76- test .run (arguments = '' )
77-
76+ test .run (arguments = '.' )
7877test .must_contain_any_line (test .stdout (), expect )
79-
8078test .must_match ('file.out' , "file.in\n " )
8179
82-
83-
8480test .pass_test ()
8581
8682# Local Variables:
0 commit comments