Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: SConstruct

Issue 9316125: Adding untrusted crash dump / stack trace tests. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: fixing 64-bit build issue Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 validator) 1129 validator)
1130 1130
1131 1131
1132 # Perform os.path.abspath rooted at the directory SConstruct resides in. 1132 # Perform os.path.abspath rooted at the directory SConstruct resides in.
1133 def SConstructAbsPath(env, path): 1133 def SConstructAbsPath(env, path):
1134 return os.path.normpath(os.path.join(env['MAIN_DIR'], path)) 1134 return os.path.normpath(os.path.join(env['MAIN_DIR'], path))
1135 1135
1136 pre_base_env.AddMethod(SConstructAbsPath) 1136 pre_base_env.AddMethod(SConstructAbsPath)
1137 1137
1138 1138
1139 def GetSelLdr(env): 1139 def GetSelLdr(env, with_exceptions=False):
1140 sel_ldr = ARGUMENTS.get('force_sel_ldr') 1140 sel_ldr = ARGUMENTS.get('force_sel_ldr')
1141 if sel_ldr: 1141 if sel_ldr:
1142 return env.File(env.SConstructAbsPath(sel_ldr)) 1142 return env.File(env.SConstructAbsPath(sel_ldr))
1143 1143
1144 # NOTE: that the variable TRUSTED_ENV is set by ExportSpecialFamilyVars() 1144 # NOTE: that the variable TRUSTED_ENV is set by ExportSpecialFamilyVars()
1145 if 'TRUSTED_ENV' not in env: 1145 if 'TRUSTED_ENV' not in env:
1146 return None 1146 return None
1147 1147
1148 trusted_env = env['TRUSTED_ENV'] 1148 trusted_env = env['TRUSTED_ENV']
1149 return trusted_env.File('${STAGING_DIR}/${PROGPREFIX}sel_ldr${PROGSUFFIX}') 1149 # TODO(bradnelson): drop once exceptions are available by default.
1150 if with_exceptions:
1151 return trusted_env.File(
1152 '${STAGING_DIR}/${PROGPREFIX}sel_ldr_exc${PROGSUFFIX}')
1153 else:
1154 return trusted_env.File('${STAGING_DIR}/${PROGPREFIX}sel_ldr${PROGSUFFIX}')
1150 1155
1151 def GetBootstrap(env): 1156 def GetBootstrap(env):
1152 if 'TRUSTED_ENV' in env: 1157 if 'TRUSTED_ENV' in env:
1153 trusted_env = env['TRUSTED_ENV'] 1158 trusted_env = env['TRUSTED_ENV']
1154 if trusted_env.Bit('linux'): 1159 if trusted_env.Bit('linux'):
1155 return (trusted_env.File('${STAGING_DIR}/nacl_helper_bootstrap'), 1160 return (trusted_env.File('${STAGING_DIR}/nacl_helper_bootstrap'),
1156 '--r_debug=0xXXXXXXXXXXXXXXXX') 1161 '--r_debug=0xXXXXXXXXXXXXXXXX')
1157 return None, None 1162 return None, None
1158 1163
1159 pre_base_env.AddMethod(GetBootstrap) 1164 pre_base_env.AddMethod(GetBootstrap)
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 # This is "built" by src/untrusted/pnacl_support_extension/nacl.scons. 1448 # This is "built" by src/untrusted/pnacl_support_extension/nacl.scons.
1444 return env.Dir('${STAGING_DIR}/pnacl_all') 1449 return env.Dir('${STAGING_DIR}/pnacl_all')
1445 1450
1446 pre_base_env.AddMethod(GetPnaclExtensionNode) 1451 pre_base_env.AddMethod(GetPnaclExtensionNode)
1447 1452
1448 1453
1449 # Compares output_file and golden_file. 1454 # Compares output_file and golden_file.
1450 # If they are different, prints the difference and returns 1. 1455 # If they are different, prints the difference and returns 1.
1451 # Otherwise, returns 0. 1456 # Otherwise, returns 0.
1452 def CheckGoldenFile(golden_file, output_file, 1457 def CheckGoldenFile(golden_file, output_file,
1453 filter_regex, filter_inverse, filter_group_only): 1458 filter_regex=None,
1459 filter_inverse=None, filter_group_only=None):
1454 golden = open(golden_file).read() 1460 golden = open(golden_file).read()
1455 actual = open(output_file).read() 1461 actual = open(output_file).read()
1456 if filter_regex is not None: 1462 if filter_regex is not None:
1457 actual = test_lib.RegexpFilterLines( 1463 actual = test_lib.RegexpFilterLines(
1458 filter_regex, 1464 filter_regex,
1459 filter_inverse, 1465 filter_inverse,
1460 filter_group_only, 1466 filter_group_only,
1461 actual) 1467 actual)
1462 if command_tester.DifferentFromGolden(actual, golden, output_file): 1468 if command_tester.DifferentFromGolden(actual, golden, output_file):
1463 return 1 1469 return 1
1464 return 0 1470 return 0
1465 1471
1466 1472
1467 # Returns action that compares output_file and golden_file. 1473 # Returns action that compares output_file and golden_file.
1468 # This action can be attached to the node with 1474 # This action can be attached to the node with
1469 # env.AddPostAction(target, action) 1475 # env.AddPostAction(target, action)
1470 def GoldenFileCheckAction(env, output_file, golden_file, 1476 def GoldenFileCheckAction(env, output_file, golden_file,
1471 filter_regex=None, filter_inverse=False, 1477 filter_regex=None, filter_inverse=False,
1472 filter_group_only=False): 1478 filter_group_only=False):
1473 def ActionFunc(target, source, env): 1479 def ActionFunc(target, source, env):
1474 return CheckGoldenFile(env.subst(golden_file), env.subst(output_file), 1480 return CheckGoldenFile(env.subst(golden_file), env.subst(output_file),
1475 filter_regex, filter_inverse, filter_group_only) 1481 filter_regex, filter_inverse, filter_group_only)
1476 1482
1477 return env.Action(ActionFunc) 1483 return env.Action(ActionFunc)
1478 1484
1485 pre_base_env.AddMethod(GoldenFileCheckAction)
1486
1487
1488 def UntrustedCrashDumpFilter(env, target, source, nexe=None, nmf=None):
1489 cmd = ('${PYTHON} ' +
Mark Seaborn 2012/02/06 19:44:06 Use AutoDepsCommand() instead of concatenating the
bradn 2012/02/06 22:27:48 This is an action not a command, so reusing AutoDe
1490 env.File(
1491 '$MAIN_DIR/tests/untrusted_crash_dump/decode_dump.py').abspath +
1492 ' ' + env.subst(source) +
1493 ' ' + env.subst(target) +
1494 ' --addr2line ${ADDR2LINE}'
1495 ' --toolchain-libs ${NACL_SDK_LIB}')
1496 if nexe:
1497 cmd += ' --main-nexe ' + env.subst(nexe)
1498 if nmf:
1499 cmd += ' --nmf ' + env.subst(nmf)
1500 return env.Action(cmd)
1501
1502 pre_base_env.AddMethod(UntrustedCrashDumpFilter)
1503
1479 1504
1480 def PPAPIBrowserTester(env, 1505 def PPAPIBrowserTester(env,
1481 target, 1506 target,
1482 url, 1507 url,
1483 files, 1508 files,
1484 nmfs=None, 1509 nmfs=None,
1485 map_files=(), 1510 map_files=(),
1486 extensions=(), 1511 extensions=(),
1487 mime_types=(), 1512 mime_types=(),
1488 timeout=20, 1513 timeout=20,
1489 log_verbosity=2, 1514 log_verbosity=2,
1490 args=(), 1515 args=(),
1491 # list of key/value pairs that are passed to the test 1516 # list of key/value pairs that are passed to the test
1492 test_args=(), 1517 test_args=(),
1493 # list of "--flag=value" pairs (no spaces!) 1518 # list of "--flag=value" pairs (no spaces!)
1494 browser_flags=(), 1519 browser_flags=(),
1495 # redirect streams of NaCl program to files 1520 # redirect streams of NaCl program to files
1496 nacl_exe_stdin=None, 1521 nacl_exe_stdin=None,
1497 nacl_exe_stdout=None, 1522 nacl_exe_stdout=None,
1498 nacl_exe_stderr=None, 1523 nacl_exe_stderr=None,
1499 python_tester_script=None, 1524 python_tester_script=None,
1525 with_exceptions=False,
1500 **extra): 1526 **extra):
1501 if 'TRUSTED_ENV' not in env: 1527 if 'TRUSTED_ENV' not in env:
1502 return [] 1528 return []
1503 1529
1504 # No browser tests run on arm-thumb2 1530 # No browser tests run on arm-thumb2
1505 # Bug http://code.google.com/p/nativeclient/issues/detail?id=2224 1531 # Bug http://code.google.com/p/nativeclient/issues/detail?id=2224
1506 if env.Bit('target_arm_thumb2'): 1532 if env.Bit('target_arm_thumb2'):
1507 return [] 1533 return []
1508 1534
1509 # Lint the extra arguments that are being passed to the tester. 1535 # Lint the extra arguments that are being passed to the tester.
(...skipping 16 matching lines...) Expand all
1526 python_tester_script = env.File('${SCONSTRUCT_DIR}/tools/browser_tester' 1552 python_tester_script = env.File('${SCONSTRUCT_DIR}/tools/browser_tester'
1527 '/browser_tester.py') 1553 '/browser_tester.py')
1528 command = GetHeadlessPrefix(env) + [ 1554 command = GetHeadlessPrefix(env) + [
1529 '${PYTHON}', python_tester_script, 1555 '${PYTHON}', python_tester_script,
1530 '--browser_path', env.ChromeBinary(), 1556 '--browser_path', env.ChromeBinary(),
1531 '--url', url, 1557 '--url', url,
1532 # Fail if there is no response for X seconds. 1558 # Fail if there is no response for X seconds.
1533 '--timeout', str(timeout)] 1559 '--timeout', str(timeout)]
1534 if not env.Bit('disable_dynamic_plugin_loading'): 1560 if not env.Bit('disable_dynamic_plugin_loading'):
1535 command.extend(['--ppapi_plugin', GetPPAPIPluginPath(env['TRUSTED_ENV'])]) 1561 command.extend(['--ppapi_plugin', GetPPAPIPluginPath(env['TRUSTED_ENV'])])
1536 command.extend(['--sel_ldr', GetSelLdr(env)]) 1562 command.extend(['--sel_ldr', GetSelLdr(env, with_exceptions)])
1537 bootstrap, _ = GetBootstrap(env) 1563 bootstrap, _ = GetBootstrap(env)
1538 if bootstrap is not None: 1564 if bootstrap is not None:
1539 command.extend(['--sel_ldr_bootstrap', bootstrap]) 1565 command.extend(['--sel_ldr_bootstrap', bootstrap])
1540 if env.Bit('irt') and (not env.Bit('disable_dynamic_plugin_loading') or 1566 if env.Bit('irt') and (not env.Bit('disable_dynamic_plugin_loading') or
1541 env.Bit('override_chrome_irt')): 1567 env.Bit('override_chrome_irt')):
1542 command.extend(['--irt_library', env.GetIrtNexe()]) 1568 command.extend(['--irt_library', env.GetIrtNexe()])
1543 for dep_file in files: 1569 for dep_file in files:
1544 command.extend(['--file', dep_file]) 1570 command.extend(['--file', dep_file])
1545 for extension in extensions: 1571 for extension in extensions:
1546 command.extend(['--extension', extension]) 1572 command.extend(['--extension', extension])
1547 if env.Bit('bitcode'): 1573 if env.Bit('bitcode'):
1548 pnacl_extension = env.GetPnaclExtensionNode() 1574 pnacl_extension = env.GetPnaclExtensionNode()
1549 command.extend(['--extension', pnacl_extension]) 1575 command.extend(['--extension', pnacl_extension])
1550 for dest_path, dep_file in map_files: 1576 for dest_path, dep_file in map_files:
1551 command.extend(['--map_file', dest_path, dep_file]) 1577 command.extend(['--map_file', dest_path, dep_file])
1552 for file_ext, mime_type in mime_types: 1578 for file_ext, mime_type in mime_types:
1553 command.extend(['--mime_type', file_ext, mime_type]) 1579 command.extend(['--mime_type', file_ext, mime_type])
1554 command.extend(['--serving_dir', '${NACL_SDK_LIB}']) 1580 command.extend(['--serving_dir', '${NACL_SDK_LIB}'])
1555 command.extend(['--serving_dir', '${LIB_DIR}']) 1581 command.extend(['--serving_dir', '${LIB_DIR}'])
1582 generated_manifests = []
1556 if not nmfs is None: 1583 if not nmfs is None:
1557 for nmf_file in nmfs: 1584 for nmf_file in nmfs:
1558 generated_manifest = GeneratedManifestNode(env, nmf_file) 1585 generated_manifest = GeneratedManifestNode(env, nmf_file)
1586 generated_manifests.append(generated_manifest)
1559 # We need to add generated manifests to the list of default targets. 1587 # 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 - 1588 # The manifests should be generated even if the tests are not run -
1561 # the manifests may be needed for manual testing. 1589 # the manifests may be needed for manual testing.
1562 for group in env['COMPONENT_TEST_PROGRAM_GROUPS']: 1590 for group in env['COMPONENT_TEST_PROGRAM_GROUPS']:
1563 env.Alias(group, generated_manifest) 1591 env.Alias(group, generated_manifest)
1564 # Generated manifests are served in the root of the HTTP server 1592 # Generated manifests are served in the root of the HTTP server
1565 command.extend(['--file', generated_manifest]) 1593 command.extend(['--file', generated_manifest])
1566 if 'browser_test_tool' in ARGUMENTS: 1594 if 'browser_test_tool' in ARGUMENTS:
1567 command.extend(['--tool', ARGUMENTS['browser_test_tool']]) 1595 command.extend(['--tool', ARGUMENTS['browser_test_tool']])
1568 1596
(...skipping 22 matching lines...) Expand all
1591 ('stdout', nacl_exe_stdout), 1619 ('stdout', nacl_exe_stdout),
1592 ('stderr', nacl_exe_stderr)): 1620 ('stderr', nacl_exe_stderr)):
1593 if params is None: 1621 if params is None:
1594 continue 1622 continue
1595 stream_file = env.subst(params['file']) 1623 stream_file = env.subst(params['file'])
1596 command.extend(['--nacl_exe_' + stream, stream_file]) 1624 command.extend(['--nacl_exe_' + stream, stream_file])
1597 golden_file = env.subst(params['golden']) 1625 golden_file = env.subst(params['golden'])
1598 filter_regex = params.get('filter_regex', None) 1626 filter_regex = params.get('filter_regex', None)
1599 filter_inverse = params.get('filter_inverse', False) 1627 filter_inverse = params.get('filter_inverse', False)
1600 filter_group_only = params.get('filter_group_only', False) 1628 filter_group_only = params.get('filter_group_only', False)
1629 decode_crash_dump = params.get('decode_crash_dump', False)
1630 if decode_crash_dump:
1631 if generated_manifests:
1632 nmf_path = generated_manifests[0].abspath
1633 else:
1634 nmf_path = None
1635 decoded = stream_file + '.decoded'
1636 post_actions.append(
1637 env.UntrustedCrashDumpFilter(
1638 decoded, stream_file, nexe=files[0].abspath, nmf=nmf_path))
1639 stream_file = decoded
1601 post_actions.append( 1640 post_actions.append(
1602 GoldenFileCheckAction( 1641 env.GoldenFileCheckAction(
1603 env, stream_file, golden_file, 1642 stream_file, golden_file,
1604 filter_regex, filter_inverse, filter_group_only)) 1643 filter_regex, filter_inverse, filter_group_only))
1605 1644
1606 if ShouldUseVerboseOptions(extra): 1645 if ShouldUseVerboseOptions(extra):
1607 env.MakeVerboseExtraOptions(target, log_verbosity, extra) 1646 env.MakeVerboseExtraOptions(target, log_verbosity, extra)
1608 # Heuristic for when to capture output... 1647 # Heuristic for when to capture output...
1609 capture_output = (extra.pop('capture_output', False) 1648 capture_output = (extra.pop('capture_output', False)
1610 or 'process_output_single' in extra) 1649 or 'process_output_single' in extra)
1611 node = env.CommandTest(target, 1650 node = env.CommandTest(target,
1612 command, 1651 command,
1613 # Set to 'huge' so that the browser tester's timeout 1652 # Set to 'huge' so that the browser tester's timeout
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 'tests/sysbasic/nacl.scons', 3238 'tests/sysbasic/nacl.scons',
3200 'tests/syscall_return_sandboxing/nacl.scons', 3239 'tests/syscall_return_sandboxing/nacl.scons',
3201 'tests/syscalls/nacl.scons', 3240 'tests/syscalls/nacl.scons',
3202 'tests/threads/nacl.scons', 3241 'tests/threads/nacl.scons',
3203 'tests/time/nacl.scons', 3242 'tests/time/nacl.scons',
3204 'tests/tls/nacl.scons', 3243 'tests/tls/nacl.scons',
3205 'tests/tls_perf/nacl.scons', 3244 'tests/tls_perf/nacl.scons',
3206 'tests/toolchain/nacl.scons', 3245 'tests/toolchain/nacl.scons',
3207 'tests/unittests/shared/platform/nacl.scons', 3246 'tests/unittests/shared/platform/nacl.scons',
3208 'tests/untrusted_check/nacl.scons', 3247 'tests/untrusted_check/nacl.scons',
3248 'tests/untrusted_crash_dump/nacl.scons',
3209 #### ALPHABETICALLY SORTED #### 3249 #### ALPHABETICALLY SORTED ####
3210 ] 3250 ]
3211 3251
3212 # These are tests that are not worthwhile to run in an IRT variant. 3252 # 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 3253 # 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 3254 # use the IRT. In others, it's because they are special-case tests
3215 # that are incompatible with having an IRT loaded. 3255 # that are incompatible with having an IRT loaded.
3216 nonvariant_tests = [ 3256 nonvariant_tests = [
3217 #### ALPHABETICALLY SORTED #### 3257 #### ALPHABETICALLY SORTED ####
3218 'tests/barebones/nacl.scons', 3258 'tests/barebones/nacl.scons',
3219 'tests/chrome_extension/nacl.scons', 3259 'tests/chrome_extension/nacl.scons',
3220 'tests/exit_status/nacl.scons', 3260 'tests/exit_status/nacl.scons',
3221 'tests/imc_shm_mmap/nacl.scons', 3261 'tests/imc_shm_mmap/nacl.scons',
3222 'tests/imc_sockets/nacl.scons', 3262 'tests/imc_sockets/nacl.scons',
3223 'tests/inbrowser_crash_test/nacl.scons', 3263 'tests/inbrowser_crash_test/nacl.scons',
3264 'tests/inbrowser_untrusted_crash_dump_test/nacl.scons',
3224 'tests/inbrowser_test_runner/nacl.scons', 3265 'tests/inbrowser_test_runner/nacl.scons',
3225 'tests/mach_crash_filter/nacl.scons', 3266 'tests/mach_crash_filter/nacl.scons',
3226 'tests/minnacl/nacl.scons', 3267 'tests/minnacl/nacl.scons',
3227 'tests/multiple_sandboxes/nacl.scons', 3268 'tests/multiple_sandboxes/nacl.scons',
3228 'tests/nacl.scons', 3269 'tests/nacl.scons',
3229 'tests/ppapi/nacl.scons', 3270 'tests/ppapi/nacl.scons',
3230 'tests/ppapi_browser/bad/nacl.scons', 3271 'tests/ppapi_browser/bad/nacl.scons',
3231 'tests/ppapi_browser/crash/nacl.scons', 3272 'tests/ppapi_browser/crash/nacl.scons',
3232 'tests/ppapi_browser/extension_mime_handler/nacl.scons', 3273 'tests/ppapi_browser/extension_mime_handler/nacl.scons',
3233 'tests/ppapi_browser/manifest/nacl.scons', 3274 'tests/ppapi_browser/manifest/nacl.scons',
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 nacl_env.ValidateSdk() 3787 nacl_env.ValidateSdk()
3747 3788
3748 if BROKEN_TEST_COUNT > 0: 3789 if BROKEN_TEST_COUNT > 0:
3749 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3790 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3750 if GetOption('brief_comstr'): 3791 if GetOption('brief_comstr'):
3751 msg += " Add --verbose to the command line for more information." 3792 msg += " Add --verbose to the command line for more information."
3752 print msg 3793 print msg
3753 3794
3754 # separate warnings from actual build output 3795 # separate warnings from actual build output
3755 Banner('B U I L D - O U T P U T:') 3796 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | site_scons/site_tools/naclsdk.py » ('j') | src/trusted/service_runtime/build.scons » ('J')

Powered by Google App Engine
This is Rietveld 408576698