diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 18:34:53 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 18:34:53 +0000 |
commit | 425e607e844091c99eec0d75ae6f47ebff82bbcf (patch) | |
tree | 8c7c4a7deb82f9a44420e34e8e0c65a677409af8 /native_client_sdk | |
parent | 9e36dbf4aa503459eb0d802459eaf077b575cb26 (diff) | |
download | chromium_src-425e607e844091c99eec0d75ae6f47ebff82bbcf.zip chromium_src-425e607e844091c99eec0d75ae6f47ebff82bbcf.tar.gz chromium_src-425e607e844091c99eec0d75ae6f47ebff82bbcf.tar.bz2 |
[NaCl SDK] Add support for ASAN, TSAN and valgrind to test_sdk.py
The plan is to enable these on a seperate test bot.
R=binji@chromium.org, binji
Review URL: https://codereview.chromium.org/315093002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/test_sdk.py | 59 | ||||
-rw-r--r-- | native_client_sdk/src/tools/host_gcc.mk | 2 |
2 files changed, 52 insertions, 9 deletions
diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py index cefb908..039d71b 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, sanitizer): 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 sanitizer 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 sanitizer == 'valgrind': + args += ['RUN_UNDER=valgrind'] + else: + args += ['CC=clang', 'CXX=clang++', + 'LDFLAGS=-pie -fsanitize=' + sanitizer, + 'CFLAGS=-fPIC -fsanitize=' + sanitizer] + 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 sanitizer: + sanitizer_name = '[sanitizer=%s]' % sanitizer + else: + sanitizer_name = '' + title = 'standalone test%s: %s' % (sanitizer_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 sanitizer: + configs = ('Debug',) + for config in configs: RunTest(location, 'linux', config) + if sanitizer: + 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('--sanitizer', + help='Run sanitizer (asan/tsan/valgrind) tests', + action='store_true') parser.add_option('--verbose', '-v', help='Verbose output', action='store_true') @@ -163,10 +197,19 @@ 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, None), ('browser_tests', StepRunBrowserTests, toolchains, options.experimental), ] + if options.sanitizer: + if getos.GetPlatform() != 'linux': + buildbot_common.ErrorExit('sanitizer tests only run on linux.') + phases += [ + ('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: diff --git a/native_client_sdk/src/tools/host_gcc.mk b/native_client_sdk/src/tools/host_gcc.mk index f474054..18160ea 100644 --- a/native_client_sdk/src/tools/host_gcc.mk +++ b/native_client_sdk/src/tools/host_gcc.mk @@ -165,5 +165,5 @@ endef # ifdef STANDALONE run: all - $(OUTDIR)/$(TARGET)$(HOST_EXT) $(EXE_ARGS) + $(RUN_UNDER) $(OUTDIR)/$(TARGET)$(HOST_EXT) $(EXE_ARGS) endif |