Chromium Code Reviews| Index: native_client_sdk/src/build_tools/test_sdk.py |
| diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py |
| index cefb9084bd5b652642c5b934c04b8908ab4c1845..486124877f35a2cf52740f922c26618c1a076a64 100755 |
| --- a/native_client_sdk/src/build_tools/test_sdk.py |
| +++ b/native_client_sdk/src/build_tools/test_sdk.py |
| @@ -63,7 +63,7 @@ def StepBuildTests(pepperdir): |
| deps=False, config=config) |
| -def StepRunSelLdrTests(pepperdir): |
| +def StepRunSelLdrTests(pepperdir, sanitiser): |
| filters = { |
| 'SEL_LDR': True |
| } |
| @@ -71,12 +71,32 @@ def StepRunSelLdrTests(pepperdir): |
| tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, include=filters) |
| def RunTest(test, toolchain, config, arch=None): |
| - args = ['run', 'STANDALONE=1', 'TOOLCHAIN=%s' % toolchain] |
| + args = ['STANDALONE=1', 'TOOLCHAIN=%s' % toolchain] |
| if arch is not None: |
| args.append('NACL_ARCH=%s' % arch) |
| + deps = False |
| + |
| + if sanitiser is not None: |
| + # For sanitizer builds we pass extra argument for make, and do |
| + # full clean build to make sure everything is rebuilt with the |
| + # correct flags |
| + deps = True |
| + if sanitiser == 'valgrind': |
| + args += ['RUN_UNDER=valgrind'] |
| + else: |
| + args += ['CC=clang', 'CXX=clang++', |
| + 'LDFLAGS=-pie -fsanitize=' + sanitiser, |
| + 'CFLAGS=-fPIC -fsanitize=' + sanitiser] |
| + build_projects.BuildProjectsBranch(pepperdir, 'src', clean=False, |
| + deps=deps, config=config, |
| + args=args + ['clean']) |
| + build_projects.BuildProjectsBranch(pepperdir, 'tests', clean=False, |
| + deps=deps, config=config, |
| + args=args + ['clean']) |
| + |
| build_projects.BuildProjectsBranch(pepperdir, test, clean=False, |
| - deps=False, config=config, |
| - args=args) |
| + deps=deps, config=config, |
| + args=args + ['run']) |
| if getos.GetPlatform() == 'win': |
| # On win32 we only support running on the system |
| @@ -91,19 +111,30 @@ def StepRunSelLdrTests(pepperdir): |
| for root, projects in tree.iteritems(): |
| for project in projects: |
| - title = 'sel_ldr tests: %s' % os.path.basename(project['NAME']) |
| + if sanitiser: |
| + sanitiser_name = '[sanitiser=%s]' % sanitiser |
| + else: |
| + sanitiser_name = '' |
| + title = 'standalone test%s: %s' % (sanitiser_name, |
| + os.path.basename(project['NAME'])) |
| location = os.path.join(root, project['NAME']) |
| buildbot_common.BuildStep(title) |
| + configs = ('Debug', 'Release') |
| # On linux we can run the standalone tests natively using the host |
| # compiler. |
| if getos.GetPlatform() == 'linux': |
| - for config in ('Debug', 'Release'): |
| + if sanitiser: |
| + configs = ('Debug',) |
| + for config in configs: |
| RunTest(location, 'linux', config) |
| + if sanitiser: |
| + continue |
| + |
| for toolchain in ('newlib', 'glibc'): |
| for arch in archs: |
| - for config in ('Debug', 'Release'): |
| + for config in configs: |
| RunTest(location, toolchain, config, arch) |
| @@ -132,6 +163,9 @@ def main(args): |
| parser = optparse.OptionParser(description=__doc__, usage=usage) |
| parser.add_option('--experimental', help='build experimental tests', |
| action='store_true') |
| + parser.add_option('--sanitiser', |
|
binji
2014/06/04 23:28:10
include american spelling too? :) (it matches clan
Sam Clegg
2014/06/04 23:46:16
Done.
|
| + help='Run sanitiser (asan/tsan/valgrind) tests', |
| + action='store_true') |
| parser.add_option('--verbose', '-v', help='Verbose output', |
| action='store_true') |
| @@ -163,10 +197,20 @@ def main(args): |
| ('build_examples', StepBuildExamples, pepperdir), |
| ('copy_tests', StepCopyTests, pepperdir, toolchains, options.experimental), |
| ('build_tests', StepBuildTests, pepperdir), |
| - ('sel_ldr_tests', StepRunSelLdrTests, pepperdir), |
| + ('sel_ldr_tests', StepRunSelLdrTests, pepperdir, False), |
|
binji
2014/06/04 23:28:10
StepRunSelLdrTests checks for None above
Sam Clegg
2014/06/04 23:46:16
Done.
|
| ('browser_tests', StepRunBrowserTests, toolchains, options.experimental), |
| ] |
| + if options.sanitiser: |
| + if getos.GetPlatform() != 'linux': |
| + buildbot_common.ErrorExit('sanitiser tests only run on linux.') |
| + phases = [ |
| + ('copy_tests', StepCopyTests, pepperdir, toolchains, options.experimental), |
|
binji
2014/06/04 23:28:10
nit: indent
Sam Clegg
2014/06/04 23:46:16
Done.
|
| + ('sel_ldr_tests_asan', StepRunSelLdrTests, pepperdir, 'address'), |
| + ('sel_ldr_tests_tsan', StepRunSelLdrTests, pepperdir, 'thread'), |
| + ('sel_ldr_tests_valgrind', StepRunSelLdrTests, pepperdir, 'valgrind') |
| + ] |
| + |
| if args: |
| phase_names = [p[0] for p in phases] |
| for arg in args: |