diff options
author | Mats Wichmann <mats@linux.com> | 2025-02-03 17:07:42 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2025-02-03 17:36:17 (GMT) |
commit | 67bcf240aa066dac269aea402566c21f4641822e (patch) | |
tree | d1b4957aa62cf44d9a026858f7086963bd69cd5d /test | |
parent | 144af4aa23cf1a40467f154b38de1e88eee14d93 (diff) | |
download | SCons-67bcf240aa066dac269aea402566c21f4641822e.zip SCons-67bcf240aa066dac269aea402566c21f4641822e.tar.gz SCons-67bcf240aa066dac269aea402566c21f4641822e.tar.bz2 |
Handle --debug containing memoizer
The memoizer statistics have to be handled specially as they use
conditional decorators, those have to be enabled before any of the
decorated methods are read by Python. This worked if there was exactly
"--debug=memoizer" on the commandline or in SCONSFLAGS, but not if it
was in a multi-value option like "--debug=presub,memoizer".
Handle the up-front-check a little more completely to fix this.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/option/debug-memoizer.py | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/test/option/debug-memoizer.py b/test/option/debug-memoizer.py index 01af561..2425eaa 100644 --- a/test/option/debug-memoizer.py +++ b/test/option/debug-memoizer.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -# __COPYRIGHT__ +# MIT License +# +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,26 +22,21 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -""" -Test calling the --debug=memoizer option. -""" +"""Test calling the --debug=memoizer option.""" import os import TestSCons -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write('SConstruct', """ -DefaultEnvironment(tools=[]) def cat(target, source, env): with open(str(target[0]), 'wb') as f, open(str(source[0]), 'rb') as infp: f.write(infp.read()) + +DefaultEnvironment(tools=[]) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=Action(cat))}) env.Cat('file.out', 'file.in') """) @@ -51,36 +48,35 @@ test.write('file.in', "file.in\n") # names in the implementation, so if we change them, we'll have to # change this test... expect = [ - "Memoizer (memory cache) hits and misses", - "Base.stat()", + # "Memoizer (memory cache) hits and misses", "Dir.srcdir_list()", + "File.stat()", "File.exists()", "Node._children_get()", ] - -for args in ['-h --debug=memoizer', '--debug=memoizer']: - test.run(arguments = args) - test.must_contain_any_line(test.stdout(), expect) - +test.run(arguments='--debug=memoizer') +test.must_contain_any_line(test.stdout(), expect) test.must_match('file.out', "file.in\n") - - - test.unlink("file.out") +# make sure it also works if memoizer is not the only debug flag +test.run(arguments='--debug=sconscript,memoizer') +test.must_contain_any_line(test.stdout(), expect) +test.must_match('file.out', "file.in\n") +test.unlink("file.out") +# memoization should still report even in help mode +test.run(arguments='-h --debug=memoizer') +test.must_contain_any_line(test.stdout(), expect) +test.must_not_exist("file.out") +# also try setting in SCONSFLAGS os.environ['SCONSFLAGS'] = '--debug=memoizer' - -test.run(arguments = '') - +test.run(arguments='.') test.must_contain_any_line(test.stdout(), expect) - test.must_match('file.out', "file.in\n") - - test.pass_test() # Local Variables: |