diff options
author | sbc <sbc@chromium.org> | 2016-02-18 21:49:37 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-19 05:50:50 +0000 |
commit | a504e48570e35e6229fdcbdf7967510507a843b8 (patch) | |
tree | b6ae462d12fd1ff3b25bee0b52ec75785dbe4371 /native_client_sdk | |
parent | eaedf4c12bf9958ee12d77a96232a480141c4800 (diff) | |
download | chromium_src-a504e48570e35e6229fdcbdf7967510507a843b8.zip chromium_src-a504e48570e35e6229fdcbdf7967510507a843b8.tar.gz chromium_src-a504e48570e35e6229fdcbdf7967510507a843b8.tar.bz2 |
[NaCl SDK] Enable asan/tsan/valgrind test runs
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_nacl_sdk;tryserver.chromium.mac:mac_nacl_sdk;tryserver.chromium.win:win_nacl_sdk
Review URL: https://codereview.chromium.org/1715433002
Cr-Commit-Position: refs/heads/master@{#376400}
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/build_sdk.py | 12 | ||||
-rwxr-xr-x | native_client_sdk/src/build_tools/buildbot_run.py | 15 | ||||
-rwxr-xr-x | native_client_sdk/src/build_tools/test_sdk.py | 65 |
3 files changed, 59 insertions, 33 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 1ab9559..ce1f49e 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -630,11 +630,11 @@ def BuildStepMakeAll(pepperdir, directory, step_name, deps, config, args) -def BuildStepBuildLibraries(pepperdir, directory): - BuildStepMakeAll(pepperdir, directory, 'Build Libraries Debug', - clean=True, config='Debug') - BuildStepMakeAll(pepperdir, directory, 'Build Libraries Release', - clean=True, config='Release') +def BuildStepBuildLibraries(pepperdir, args=None): + BuildStepMakeAll(pepperdir, 'src', 'Build Libraries Debug', + clean=True, config='Debug', args=args) + BuildStepMakeAll(pepperdir, 'src', 'Build Libraries Release', + clean=True, config='Release', args=args) # Cleanup .pyc file generated while building libraries. Without # this we would end up shipping the pyc in the SDK tarball. @@ -923,7 +923,7 @@ def main(args): BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. - BuildStepBuildLibraries(pepperdir, 'src') + BuildStepBuildLibraries(pepperdir) GenerateNotice(pepperdir) # Verify the SDK contains what we expect. diff --git a/native_client_sdk/src/build_tools/buildbot_run.py b/native_client_sdk/src/build_tools/buildbot_run.py index f6e4ee7..a0ab8c0 100755 --- a/native_client_sdk/src/build_tools/buildbot_run.py +++ b/native_client_sdk/src/build_tools/buildbot_run.py @@ -71,20 +71,20 @@ def StepBuildSDK(): subprocess.check_call(['subst', '/D', subst_drive]) -def StepTestSDK(): +def StepTestSDK(args): cmd = [] if getos.GetPlatform() == 'linux': # Run all of test_sdk.py under xvfb-run; it's startup time leaves something # to be desired, so only start it up once. # We also need to make sure that there are at least 24 bits per pixel. # https://code.google.com/p/chromium/issues/detail?id=316687 - cmd.extend([ + cmd += [ 'xvfb-run', '--auto-servernum', '--server-args', '-screen 0 1024x768x24' - ]) + ] - cmd.extend([sys.executable, 'test_sdk.py']) + cmd += [sys.executable, 'test_sdk.py'] + args Run(cmd, cwd=SCRIPT_DIR) @@ -115,7 +115,12 @@ def main(args): StepRunUnittests() StepBuildSDK() if not options.build_only: - StepTestSDK() + # Run sanitizer tests on the asan bot, and on the trybots + args = [] + if getos.GetPlatform() == 'linux': + if 'asan' in os.getenv('BUILDBOT_BUILDERNAME', ''): + args = ['--sanitizer'] + StepTestSDK(args) return 0 diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py index b1cee6a..831cef5 100755 --- a/native_client_sdk/src/build_tools/test_sdk.py +++ b/native_client_sdk/src/build_tools/test_sdk.py @@ -56,11 +56,31 @@ def StepCopyTests(pepperdir, toolchains, build_experimental): toolchains=toolchains) -def StepBuildTests(pepperdir): +def StepBuildLibraries(pepperdir, sanitizer): for config in ('Debug', 'Release'): - build_sdk.BuildStepMakeAll(pepperdir, 'tests', - 'Build Tests (%s)' % config, - deps=False, config=config) + title = 'Build Libs (%s)[sanitizer=%s]' % (config, sanitizer) + build_sdk.BuildStepMakeAll(pepperdir, 'src', title, config=config, + args=GetSanitizerArgs(sanitizer)) + + +def StepBuildTests(pepperdir, sanitizer): + for config in ('Debug', 'Release'): + title = 'Build Tests (%s)' % config + if sanitizer: + title += '[sanitizer=%s]' % sanitizer + + build_sdk.BuildStepMakeAll(pepperdir, 'tests', title, deps=False, + config=config, args=GetSanitizerArgs(sanitizer)) + + +def GetSanitizerArgs(sanitizer): + if sanitizer == 'valgrind': + return ['TOOLCHAIN=linux', 'RUN_UNDER=valgrind'] + elif sanitizer == 'address': + return ['TOOLCHAIN=linux', 'ASAN=1'] + elif sanitizer == 'thread': + return ['TOOLCHAIN=linux', 'TSAN=1'] + return [] def StepRunSelLdrTests(pepperdir, sanitizer): @@ -72,24 +92,12 @@ def StepRunSelLdrTests(pepperdir, sanitizer): def RunTest(test, toolchain, config, arch=None): args = ['STANDALONE=1', 'TOOLCHAIN=%s' % toolchain] + args += GetSanitizerArgs(sanitizer) 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'] - elif sanitizer == 'address': - args += ['ASAN=1'] - elif sanitizer == 'thread': - args += ['TSAN=1'] build_projects.BuildProjectsBranch(pepperdir, test, clean=False, - deps=deps, config=config, + deps=False, config=config, args=args + ['run']) if getos.GetPlatform() == 'win': @@ -190,18 +198,31 @@ def main(args): phases = [ ('build_examples', StepBuildExamples, pepperdir), ('copy_tests', StepCopyTests, pepperdir, toolchains, options.experimental), - ('build_tests', StepBuildTests, pepperdir), - ('sel_ldr_tests', StepRunSelLdrTests, pepperdir, None), - ('browser_tests', StepRunBrowserTests, toolchains, options.experimental), + ('build_tests', StepBuildTests, pepperdir, None), ] if options.sanitizer: if getos.GetPlatform() != 'linux': buildbot_common.ErrorExit('sanitizer tests only run on linux.') + clang_dir = os.path.join(SRC_DIR, 'third_party', 'llvm-build', + 'Release+Asserts', 'bin') + os.environ['PATH'] = clang_dir + os.pathsep + os.environ['PATH'] + phases += [ + ('build_libs_asan', StepBuildLibraries, pepperdir, 'address'), + ('build_libs_tsan', StepBuildLibraries, pepperdir, 'thread'), + ('build_tests_asan', StepBuildTests, pepperdir, 'address'), + ('build_tests_tsan', StepBuildTests, pepperdir, 'thread'), ('sel_ldr_tests_asan', StepRunSelLdrTests, pepperdir, 'address'), ('sel_ldr_tests_tsan', StepRunSelLdrTests, pepperdir, 'thread'), - ('sel_ldr_tests_valgrind', StepRunSelLdrTests, pepperdir, 'valgrind') + # TODO(sbc): get valgrind installed on the bots to enable this + # configuration + #('sel_ldr_tests_valgrind', StepRunSelLdrTests, pepperdir, 'valgrind') + ] + else: + phases += [ + ('sel_ldr_tests', StepRunSelLdrTests, pepperdir, None), + ('browser_tests', StepRunBrowserTests, toolchains, options.experimental), ] if options.phases: |