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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 # This is "built" by src/untrusted/pnacl_support_extension/nacl.scons. | 1451 # This is "built" by src/untrusted/pnacl_support_extension/nacl.scons. |
1452 return env.Dir('${STAGING_DIR}/pnacl_all') | 1452 return env.Dir('${STAGING_DIR}/pnacl_all') |
1453 | 1453 |
1454 pre_base_env.AddMethod(GetPnaclExtensionNode) | 1454 pre_base_env.AddMethod(GetPnaclExtensionNode) |
1455 | 1455 |
1456 | 1456 |
1457 # Compares output_file and golden_file. | 1457 # Compares output_file and golden_file. |
1458 # If they are different, prints the difference and returns 1. | 1458 # If they are different, prints the difference and returns 1. |
1459 # Otherwise, returns 0. | 1459 # Otherwise, returns 0. |
1460 def CheckGoldenFile(golden_file, output_file, | 1460 def CheckGoldenFile(golden_file, output_file, |
1461 filter_regex, filter_inverse, filter_group_only): | 1461 filter_regex=None, |
| 1462 filter_inverse=None, filter_group_only=None): |
1462 golden = open(golden_file).read() | 1463 golden = open(golden_file).read() |
1463 actual = open(output_file).read() | 1464 actual = open(output_file).read() |
1464 if filter_regex is not None: | 1465 if filter_regex is not None: |
1465 actual = test_lib.RegexpFilterLines( | 1466 actual = test_lib.RegexpFilterLines( |
1466 filter_regex, | 1467 filter_regex, |
1467 filter_inverse, | 1468 filter_inverse, |
1468 filter_group_only, | 1469 filter_group_only, |
1469 actual) | 1470 actual) |
1470 if command_tester.DifferentFromGolden(actual, golden, output_file): | 1471 if command_tester.DifferentFromGolden(actual, golden, output_file): |
1471 return 1 | 1472 return 1 |
1472 return 0 | 1473 return 0 |
1473 | 1474 |
1474 | 1475 |
1475 # Returns action that compares output_file and golden_file. | 1476 # Returns action that compares output_file and golden_file. |
1476 # This action can be attached to the node with | 1477 # This action can be attached to the node with |
1477 # env.AddPostAction(target, action) | 1478 # env.AddPostAction(target, action) |
1478 def GoldenFileCheckAction(env, output_file, golden_file, | 1479 def GoldenFileCheckAction(env, output_file, golden_file, |
1479 filter_regex=None, filter_inverse=False, | 1480 filter_regex=None, filter_inverse=False, |
1480 filter_group_only=False): | 1481 filter_group_only=False): |
1481 def ActionFunc(target, source, env): | 1482 def ActionFunc(target, source, env): |
1482 return CheckGoldenFile(env.subst(golden_file), env.subst(output_file), | 1483 return CheckGoldenFile(env.subst(golden_file), env.subst(output_file), |
1483 filter_regex, filter_inverse, filter_group_only) | 1484 filter_regex, filter_inverse, filter_group_only) |
1484 | 1485 |
1485 return env.Action(ActionFunc) | 1486 return env.Action(ActionFunc) |
1486 | 1487 |
| 1488 pre_base_env.AddMethod(GoldenFileCheckAction) |
| 1489 |
| 1490 |
| 1491 def UntrustedCrashDumpFilter(env, target, source, nexe=None, nmf=None): |
| 1492 cmd = [ |
| 1493 '${PYTHON}', |
| 1494 env.File('$MAIN_DIR/tests/untrusted_crash_dump/decode_dump.py').abspath, |
| 1495 env.subst(source), |
| 1496 env.subst(target), |
| 1497 '--addr2line', '${ADDR2LINE}', |
| 1498 '--toolchain-libs', '${NACL_SDK_LIB}', |
| 1499 ] |
| 1500 if nexe: |
| 1501 cmd += ['--main-nexe', nexe] |
| 1502 if nmf: |
| 1503 cmd += ['--nmf', nmf] |
| 1504 return env.Action(' '.join(cmd)) |
| 1505 |
| 1506 pre_base_env.AddMethod(UntrustedCrashDumpFilter) |
| 1507 |
1487 | 1508 |
1488 def PPAPIBrowserTester(env, | 1509 def PPAPIBrowserTester(env, |
1489 target, | 1510 target, |
1490 url, | 1511 url, |
1491 files, | 1512 files, |
1492 nmfs=None, | 1513 nmfs=None, |
1493 map_files=(), | 1514 map_files=(), |
1494 extensions=(), | 1515 extensions=(), |
1495 mime_types=(), | 1516 mime_types=(), |
1496 timeout=20, | 1517 timeout=20, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 command.extend(['--extension', extension]) | 1575 command.extend(['--extension', extension]) |
1555 if env.Bit('bitcode'): | 1576 if env.Bit('bitcode'): |
1556 pnacl_extension = env.GetPnaclExtensionNode() | 1577 pnacl_extension = env.GetPnaclExtensionNode() |
1557 command.extend(['--extension', pnacl_extension]) | 1578 command.extend(['--extension', pnacl_extension]) |
1558 for dest_path, dep_file in map_files: | 1579 for dest_path, dep_file in map_files: |
1559 command.extend(['--map_file', dest_path, dep_file]) | 1580 command.extend(['--map_file', dest_path, dep_file]) |
1560 for file_ext, mime_type in mime_types: | 1581 for file_ext, mime_type in mime_types: |
1561 command.extend(['--mime_type', file_ext, mime_type]) | 1582 command.extend(['--mime_type', file_ext, mime_type]) |
1562 command.extend(['--serving_dir', '${NACL_SDK_LIB}']) | 1583 command.extend(['--serving_dir', '${NACL_SDK_LIB}']) |
1563 command.extend(['--serving_dir', '${LIB_DIR}']) | 1584 command.extend(['--serving_dir', '${LIB_DIR}']) |
| 1585 generated_manifests = [] |
1564 if not nmfs is None: | 1586 if not nmfs is None: |
1565 for nmf_file in nmfs: | 1587 for nmf_file in nmfs: |
1566 generated_manifest = GeneratedManifestNode(env, nmf_file) | 1588 generated_manifest = GeneratedManifestNode(env, nmf_file) |
| 1589 generated_manifests.append(generated_manifest) |
1567 # We need to add generated manifests to the list of default targets. | 1590 # We need to add generated manifests to the list of default targets. |
1568 # The manifests should be generated even if the tests are not run - | 1591 # The manifests should be generated even if the tests are not run - |
1569 # the manifests may be needed for manual testing. | 1592 # the manifests may be needed for manual testing. |
1570 for group in env['COMPONENT_TEST_PROGRAM_GROUPS']: | 1593 for group in env['COMPONENT_TEST_PROGRAM_GROUPS']: |
1571 env.Alias(group, generated_manifest) | 1594 env.Alias(group, generated_manifest) |
1572 # Generated manifests are served in the root of the HTTP server | 1595 # Generated manifests are served in the root of the HTTP server |
1573 command.extend(['--file', generated_manifest]) | 1596 command.extend(['--file', generated_manifest]) |
1574 if 'browser_test_tool' in ARGUMENTS: | 1597 if 'browser_test_tool' in ARGUMENTS: |
1575 command.extend(['--tool', ARGUMENTS['browser_test_tool']]) | 1598 command.extend(['--tool', ARGUMENTS['browser_test_tool']]) |
1576 | 1599 |
(...skipping 22 matching lines...) Expand all Loading... |
1599 ('stdout', nacl_exe_stdout), | 1622 ('stdout', nacl_exe_stdout), |
1600 ('stderr', nacl_exe_stderr)): | 1623 ('stderr', nacl_exe_stderr)): |
1601 if params is None: | 1624 if params is None: |
1602 continue | 1625 continue |
1603 stream_file = env.subst(params['file']) | 1626 stream_file = env.subst(params['file']) |
1604 command.extend(['--nacl_exe_' + stream, stream_file]) | 1627 command.extend(['--nacl_exe_' + stream, stream_file]) |
1605 golden_file = env.subst(params['golden']) | 1628 golden_file = env.subst(params['golden']) |
1606 filter_regex = params.get('filter_regex', None) | 1629 filter_regex = params.get('filter_regex', None) |
1607 filter_inverse = params.get('filter_inverse', False) | 1630 filter_inverse = params.get('filter_inverse', False) |
1608 filter_group_only = params.get('filter_group_only', False) | 1631 filter_group_only = params.get('filter_group_only', False) |
| 1632 decode_crash_dump = params.get('decode_crash_dump', False) |
| 1633 if decode_crash_dump: |
| 1634 if generated_manifests: |
| 1635 nmf_path = generated_manifests[0].abspath |
| 1636 else: |
| 1637 nmf_path = None |
| 1638 decoded = stream_file + '.decoded' |
| 1639 post_actions.append( |
| 1640 env.UntrustedCrashDumpFilter( |
| 1641 decoded, stream_file, nexe=files[0].abspath, nmf=nmf_path)) |
| 1642 stream_file = decoded |
1609 post_actions.append( | 1643 post_actions.append( |
1610 GoldenFileCheckAction( | 1644 env.GoldenFileCheckAction( |
1611 env, stream_file, golden_file, | 1645 stream_file, golden_file, |
1612 filter_regex, filter_inverse, filter_group_only)) | 1646 filter_regex, filter_inverse, filter_group_only)) |
1613 | 1647 |
1614 if ShouldUseVerboseOptions(extra): | 1648 if ShouldUseVerboseOptions(extra): |
1615 env.MakeVerboseExtraOptions(target, log_verbosity, extra) | 1649 env.MakeVerboseExtraOptions(target, log_verbosity, extra) |
1616 # Heuristic for when to capture output... | 1650 # Heuristic for when to capture output... |
1617 capture_output = (extra.pop('capture_output', False) | 1651 capture_output = (extra.pop('capture_output', False) |
1618 or 'process_output_single' in extra) | 1652 or 'process_output_single' in extra) |
1619 node = env.CommandTest(target, | 1653 node = env.CommandTest(target, |
1620 command, | 1654 command, |
1621 # Set to 'huge' so that the browser tester's timeout | 1655 # Set to 'huge' so that the browser tester's timeout |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 'tests/sysbasic/nacl.scons', | 3243 'tests/sysbasic/nacl.scons', |
3210 'tests/syscall_return_sandboxing/nacl.scons', | 3244 'tests/syscall_return_sandboxing/nacl.scons', |
3211 'tests/syscalls/nacl.scons', | 3245 'tests/syscalls/nacl.scons', |
3212 'tests/threads/nacl.scons', | 3246 'tests/threads/nacl.scons', |
3213 'tests/time/nacl.scons', | 3247 'tests/time/nacl.scons', |
3214 'tests/tls/nacl.scons', | 3248 'tests/tls/nacl.scons', |
3215 'tests/tls_perf/nacl.scons', | 3249 'tests/tls_perf/nacl.scons', |
3216 'tests/toolchain/nacl.scons', | 3250 'tests/toolchain/nacl.scons', |
3217 'tests/unittests/shared/platform/nacl.scons', | 3251 'tests/unittests/shared/platform/nacl.scons', |
3218 'tests/untrusted_check/nacl.scons', | 3252 'tests/untrusted_check/nacl.scons', |
| 3253 'tests/untrusted_crash_dump/nacl.scons', |
3219 #### ALPHABETICALLY SORTED #### | 3254 #### ALPHABETICALLY SORTED #### |
3220 ] | 3255 ] |
3221 | 3256 |
3222 # These are tests that are not worthwhile to run in an IRT variant. | 3257 # These are tests that are not worthwhile to run in an IRT variant. |
3223 # In some cases, that's because they are browser tests which always | 3258 # In some cases, that's because they are browser tests which always |
3224 # use the IRT. In others, it's because they are special-case tests | 3259 # use the IRT. In others, it's because they are special-case tests |
3225 # that are incompatible with having an IRT loaded. | 3260 # that are incompatible with having an IRT loaded. |
3226 nonvariant_tests = [ | 3261 nonvariant_tests = [ |
3227 #### ALPHABETICALLY SORTED #### | 3262 #### ALPHABETICALLY SORTED #### |
3228 'tests/barebones/nacl.scons', | 3263 'tests/barebones/nacl.scons', |
3229 'tests/chrome_extension/nacl.scons', | 3264 'tests/chrome_extension/nacl.scons', |
3230 'tests/exit_status/nacl.scons', | 3265 'tests/exit_status/nacl.scons', |
3231 'tests/imc_shm_mmap/nacl.scons', | 3266 'tests/imc_shm_mmap/nacl.scons', |
3232 'tests/imc_sockets/nacl.scons', | 3267 'tests/imc_sockets/nacl.scons', |
3233 'tests/inbrowser_crash_test/nacl.scons', | 3268 'tests/inbrowser_crash_test/nacl.scons', |
| 3269 'tests/inbrowser_untrusted_crash_dump_test/nacl.scons', |
3234 'tests/inbrowser_test_runner/nacl.scons', | 3270 'tests/inbrowser_test_runner/nacl.scons', |
3235 'tests/mach_crash_filter/nacl.scons', | 3271 'tests/mach_crash_filter/nacl.scons', |
3236 'tests/minnacl/nacl.scons', | 3272 'tests/minnacl/nacl.scons', |
3237 'tests/multiple_sandboxes/nacl.scons', | 3273 'tests/multiple_sandboxes/nacl.scons', |
3238 'tests/nacl.scons', | 3274 'tests/nacl.scons', |
3239 'tests/ppapi/nacl.scons', | 3275 'tests/ppapi/nacl.scons', |
3240 'tests/ppapi_browser/bad/nacl.scons', | 3276 'tests/ppapi_browser/bad/nacl.scons', |
3241 'tests/ppapi_browser/crash/nacl.scons', | 3277 'tests/ppapi_browser/crash/nacl.scons', |
3242 'tests/ppapi_browser/extension_mime_handler/nacl.scons', | 3278 'tests/ppapi_browser/extension_mime_handler/nacl.scons', |
3243 'tests/ppapi_browser/manifest/nacl.scons', | 3279 'tests/ppapi_browser/manifest/nacl.scons', |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3756 nacl_env.ValidateSdk() | 3792 nacl_env.ValidateSdk() |
3757 | 3793 |
3758 if BROKEN_TEST_COUNT > 0: | 3794 if BROKEN_TEST_COUNT > 0: |
3759 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3795 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3760 if GetOption('brief_comstr'): | 3796 if GetOption('brief_comstr'): |
3761 msg += " Add --verbose to the command line for more information." | 3797 msg += " Add --verbose to the command line for more information." |
3762 print msg | 3798 print msg |
3763 | 3799 |
3764 # separate warnings from actual build output | 3800 # separate warnings from actual build output |
3765 Banner('B U I L D - O U T P U T:') | 3801 Banner('B U I L D - O U T P U T:') |
OLD | NEW |