summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-10-16 18:15:33 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2020-10-16 18:15:33 (GMT)
commit948e8afafe3a0b4c3774aca6a935b20972a9e762 (patch)
treea6799a0c71e822c72e17732e7d95cd1be368bcc8 /testing
parentebd2adbc07dee37d79c31594569964a32dddc615 (diff)
downloadSCons-948e8afafe3a0b4c3774aca6a935b20972a9e762.zip
SCons-948e8afafe3a0b4c3774aca6a935b20972a9e762.tar.gz
SCons-948e8afafe3a0b4c3774aca6a935b20972a9e762.tar.bz2
Add custom up_to_date for TimeSCons to handle individual SConscript timing output during null build run
Diffstat (limited to 'testing')
-rw-r--r--testing/framework/TestSCons.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py
index 6ec63a9..36b9df4 100644
--- a/testing/framework/TestSCons.py
+++ b/testing/framework/TestSCons.py
@@ -1823,7 +1823,11 @@ class TimeSCons(TestSCons):
# TODO(sgk): allow the caller to specify the target (argument)
# that must be up-to-date.
self.add_timing_options(kw)
- self.up_to_date(arguments='.', **kw)
+
+ # Build up regex for
+ # SConscript:/private/var/folders/ng/48pttrpj239fw5rmm3x65pxr0000gn/T/testcmd.12081.pk1bv5i5/SConstruct took 533.646 ms
+ read_str = 'SConscript:.*\n'
+ self.up_to_date(arguments='.', read_str=read_str, **kw)
sys.stdout.write(self.stdout())
stats = self.collect_stats(self.stdout())
# time-commands should always be 0.0 on a null build, because
@@ -1885,6 +1889,27 @@ class TimeSCons(TestSCons):
destination = source.replace(source_dir, dest_dir)
shutil.copy2(source, destination)
+ def up_to_date(self, arguments='.', read_str="", **kw):
+ """Asserts that all of the targets listed in arguments is
+ up to date, but does not make any assumptions on other targets.
+ This function is most useful in conjunction with the -n option.
+ Note: This custom version for timings tests does NOT escape
+ read_str.
+ """
+ s = ""
+ for arg in arguments.split():
+ s = s + "scons: `%s' is up to date.\n" % arg
+ kw['arguments'] = arguments
+ stdout = self.wrap_stdout(read_str="REPLACEME", build_str=s)
+ # Append '.*' so that timing output that comes after the
+ # up-to-date output is okay.
+ stdout = re.escape(stdout) + '.*'
+ stdout = stdout.replace('REPLACEME', read_str)
+ kw['stdout'] = stdout
+ kw['match'] = self.match_re_dotall
+ self.run(**kw)
+
+
# In some environments, $AR will generate a warning message to stderr
# if the library doesn't previously exist and is being created. One