| 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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 default=False, action="store_true") | 1174 default=False, action="store_true") |
| 1175 result.add_option("-S", dest="scons_flags", help="Flag to pass through to scon
s", | 1175 result.add_option("-S", dest="scons_flags", help="Flag to pass through to scon
s", |
| 1176 default=[], action="append") | 1176 default=[], action="append") |
| 1177 result.add_option("-p", "--progress", | 1177 result.add_option("-p", "--progress", |
| 1178 help="The style of progress indicator (verbose, dots, color, mono)", | 1178 help="The style of progress indicator (verbose, dots, color, mono)", |
| 1179 choices=PROGRESS_INDICATORS.keys(), default="mono") | 1179 choices=PROGRESS_INDICATORS.keys(), default="mono") |
| 1180 result.add_option("--no-build", help="Don't build requirements", | 1180 result.add_option("--no-build", help="Don't build requirements", |
| 1181 default=False, action="store_true") | 1181 default=False, action="store_true") |
| 1182 result.add_option("--build-only", help="Only build requirements, don't run the
tests", | 1182 result.add_option("--build-only", help="Only build requirements, don't run the
tests", |
| 1183 default=False, action="store_true") | 1183 default=False, action="store_true") |
| 1184 result.add_option("--build-system", help="Build system in use (scons or gyp)", |
| 1185 default='scons') |
| 1184 result.add_option("--report", help="Print a summary of the tests to be run", | 1186 result.add_option("--report", help="Print a summary of the tests to be run", |
| 1185 default=False, action="store_true") | 1187 default=False, action="store_true") |
| 1186 result.add_option("-s", "--suite", help="A test suite", | 1188 result.add_option("-s", "--suite", help="A test suite", |
| 1187 default=[], action="append") | 1189 default=[], action="append") |
| 1188 result.add_option("-t", "--timeout", help="Timeout in seconds", | 1190 result.add_option("-t", "--timeout", help="Timeout in seconds", |
| 1189 default=60, type="int") | 1191 default=60, type="int") |
| 1190 result.add_option("--arch", help='The architecture to run tests for', | 1192 result.add_option("--arch", help='The architecture to run tests for', |
| 1191 default='none') | 1193 default='none') |
| 1192 result.add_option("--snapshot", help="Run the tests with snapshot turned on", | 1194 result.add_option("--snapshot", help="Run the tests with snapshot turned on", |
| 1193 default=False, action="store_true") | 1195 default=False, action="store_true") |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 else: | 1275 else: |
| 1274 options.special_command = "@--crankshaft" | 1276 options.special_command = "@--crankshaft" |
| 1275 if options.shell == "d8": | 1277 if options.shell == "d8": |
| 1276 if options.special_command: | 1278 if options.special_command: |
| 1277 options.special_command += " --test" | 1279 options.special_command += " --test" |
| 1278 else: | 1280 else: |
| 1279 options.special_command = "@--test" | 1281 options.special_command = "@--test" |
| 1280 if options.noprof: | 1282 if options.noprof: |
| 1281 options.scons_flags.append("prof=off") | 1283 options.scons_flags.append("prof=off") |
| 1282 options.scons_flags.append("profilingsupport=off") | 1284 options.scons_flags.append("profilingsupport=off") |
| 1285 if options.build_system == 'gyp': |
| 1286 if options.build_only: |
| 1287 print "--build-only not supported for gyp, please build manually." |
| 1288 options.build_only = False |
| 1283 return True | 1289 return True |
| 1284 | 1290 |
| 1285 | 1291 |
| 1292 def DoSkip(case): |
| 1293 return (SKIP in case.outcomes) or (SLOW in case.outcomes) |
| 1294 |
| 1295 |
| 1286 REPORT_TEMPLATE = """\ | 1296 REPORT_TEMPLATE = """\ |
| 1287 Total: %(total)i tests | 1297 Total: %(total)i tests |
| 1288 * %(skipped)4d tests will be skipped | 1298 * %(skipped)4d tests will be skipped |
| 1299 * %(timeout)4d tests are expected to timeout sometimes |
| 1289 * %(nocrash)4d tests are expected to be flaky but not crash | 1300 * %(nocrash)4d tests are expected to be flaky but not crash |
| 1290 * %(pass)4d tests are expected to pass | 1301 * %(pass)4d tests are expected to pass |
| 1291 * %(fail_ok)4d tests are expected to fail that we won't fix | 1302 * %(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\ | 1303 * %(fail)4d tests are expected to fail that we should fix\ |
| 1293 """ | 1304 """ |
| 1294 | 1305 |
| 1295 def PrintReport(cases): | 1306 def PrintReport(cases): |
| 1296 def IsFlaky(o): | 1307 def IsFlaky(o): |
| 1297 return (PASS in o) and (FAIL in o) and (not CRASH in o) and (not OKAY in o) | 1308 return (PASS in o) and (FAIL in o) and (not CRASH in o) and (not OKAY in o) |
| 1298 def IsFailOk(o): | 1309 def IsFailOk(o): |
| 1299 return (len(o) == 2) and (FAIL in o) and (OKAY in o) | 1310 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] | 1311 unskipped = [c for c in cases if not DoSkip(c)] |
| 1301 print REPORT_TEMPLATE % { | 1312 print REPORT_TEMPLATE % { |
| 1302 'total': len(cases), | 1313 'total': len(cases), |
| 1303 'skipped': len(cases) - len(unskipped), | 1314 'skipped': len(cases) - len(unskipped), |
| 1315 'timeout': len([t for t in unskipped if TIMEOUT in t.outcomes]), |
| 1304 'nocrash': len([t for t in unskipped if IsFlaky(t.outcomes)]), | 1316 'nocrash': len([t for t in unskipped if IsFlaky(t.outcomes)]), |
| 1305 'pass': len([t for t in unskipped if list(t.outcomes) == [PASS]]), | 1317 '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)]), | 1318 '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]]) | 1319 'fail': len([t for t in unskipped if list(t.outcomes) == [FAIL]]) |
| 1308 } | 1320 } |
| 1309 | 1321 |
| 1310 | 1322 |
| 1311 class Pattern(object): | 1323 class Pattern(object): |
| 1312 | 1324 |
| 1313 def __init__(self, pattern): | 1325 def __init__(self, pattern): |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 for arg in args: | 1404 for arg in args: |
| 1393 path = SplitPath(arg) | 1405 path = SplitPath(arg) |
| 1394 paths.append(path) | 1406 paths.append(path) |
| 1395 | 1407 |
| 1396 # Check for --valgrind option. If enabled, we overwrite the special | 1408 # Check for --valgrind option. If enabled, we overwrite the special |
| 1397 # command flag with a command that uses the run-valgrind.py script. | 1409 # command flag with a command that uses the run-valgrind.py script. |
| 1398 if options.valgrind: | 1410 if options.valgrind: |
| 1399 run_valgrind = join(workspace, "tools", "run-valgrind.py") | 1411 run_valgrind = join(workspace, "tools", "run-valgrind.py") |
| 1400 options.special_command = "python -u " + run_valgrind + " @" | 1412 options.special_command = "python -u " + run_valgrind + " @" |
| 1401 | 1413 |
| 1414 if options.build_system == 'gyp': |
| 1415 SUFFIX['debug'] = '' |
| 1416 |
| 1402 shell = abspath(options.shell) | 1417 shell = abspath(options.shell) |
| 1403 buildspace = dirname(shell) | 1418 buildspace = dirname(shell) |
| 1404 | 1419 |
| 1405 context = Context(workspace, buildspace, VERBOSE, | 1420 context = Context(workspace, buildspace, VERBOSE, |
| 1406 shell, | 1421 shell, |
| 1407 options.timeout, | 1422 options.timeout, |
| 1408 GetSpecialCommandProcessor(options.special_command), | 1423 GetSpecialCommandProcessor(options.special_command), |
| 1409 options.suppress_dialogs, | 1424 options.suppress_dialogs, |
| 1410 options.store_unexpected_output) | 1425 options.store_unexpected_output) |
| 1411 # First build the required targets | 1426 # First build the required targets |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 print "--- begin source: %s ---" % test.GetLabel() | 1480 print "--- begin source: %s ---" % test.GetLabel() |
| 1466 source = test.GetSource().strip() | 1481 source = test.GetSource().strip() |
| 1467 print source | 1482 print source |
| 1468 print "--- end source: %s ---" % test.GetLabel() | 1483 print "--- end source: %s ---" % test.GetLabel() |
| 1469 return 0 | 1484 return 0 |
| 1470 | 1485 |
| 1471 if options.warn_unused: | 1486 if options.warn_unused: |
| 1472 for rule in globally_unused_rules: | 1487 for rule in globally_unused_rules: |
| 1473 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]
) | 1488 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]
) |
| 1474 | 1489 |
| 1490 if not options.isolates: |
| 1491 all_cases = [c for c in all_cases if not c.TestsIsolates()] |
| 1492 |
| 1475 if options.report: | 1493 if options.report: |
| 1476 PrintReport(all_cases) | 1494 PrintReport(all_cases) |
| 1477 | 1495 |
| 1478 result = None | 1496 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) ] | 1497 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: | 1498 if len(cases_to_run) == 0: |
| 1485 print "No tests to run." | 1499 print "No tests to run." |
| 1486 return 0 | 1500 return 0 |
| 1487 else: | 1501 else: |
| 1488 try: | 1502 try: |
| 1489 start = time.time() | 1503 start = time.time() |
| 1490 if RunTestCases(cases_to_run, options.progress, options.j): | 1504 if RunTestCases(cases_to_run, options.progress, options.j): |
| 1491 result = 0 | 1505 result = 0 |
| 1492 else: | 1506 else: |
| 1493 result = 1 | 1507 result = 1 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1507 for entry in timed_tests[:20]: | 1521 for entry in timed_tests[:20]: |
| 1508 t = FormatTime(entry.duration) | 1522 t = FormatTime(entry.duration) |
| 1509 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1523 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
| 1510 index += 1 | 1524 index += 1 |
| 1511 | 1525 |
| 1512 return result | 1526 return result |
| 1513 | 1527 |
| 1514 | 1528 |
| 1515 if __name__ == '__main__': | 1529 if __name__ == '__main__': |
| 1516 sys.exit(Main()) | 1530 sys.exit(Main()) |
| OLD | NEW |