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:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
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.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test that the --debug=count option works.
37 test = TestSCons.TestSCons()
42 x = "Python version has no 'weakref' module; skipping tests.\n"
47 test.write('SConstruct', """
48 def cat(target, source, env):
49 open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
50 env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))})
51 env.Cat('file.out', 'file.in')
54 test.write('file.in', "file.in\n")
56 # Just check that object counts for some representative classes
57 # show up in the output.
59 def find_object_count(s, stdout):
60 re_string = '\d+ +\d+ %s' % re.escape(s)
61 return re.search(re_string, stdout)
64 'Action.CommandAction',
65 'Builder.BuilderBase',
73 for args in ['-h --debug=count', '--debug=count']:
74 test.run(arguments = args)
75 stdout = test.stdout()
77 missing = filter(lambda o: find_object_count(o, stdout) is None, objects)
80 print "Missing the following object lines from '%s' output:" % args
81 print "\t", string.join(missing)
82 print "STDOUT =========="
87 scons: warning: --debug=count is not supported when running SCons
88 \twith the python -O option or optimized \\(.pyo\\) modules.
89 """ + TestSCons.file_expr
91 test.run(arguments = '--debug=count -h',
92 interpreter = ['python', '-O'],
93 stderr = expect_warning,
94 match = TestSCons.match_re)