forked from OSchip/llvm-project
[lit] Move measurement of testing time out of Run.execute
This commit is contained in:
parent
d8f2bff751
commit
bd14bb42f0
|
@ -7,6 +7,7 @@ See lit.pod for more information.
|
|||
import os
|
||||
import platform
|
||||
import sys
|
||||
import time
|
||||
|
||||
import lit.cl_arguments
|
||||
import lit.discovery
|
||||
|
@ -85,7 +86,9 @@ def main(builtin_params = {}):
|
|||
|
||||
opts.numWorkers = min(len(tests), opts.numWorkers)
|
||||
|
||||
elapsed = run_tests(tests, litConfig, opts, numTotalTests)
|
||||
start = time.time()
|
||||
run_tests(tests, litConfig, opts, numTotalTests)
|
||||
elapsed = time.time() - start
|
||||
|
||||
print_summary(tests, elapsed, opts)
|
||||
|
||||
|
@ -192,7 +195,7 @@ def run_tests(tests, litConfig, opts, numTotalTests):
|
|||
|
||||
display.print_header()
|
||||
try:
|
||||
elapsed = execute_in_tmp_dir(run, litConfig)
|
||||
execute_in_tmp_dir(run, litConfig)
|
||||
except KeyboardInterrupt:
|
||||
#TODO(yln): should we attempt to cleanup the progress bar here?
|
||||
sys.exit(2)
|
||||
|
@ -203,7 +206,6 @@ def run_tests(tests, litConfig, opts, numTotalTests):
|
|||
# display.clear()
|
||||
|
||||
display.clear()
|
||||
return elapsed
|
||||
|
||||
def execute_in_tmp_dir(run, litConfig):
|
||||
# Create a temp directory inside the normal temp directory so that we can
|
||||
|
@ -226,7 +228,7 @@ def execute_in_tmp_dir(run, litConfig):
|
|||
# scanning for stale temp directories, and deleting temp directories whose
|
||||
# lit process has died.
|
||||
try:
|
||||
return run.execute()
|
||||
run.execute()
|
||||
finally:
|
||||
if tmp_dir:
|
||||
try:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import multiprocessing
|
||||
import time
|
||||
import os
|
||||
import time
|
||||
|
||||
import lit.Test
|
||||
import lit.util
|
||||
|
@ -51,19 +51,15 @@ class Run(object):
|
|||
# Larger timeouts (one year, positive infinity) don't work on Windows.
|
||||
one_week = 7 * 24 * 60 * 60 # days * hours * minutes * seconds
|
||||
timeout = self.timeout or one_week
|
||||
deadline = time.time() + timeout
|
||||
|
||||
start = time.time()
|
||||
deadline = start + timeout
|
||||
self._execute(deadline)
|
||||
end = time.time()
|
||||
|
||||
# Mark any tests that weren't run as UNRESOLVED.
|
||||
for test in self.tests:
|
||||
if test.result is None:
|
||||
test.setResult(lit.Test.Result(lit.Test.UNRESOLVED, '', 0.0))
|
||||
|
||||
return end - start
|
||||
|
||||
# TODO(yln): as the comment says.. this is racing with the main thread waiting
|
||||
# for results
|
||||
def _process_result(self, test, result):
|
||||
|
|
Loading…
Reference in New Issue