OLD | NEW |
1 #! -*- python -*- | 1 #! -*- python -*- |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import atexit | 6 import atexit |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import shutil | 10 import shutil |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 # This is "built" by src/untrusted/pnacl_support_extension/nacl.scons. | 1443 # This is "built" by src/untrusted/pnacl_support_extension/nacl.scons. |
1444 return env.Dir('${STAGING_DIR}/pnacl_all') | 1444 return env.Dir('${STAGING_DIR}/pnacl_all') |
1445 | 1445 |
1446 pre_base_env.AddMethod(GetPnaclExtensionNode) | 1446 pre_base_env.AddMethod(GetPnaclExtensionNode) |
1447 | 1447 |
1448 | 1448 |
1449 # Compares output_file and golden_file. | 1449 # Compares output_file and golden_file. |
1450 # If they are different, prints the difference and returns 1. | 1450 # If they are different, prints the difference and returns 1. |
1451 # Otherwise, returns 0. | 1451 # Otherwise, returns 0. |
1452 def CheckGoldenFile(golden_file, output_file, | 1452 def CheckGoldenFile(golden_file, output_file, |
1453 filter_regex, filter_inverse, filter_group_only): | 1453 filter_regex=None, |
| 1454 filter_inverse=None, filter_group_only=None): |
1454 golden = open(golden_file).read() | 1455 golden = open(golden_file).read() |
1455 actual = open(output_file).read() | 1456 actual = open(output_file).read() |
1456 if filter_regex is not None: | 1457 if filter_regex is not None: |
1457 actual = test_lib.RegexpFilterLines( | 1458 actual = test_lib.RegexpFilterLines( |
1458 filter_regex, | 1459 filter_regex, |
1459 filter_inverse, | 1460 filter_inverse, |
1460 filter_group_only, | 1461 filter_group_only, |
1461 actual) | 1462 actual) |
1462 if command_tester.DifferentFromGolden(actual, golden, output_file): | 1463 if command_tester.DifferentFromGolden(actual, golden, output_file): |
1463 return 1 | 1464 return 1 |
1464 return 0 | 1465 return 0 |
1465 | 1466 |
1466 | 1467 |
1467 # Returns action that compares output_file and golden_file. | 1468 # Returns action that compares output_file and golden_file. |
1468 # This action can be attached to the node with | 1469 # This action can be attached to the node with |
1469 # env.AddPostAction(target, action) | 1470 # env.AddPostAction(target, action) |
1470 def GoldenFileCheckAction(env, output_file, golden_file, | 1471 def GoldenFileCheckAction(env, output_file, golden_file, |
1471 filter_regex=None, filter_inverse=False, | 1472 filter_regex=None, filter_inverse=False, |
1472 filter_group_only=False): | 1473 filter_group_only=False): |
1473 def ActionFunc(target, source, env): | 1474 def ActionFunc(target, source, env): |
1474 return CheckGoldenFile(env.subst(golden_file), env.subst(output_file), | 1475 return CheckGoldenFile(env.subst(golden_file), env.subst(output_file), |
1475 filter_regex, filter_inverse, filter_group_only) | 1476 filter_regex, filter_inverse, filter_group_only) |
1476 | 1477 |
1477 return env.Action(ActionFunc) | 1478 return env.Action(ActionFunc) |
1478 | 1479 |
| 1480 pre_base_env.AddMethod(GoldenFileCheckAction) |
| 1481 |
| 1482 |
| 1483 def UntrustedCrashDumpFilter(env, target, source, nexe=None, nmf=None): |
| 1484 cmd = [ |
| 1485 '${PYTHON}', |
| 1486 env.File('$MAIN_DIR/tests/untrusted_crash_dump/decode_dump.py').abspath, |
| 1487 env.subst(source), |
| 1488 env.subst(target), |
| 1489 '--addr2line', '${ADDR2LINE}', |
| 1490 '--toolchain-libs', '${NACL_SDK_LIB}', |
| 1491 ] |
| 1492 if nexe: |
| 1493 cmd += ['--main-nexe', nexe] |
| 1494 if nmf: |
| 1495 cmd += ['--nmf', nmf] |
| 1496 return env.Action(' '.join(cmd)) |
| 1497 |
| 1498 pre_base_env.AddMethod(UntrustedCrashDumpFilter) |
| 1499 |
1479 | 1500 |
1480 def PPAPIBrowserTester(env, | 1501 def PPAPIBrowserTester(env, |
1481 target, | 1502 target, |
1482 url, | 1503 url, |
1483 files, | 1504 files, |
1484 nmfs=None, | 1505 nmfs=None, |
1485 map_files=(), | 1506 map_files=(), |
1486 extensions=(), | 1507 extensions=(), |
1487 mime_types=(), | 1508 mime_types=(), |
1488 timeout=20, | 1509 timeout=20, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 command.extend(['--extension', extension]) | 1567 command.extend(['--extension', extension]) |
1547 if env.Bit('bitcode'): | 1568 if env.Bit('bitcode'): |
1548 pnacl_extension = env.GetPnaclExtensionNode() | 1569 pnacl_extension = env.GetPnaclExtensionNode() |
1549 command.extend(['--extension', pnacl_extension]) | 1570 command.extend(['--extension', pnacl_extension]) |
1550 for dest_path, dep_file in map_files: | 1571 for dest_path, dep_file in map_files: |
1551 command.extend(['--map_file', dest_path, dep_file]) | 1572 command.extend(['--map_file', dest_path, dep_file]) |
1552 for file_ext, mime_type in mime_types: | 1573 for file_ext, mime_type in mime_types: |
1553 command.extend(['--mime_type', file_ext, mime_type]) | 1574 command.extend(['--mime_type', file_ext, mime_type]) |
1554 command.extend(['--serving_dir', '${NACL_SDK_LIB}']) | 1575 command.extend(['--serving_dir', '${NACL_SDK_LIB}']) |
1555 command.extend(['--serving_dir', '${LIB_DIR}']) | 1576 command.extend(['--serving_dir', '${LIB_DIR}']) |
| 1577 generated_manifests = [] |
1556 if not nmfs is None: | 1578 if not nmfs is None: |
1557 for nmf_file in nmfs: | 1579 for nmf_file in nmfs: |
1558 generated_manifest = GeneratedManifestNode(env, nmf_file) | 1580 generated_manifest = GeneratedManifestNode(env, nmf_file) |
| 1581 generated_manifests.append(generated_manifest) |
1559 # We need to add generated manifests to the list of default targets. | 1582 # We need to add generated manifests to the list of default targets. |
1560 # The manifests should be generated even if the tests are not run - | 1583 # The manifests should be generated even if the tests are not run - |
1561 # the manifests may be needed for manual testing. | 1584 # the manifests may be needed for manual testing. |
1562 for group in env['COMPONENT_TEST_PROGRAM_GROUPS']: | 1585 for group in env['COMPONENT_TEST_PROGRAM_GROUPS']: |
1563 env.Alias(group, generated_manifest) | 1586 env.Alias(group, generated_manifest) |
1564 # Generated manifests are served in the root of the HTTP server | 1587 # Generated manifests are served in the root of the HTTP server |
1565 command.extend(['--file', generated_manifest]) | 1588 command.extend(['--file', generated_manifest]) |
1566 if 'browser_test_tool' in ARGUMENTS: | 1589 if 'browser_test_tool' in ARGUMENTS: |
1567 command.extend(['--tool', ARGUMENTS['browser_test_tool']]) | 1590 command.extend(['--tool', ARGUMENTS['browser_test_tool']]) |
1568 | 1591 |
(...skipping 22 matching lines...) Expand all Loading... |
1591 ('stdout', nacl_exe_stdout), | 1614 ('stdout', nacl_exe_stdout), |
1592 ('stderr', nacl_exe_stderr)): | 1615 ('stderr', nacl_exe_stderr)): |
1593 if params is None: | 1616 if params is None: |
1594 continue | 1617 continue |
1595 stream_file = env.subst(params['file']) | 1618 stream_file = env.subst(params['file']) |
1596 command.extend(['--nacl_exe_' + stream, stream_file]) | 1619 command.extend(['--nacl_exe_' + stream, stream_file]) |
1597 golden_file = env.subst(params['golden']) | 1620 golden_file = env.subst(params['golden']) |
1598 filter_regex = params.get('filter_regex', None) | 1621 filter_regex = params.get('filter_regex', None) |
1599 filter_inverse = params.get('filter_inverse', False) | 1622 filter_inverse = params.get('filter_inverse', False) |
1600 filter_group_only = params.get('filter_group_only', False) | 1623 filter_group_only = params.get('filter_group_only', False) |
| 1624 decode_crash_dump = params.get('decode_crash_dump', False) |
| 1625 if decode_crash_dump: |
| 1626 if generated_manifests: |
| 1627 nmf_path = generated_manifests[0].abspath |
| 1628 else: |
| 1629 nmf_path = None |
| 1630 decoded = stream_file + '.decoded' |
| 1631 post_actions.append( |
| 1632 env.UntrustedCrashDumpFilter( |
| 1633 decoded, stream_file, nexe=files[0].abspath, nmf=nmf_path)) |
| 1634 stream_file = decoded |
1601 post_actions.append( | 1635 post_actions.append( |
1602 GoldenFileCheckAction( | 1636 env.GoldenFileCheckAction( |
1603 env, stream_file, golden_file, | 1637 stream_file, golden_file, |
1604 filter_regex, filter_inverse, filter_group_only)) | 1638 filter_regex, filter_inverse, filter_group_only)) |
1605 | 1639 |
1606 if ShouldUseVerboseOptions(extra): | 1640 if ShouldUseVerboseOptions(extra): |
1607 env.MakeVerboseExtraOptions(target, log_verbosity, extra) | 1641 env.MakeVerboseExtraOptions(target, log_verbosity, extra) |
1608 # Heuristic for when to capture output... | 1642 # Heuristic for when to capture output... |
1609 capture_output = (extra.pop('capture_output', False) | 1643 capture_output = (extra.pop('capture_output', False) |
1610 or 'process_output_single' in extra) | 1644 or 'process_output_single' in extra) |
1611 node = env.CommandTest(target, | 1645 node = env.CommandTest(target, |
1612 command, | 1646 command, |
1613 # Set to 'huge' so that the browser tester's timeout | 1647 # Set to 'huge' so that the browser tester's timeout |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3199 'tests/sysbasic/nacl.scons', | 3233 'tests/sysbasic/nacl.scons', |
3200 'tests/syscall_return_sandboxing/nacl.scons', | 3234 'tests/syscall_return_sandboxing/nacl.scons', |
3201 'tests/syscalls/nacl.scons', | 3235 'tests/syscalls/nacl.scons', |
3202 'tests/threads/nacl.scons', | 3236 'tests/threads/nacl.scons', |
3203 'tests/time/nacl.scons', | 3237 'tests/time/nacl.scons', |
3204 'tests/tls/nacl.scons', | 3238 'tests/tls/nacl.scons', |
3205 'tests/tls_perf/nacl.scons', | 3239 'tests/tls_perf/nacl.scons', |
3206 'tests/toolchain/nacl.scons', | 3240 'tests/toolchain/nacl.scons', |
3207 'tests/unittests/shared/platform/nacl.scons', | 3241 'tests/unittests/shared/platform/nacl.scons', |
3208 'tests/untrusted_check/nacl.scons', | 3242 'tests/untrusted_check/nacl.scons', |
| 3243 'tests/untrusted_crash_dump/nacl.scons', |
3209 #### ALPHABETICALLY SORTED #### | 3244 #### ALPHABETICALLY SORTED #### |
3210 ] | 3245 ] |
3211 | 3246 |
3212 # These are tests that are not worthwhile to run in an IRT variant. | 3247 # These are tests that are not worthwhile to run in an IRT variant. |
3213 # In some cases, that's because they are browser tests which always | 3248 # In some cases, that's because they are browser tests which always |
3214 # use the IRT. In others, it's because they are special-case tests | 3249 # use the IRT. In others, it's because they are special-case tests |
3215 # that are incompatible with having an IRT loaded. | 3250 # that are incompatible with having an IRT loaded. |
3216 nonvariant_tests = [ | 3251 nonvariant_tests = [ |
3217 #### ALPHABETICALLY SORTED #### | 3252 #### ALPHABETICALLY SORTED #### |
3218 'tests/barebones/nacl.scons', | 3253 'tests/barebones/nacl.scons', |
3219 'tests/chrome_extension/nacl.scons', | 3254 'tests/chrome_extension/nacl.scons', |
3220 'tests/exit_status/nacl.scons', | 3255 'tests/exit_status/nacl.scons', |
3221 'tests/imc_shm_mmap/nacl.scons', | 3256 'tests/imc_shm_mmap/nacl.scons', |
3222 'tests/imc_sockets/nacl.scons', | 3257 'tests/imc_sockets/nacl.scons', |
3223 'tests/inbrowser_crash_test/nacl.scons', | 3258 'tests/inbrowser_crash_test/nacl.scons', |
| 3259 'tests/inbrowser_untrusted_crash_dump_test/nacl.scons', |
3224 'tests/inbrowser_test_runner/nacl.scons', | 3260 'tests/inbrowser_test_runner/nacl.scons', |
3225 'tests/mach_crash_filter/nacl.scons', | 3261 'tests/mach_crash_filter/nacl.scons', |
3226 'tests/minnacl/nacl.scons', | 3262 'tests/minnacl/nacl.scons', |
3227 'tests/multiple_sandboxes/nacl.scons', | 3263 'tests/multiple_sandboxes/nacl.scons', |
3228 'tests/nacl.scons', | 3264 'tests/nacl.scons', |
3229 'tests/ppapi/nacl.scons', | 3265 'tests/ppapi/nacl.scons', |
3230 'tests/ppapi_browser/bad/nacl.scons', | 3266 'tests/ppapi_browser/bad/nacl.scons', |
3231 'tests/ppapi_browser/crash/nacl.scons', | 3267 'tests/ppapi_browser/crash/nacl.scons', |
3232 'tests/ppapi_browser/extension_mime_handler/nacl.scons', | 3268 'tests/ppapi_browser/extension_mime_handler/nacl.scons', |
3233 'tests/ppapi_browser/manifest/nacl.scons', | 3269 'tests/ppapi_browser/manifest/nacl.scons', |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3746 nacl_env.ValidateSdk() | 3782 nacl_env.ValidateSdk() |
3747 | 3783 |
3748 if BROKEN_TEST_COUNT > 0: | 3784 if BROKEN_TEST_COUNT > 0: |
3749 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3785 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3750 if GetOption('brief_comstr'): | 3786 if GetOption('brief_comstr'): |
3751 msg += " Add --verbose to the command line for more information." | 3787 msg += " Add --verbose to the command line for more information." |
3752 print msg | 3788 print msg |
3753 | 3789 |
3754 # separate warnings from actual build output | 3790 # separate warnings from actual build output |
3755 Banner('B U I L D - O U T P U T:') | 3791 Banner('B U I L D - O U T P U T:') |
OLD | NEW |