Measure time spent in tests.

pull/15/head
Jussi Pakkanen 12 years ago
parent 33aaae5cf0
commit a7b5d30dcc
  1. 9
      meson_test.py

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys, subprocess
import sys, subprocess, time
from optparse import OptionParser
parser = OptionParser()
@ -44,15 +44,18 @@ def run_tests(options, datafilename):
if line == '':
continue
cmd = wrap + [line]
starttime = time.time()
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdo, stde) = p.communicate()
endtime = time.time()
duration = endtime - starttime
stdo = stdo.decode()
stde = stde.decode()
if p.returncode != 0:
result_str = 'Test "%s": FAIL' % line
result_str = 'Test "%s": FAIL (%.3f s)' % (line, duration)
else:
result_str = 'Test "%s": OK' % line
result_str = 'Test "%s": OK (%.3f s)' % (line, duration)
print(result_str)
write_log(logfile, line, result_str, stdo, stde)
print('\nFull log written to %s.' % logfilename)

Loading…
Cancel
Save