diff options
-rw-r--r-- | base/base.isolate | 8 | ||||
-rw-r--r-- | base/base_unittests.isolate | 4 | ||||
-rw-r--r-- | chrome/browser_tests.isolate | 3 | ||||
-rw-r--r-- | chrome/interactive_ui_tests.isolate | 3 | ||||
-rw-r--r-- | chrome/unit_tests.isolate | 4 | ||||
-rw-r--r-- | content/content_browsertests.isolate | 3 | ||||
-rw-r--r-- | content/content_unittests.isolate | 6 | ||||
-rw-r--r-- | net/net_unittests.isolate | 2 | ||||
-rwxr-xr-x | testing/test_env.py | 28 |
9 files changed, 60 insertions, 1 deletions
diff --git a/base/base.isolate b/base/base.isolate index 047d5de..76a00ed 100644 --- a/base/base.isolate +++ b/base/base.isolate @@ -23,6 +23,14 @@ ], }, }], + ['asan==1', { + 'variables': { + 'files': [ + '../tools/valgrind/asan/', + '../third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer', + ], + }, + }], ['OS=="win" and component=="shared_library" and CONFIGURATION_NAME=="Debug"', { 'variables': { 'files': [ diff --git a/base/base_unittests.isolate b/base/base_unittests.isolate index c5c192c..f561d20 100644 --- a/base/base_unittests.isolate +++ b/base/base_unittests.isolate @@ -18,6 +18,8 @@ '<(PRODUCT_DIR)/base_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/xvfb.py', @@ -47,6 +49,8 @@ '<(PRODUCT_DIR)/base_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }], diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate index 3159073..b92be51 100644 --- a/chrome/browser_tests.isolate +++ b/chrome/browser_tests.isolate @@ -10,6 +10,7 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', '--lsan=<(lsan)', ], 'files': [ @@ -137,6 +138,8 @@ '../testing/test_env.py', '<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }], diff --git a/chrome/interactive_ui_tests.isolate b/chrome/interactive_ui_tests.isolate index 645d83c..3e271c6 100644 --- a/chrome/interactive_ui_tests.isolate +++ b/chrome/interactive_ui_tests.isolate @@ -10,6 +10,7 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/interactive_ui_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', '--lsan=<(lsan)', ], 'files': [ @@ -69,6 +70,8 @@ '../testing/test_env.py', '<(PRODUCT_DIR)/interactive_ui_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }], diff --git a/chrome/unit_tests.isolate b/chrome/unit_tests.isolate index 6ebc9e6..2a5814f 100644 --- a/chrome/unit_tests.isolate +++ b/chrome/unit_tests.isolate @@ -43,6 +43,8 @@ '<(PRODUCT_DIR)/unit_tests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/xvfb.py', @@ -95,6 +97,8 @@ '<(PRODUCT_DIR)/unit_tests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }], diff --git a/content/content_browsertests.isolate b/content/content_browsertests.isolate index 1c45e86..80b8bd1 100644 --- a/content/content_browsertests.isolate +++ b/content/content_browsertests.isolate @@ -40,6 +40,7 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', '--lsan=<(lsan)', ], 'files': [ @@ -89,6 +90,8 @@ '../testing/test_env.py', '<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }], diff --git a/content/content_unittests.isolate b/content/content_unittests.isolate index 5747c2f..fe45bde 100644 --- a/content/content_unittests.isolate +++ b/content/content_unittests.isolate @@ -41,6 +41,8 @@ '<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/xvfb.py', @@ -63,6 +65,8 @@ '<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '<(PRODUCT_DIR)/ffmpegsumo.so', @@ -77,6 +81,8 @@ '<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '<(PRODUCT_DIR)/ffmpegsumo.dll', diff --git a/net/net_unittests.isolate b/net/net_unittests.isolate index dafa0d7..15b3f08 100644 --- a/net/net_unittests.isolate +++ b/net/net_unittests.isolate @@ -17,6 +17,8 @@ '<(PRODUCT_DIR)/net_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/test_env.py', diff --git a/testing/test_env.py b/testing/test_env.py index 0729e17..bb68ee7 100755 --- a/testing/test_env.py +++ b/testing/test_env.py @@ -77,11 +77,37 @@ def run_executable(cmd, env): # logic is used. env.pop('CR_SOURCE_ROOT', None) enable_sandbox_if_required(cmd, env) + + # Copy logic from tools/build/scripts/slave/runtest.py. + asan = '--asan=1' in cmd + lsan = '--lsan=1' in cmd + if lsan and sys.platform == 'linux2': + # Use the debug version of libstdc++ under LSan. If we don't, there will + # be a lot of incomplete stack traces in the reports. + env['LD_LIBRARY_PATH'] += '/usr/lib/x86_64-linux-gnu/debug:' + + if asan and sys.platform == 'darwin': + isolate_output_dir = os.path.abspath(os.path.dirname(cmd[0])) + # This is needed because the test binary has @executable_path embedded in it + # that the OS tries to resolve to the cache directory and not the mapped + # directory. + env['DYLD_LIBRARY_PATH'] = str(isolate_output_dir) + # Ensure paths are correctly separated on windows. cmd[0] = cmd[0].replace('/', os.path.sep) cmd = fix_python_path(cmd) try: - return subprocess.call(cmd, env=env) + if asan: + # Need to pipe to the symbolizer script. + p1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, + stderr=sys.stdout) + p2 = subprocess.Popen(["../tools/valgrind/asan/asan_symbolize.py"], + stdin=p1.stdout) + p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. + p2.wait() + return p2.returncode + else: + return subprocess.call(cmd, env=env) except OSError: print >> sys.stderr, 'Failed to start %s' % cmd raise |