Index: scripts/slave/runtest.py |
=================================================================== |
--- scripts/slave/runtest.py (revision 130995) |
+++ scripts/slave/runtest.py (working copy) |
@@ -129,6 +129,51 @@ |
except: # pylint: disable=W0702 |
print 'Unexpected error while generating JSON' |
+def _GetGtestFilterForAsan(build_dir, test_name): |
+ """Returns an appropriate --gtest_filter flag for googletest binary |
+ invocation. A cheap knock off of _AppendGtestFilter() from |
+ src/tools/valgrind/chrome_test.py just for ASAN. |
+ |
+ Args: |
+ build_dir: the path to the src/build directory. |
+ test_name: the name of the test, e.g. browser_tests. |
+ """ |
+ print 'Reading gtest exclude filter files for ASAN:' |
+ test_files = [ |
+ '%s.gtest-asan.txt' % test_name, |
+ '%s.gtest-asan_%s.txt' % (test_name, chromium_utils.PlatformName())] |
+ gtest_dir = os.path.join( |
+ build_dir, '..', 'tools', 'valgrind', 'gtest_exclude') |
+ filters = [] |
+ for test_file in test_files: |
+ test_path = os.path.join(gtest_dir, test_file) |
+ if not os.path.exists(test_path): |
+ print ' "%s" - not found' % test_file |
+ continue |
+ print ' "%s" - OK' % test_file |
+ f = open(test_path, 'r') |
+ for line in f.readlines(): |
+ if line.startswith('#') or line.startswith('//') or line.isspace(): |
Alexander Potapenko
2012/04/06 07:32:53
I don't mind treating '//' as a comment line, but
|
+ continue |
+ line = line.rstrip() |
+ test_prefixes = ['FLAKY', 'FAILS'] |
+ for p in test_prefixes: |
+ # Strip prefixes from the test names. |
+ line = line.replace('.%s_' % p, '.') |
+ # Exclude the original test name. |
+ filters.append(line) |
+ if line[-2:] != '.*': |
+ # List all possible prefixes if line doesn't end with '.*'. |
+ for p in test_prefixes: |
+ filters.append(line.replace('.', '.%s_' % p)) |
+ # Get rid of duplicates. |
+ filters = set(filters) |
+ if not filters: |
+ return None |
+ gtest_filter = '-' |
Alexander Potapenko
2012/04/06 07:32:53
How about joining lines 173 and 174?
(and maybe 17
|
+ gtest_filter += ':'.join(filters) |
+ return gtest_filter |
+ |
def start_http_server(platform, build_dir, test_exe_path, document_root): |
# pylint: disable=F0401 |
import google.httpd_utils |
@@ -235,6 +280,9 @@ |
test_exe_path=test_exe_path, |
document_root=options.document_root) |
if options.factory_properties.get('asan', False): |
+ gtest_filter = _GetGtestFilterForAsan(build_dir, args[0]) |
+ if gtest_filter: |
+ command.append('--gtest_filter=%s' % gtest_filter) |
symbolize = os.path.abspath(os.path.join('src', 'third_party', 'asan', |
'scripts', 'asan_symbolize.py')) |
pipes = [[sys.executable, symbolize], ['c++filt']] |
@@ -357,6 +405,9 @@ |
with_wm=options.factory_properties.get('window_manager', True), |
server_dir=special_xvfb_dir) |
if options.factory_properties.get('asan', False): |
+ gtest_filter = _GetGtestFilterForAsan(build_dir, args[0]) |
+ if gtest_filter: |
+ command.append('--gtest_filter=%s' % gtest_filter) |
symbolize = os.path.abspath(os.path.join('src', 'third_party', 'asan', |
'scripts', 'asan_symbolize.py')) |
pipes = [[sys.executable, symbolize], ['c++filt']] |