OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 if options.special_command: | 1276 if options.special_command: |
1277 options.special_command += " --test" | 1277 options.special_command += " --test" |
1278 else: | 1278 else: |
1279 options.special_command = "@--test" | 1279 options.special_command = "@--test" |
1280 if options.noprof: | 1280 if options.noprof: |
1281 options.scons_flags.append("prof=off") | 1281 options.scons_flags.append("prof=off") |
1282 options.scons_flags.append("profilingsupport=off") | 1282 options.scons_flags.append("profilingsupport=off") |
1283 return True | 1283 return True |
1284 | 1284 |
1285 | 1285 |
| 1286 def DoSkip(case): |
| 1287 return (SKIP in case.outcomes) or (SLOW in case.outcomes) |
| 1288 |
| 1289 |
1286 REPORT_TEMPLATE = """\ | 1290 REPORT_TEMPLATE = """\ |
1287 Total: %(total)i tests | 1291 Total: %(total)i tests |
1288 * %(skipped)4d tests will be skipped | 1292 * %(skipped)4d tests will be skipped |
| 1293 * %(timeout)4d tests are expected to timeout sometimes |
1289 * %(nocrash)4d tests are expected to be flaky but not crash | 1294 * %(nocrash)4d tests are expected to be flaky but not crash |
1290 * %(pass)4d tests are expected to pass | 1295 * %(pass)4d tests are expected to pass |
1291 * %(fail_ok)4d tests are expected to fail that we won't fix | 1296 * %(fail_ok)4d tests are expected to fail that we won't fix |
1292 * %(fail)4d tests are expected to fail that we should fix\ | 1297 * %(fail)4d tests are expected to fail that we should fix\ |
1293 """ | 1298 """ |
1294 | 1299 |
1295 def PrintReport(cases): | 1300 def PrintReport(cases): |
1296 def IsFlaky(o): | 1301 def IsFlaky(o): |
1297 return (PASS in o) and (FAIL in o) and (not CRASH in o) and (not OKAY in o) | 1302 return (PASS in o) and (FAIL in o) and (not CRASH in o) and (not OKAY in o) |
1298 def IsFailOk(o): | 1303 def IsFailOk(o): |
1299 return (len(o) == 2) and (FAIL in o) and (OKAY in o) | 1304 return (len(o) == 2) and (FAIL in o) and (OKAY in o) |
1300 unskipped = [c for c in cases if not SKIP in c.outcomes] | 1305 unskipped = [c for c in cases if not DoSkip(c)] |
1301 print REPORT_TEMPLATE % { | 1306 print REPORT_TEMPLATE % { |
1302 'total': len(cases), | 1307 'total': len(cases), |
1303 'skipped': len(cases) - len(unskipped), | 1308 'skipped': len(cases) - len(unskipped), |
| 1309 'timeout': len([t for t in unskipped if TIMEOUT in t.outcomes]), |
1304 'nocrash': len([t for t in unskipped if IsFlaky(t.outcomes)]), | 1310 'nocrash': len([t for t in unskipped if IsFlaky(t.outcomes)]), |
1305 'pass': len([t for t in unskipped if list(t.outcomes) == [PASS]]), | 1311 'pass': len([t for t in unskipped if list(t.outcomes) == [PASS]]), |
1306 'fail_ok': len([t for t in unskipped if IsFailOk(t.outcomes)]), | 1312 'fail_ok': len([t for t in unskipped if IsFailOk(t.outcomes)]), |
1307 'fail': len([t for t in unskipped if list(t.outcomes) == [FAIL]]) | 1313 'fail': len([t for t in unskipped if list(t.outcomes) == [FAIL]]) |
1308 } | 1314 } |
1309 | 1315 |
1310 | 1316 |
1311 class Pattern(object): | 1317 class Pattern(object): |
1312 | 1318 |
1313 def __init__(self, pattern): | 1319 def __init__(self, pattern): |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 print "--- begin source: %s ---" % test.GetLabel() | 1471 print "--- begin source: %s ---" % test.GetLabel() |
1466 source = test.GetSource().strip() | 1472 source = test.GetSource().strip() |
1467 print source | 1473 print source |
1468 print "--- end source: %s ---" % test.GetLabel() | 1474 print "--- end source: %s ---" % test.GetLabel() |
1469 return 0 | 1475 return 0 |
1470 | 1476 |
1471 if options.warn_unused: | 1477 if options.warn_unused: |
1472 for rule in globally_unused_rules: | 1478 for rule in globally_unused_rules: |
1473 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]
) | 1479 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]
) |
1474 | 1480 |
| 1481 if not options.isolates: |
| 1482 all_cases = [c for c in all_cases if not c.TestsIsolates()] |
| 1483 |
1475 if options.report: | 1484 if options.report: |
1476 PrintReport(all_cases) | 1485 PrintReport(all_cases) |
1477 | 1486 |
1478 result = None | 1487 result = None |
1479 def DoSkip(case): | |
1480 return SKIP in case.outcomes or SLOW in case.outcomes | |
1481 cases_to_run = [ c for c in all_cases if not DoSkip(c) ] | 1488 cases_to_run = [ c for c in all_cases if not DoSkip(c) ] |
1482 if not options.isolates: | |
1483 cases_to_run = [c for c in cases_to_run if not c.TestsIsolates()] | |
1484 if len(cases_to_run) == 0: | 1489 if len(cases_to_run) == 0: |
1485 print "No tests to run." | 1490 print "No tests to run." |
1486 return 0 | 1491 return 0 |
1487 else: | 1492 else: |
1488 try: | 1493 try: |
1489 start = time.time() | 1494 start = time.time() |
1490 if RunTestCases(cases_to_run, options.progress, options.j): | 1495 if RunTestCases(cases_to_run, options.progress, options.j): |
1491 result = 0 | 1496 result = 0 |
1492 else: | 1497 else: |
1493 result = 1 | 1498 result = 1 |
(...skipping 13 matching lines...) Expand all Loading... |
1507 for entry in timed_tests[:20]: | 1512 for entry in timed_tests[:20]: |
1508 t = FormatTime(entry.duration) | 1513 t = FormatTime(entry.duration) |
1509 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1514 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1510 index += 1 | 1515 index += 1 |
1511 | 1516 |
1512 return result | 1517 return result |
1513 | 1518 |
1514 | 1519 |
1515 if __name__ == '__main__': | 1520 if __name__ == '__main__': |
1516 sys.exit(Main()) | 1521 sys.exit(Main()) |
OLD | NEW |