From c6191773561f41cb4ac4e6149aa84603c1185ff9 Mon Sep 17 00:00:00 2001 From: Edmund Yan Date: Tue, 18 Sep 2012 09:50:35 -0700 Subject: Adding target name to output of --debug=time. Fix for Issue 2873 --- src/engine/SCons/Script/Main.py | 2 +- test/option/debug-time.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index bcb013e..4607e1d 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -187,7 +187,7 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask): finish_time = time.time() last_command_end = finish_time cumulative_command_time = cumulative_command_time+finish_time-start_time - sys.stdout.write("Command execution time: %f seconds\n"%(finish_time-start_time)) + sys.stdout.write("Command execution time:%s:%f seconds\n"%(str(self.node), finish_time-start_time)) def do_failed(self, status=2): _BuildFailures.append(self.exception[1]) diff --git a/test/option/debug-time.py b/test/option/debug-time.py index 324dc28..e5e289b 100644 --- a/test/option/debug-time.py +++ b/test/option/debug-time.py @@ -60,7 +60,7 @@ test.write('f2.in', "f2.in\n") test.write('f3.in', "f3.in\n") test.write('f4.in', "f4.in\n") - +expected_targets = ['f1.out', 'f2.out', 'f3.out', 'f4.out', 'output', '.'] # Before anything else, make sure we get valid --debug=time results # when just running the help option. @@ -108,8 +108,12 @@ complete_time = time.time() - start_time expected_total_time = complete_time - overhead -pattern = r'Command execution time: (\d+\.\d+) seconds' -times = list(map(float, re.findall(pattern, test.stdout()))) +pattern = r'Command execution time:(.*):(\d+\.\d+) seconds' +targets = [] +times = [] +for target,time in re.findall(pattern, test.stdout()): + targets.append(target) + times.append(float(time)) expected_command_time = 0.0 for t in times: expected_command_time += t @@ -125,6 +129,12 @@ command_time = get_command_time(stdout) failures = [] warnings = [] +if targets != expected_targets: + failures.append("""\ +Scons reported the targets of timing information as %(targets)s, +but the actual targets should have been %(expected_targets)s. +""" %locals()) + if not within_tolerance(expected_command_time, command_time, 0.01): failures.append("""\ SCons -j1 reported a total command execution time of %(command_time)s, -- cgit v0.12