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.
24 from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS
26 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
29 Test that the --debug=count option works.
36 test = TestSCons.TestSCons()
41 x = "Python version has no 'weakref' module; skipping tests.\n"
46 test.write('SConstruct', """
47 def cat(target, source, env):
48 open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
49 env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))})
50 env.Cat('file.out', 'file.in')
53 test.write('file.in', "file.in\n")
55 # Just check that object counts for some representative classes
56 # show up in the output.
58 def find_object_count(s, stdout):
59 re_string = '\d+ +\d+ %s' % re.escape(s)
60 return re.search(re_string, stdout)
63 'Action.CommandAction',
64 'Builder.BuilderBase',
72 for args in ['-h --debug=count', '--debug=count']:
73 test.run(arguments = args)
74 stdout = test.stdout()
76 missing = [o for o in objects if find_object_count(o, stdout) is None]
79 print "Missing the following object lines from '%s' output:" % args
80 print "\t", ' '.join(missing)
81 print "STDOUT =========="
86 scons: warning: --debug=count is not supported when running SCons
87 \twith the python -O option or optimized \\(.pyo\\) modules.
88 """ + TestSCons.file_expr
90 test.run(arguments = '--debug=count -h',
91 interpreter = ['python', '-O'],
92 stderr = expect_warning,
93 match = TestSCons.match_re)
100 # indent-tabs-mode:nil
102 # vim: set expandtab tabstop=4 shiftwidth=4: