Commits

eyan committed ca6a60a

Adding target name to output of --debug=time. Fix for Issue 2873

Comments (0)

Files changed (2)

src/engine/SCons/Script/Main.py

             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])

test/option/debug-time.py

 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.
 
 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
 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,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.