Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: tools/drmemory/scripts/pdfium_tests.py

Issue 1454193002: Add Dr. Memory suppression file for pdfium tests (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/drmemory/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 ''' Runs various chrome tests through valgrind_test.py.''' 6 ''' Runs various chrome tests through valgrind_test.py.'''
7 7
8 import glob 8 import glob
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 '''Generates the default command array that most tests will use.''' 90 '''Generates the default command array that most tests will use.'''
91 if exe and common.IsWindows(): 91 if exe and common.IsWindows():
92 exe += '.exe' 92 exe += '.exe'
93 93
94 cmd = list(self._command_preamble) 94 cmd = list(self._command_preamble)
95 95
96 # Find all suppressions matching the following pattern: 96 # Find all suppressions matching the following pattern:
97 # tools/valgrind/TOOL/suppressions[_PLATFORM].txt 97 # tools/valgrind/TOOL/suppressions[_PLATFORM].txt
98 # and list them with --suppressions= prefix. 98 # and list them with --suppressions= prefix.
99 script_dir = path_utils.ScriptDir() 99 script_dir = path_utils.ScriptDir()
100 tool_name = tool.ToolName(); 100 suppression_file = os.path.join(script_dir, "..", "suppressions.txt")
101 suppression_file = os.path.join(script_dir, tool_name, "suppressions.txt")
102 if os.path.exists(suppression_file): 101 if os.path.exists(suppression_file):
103 cmd.append("--suppressions=%s" % suppression_file) 102 cmd.append("--suppressions=%s" % suppression_file)
104 # Platform-specific suppression 103 # Platform-specific suppression
105 for platform in common.PlatformNames(): 104 for platform in common.PlatformNames():
106 platform_suppression_file = \ 105 platform_suppression_file = \
107 os.path.join(script_dir, tool_name, 'suppressions_%s.txt' % platform) 106 os.path.join(script_dir, "..", 'suppressions_%s.txt' % platform)
108 if os.path.exists(platform_suppression_file): 107 if os.path.exists(platform_suppression_file):
109 cmd.append("--suppressions=%s" % platform_suppression_file) 108 cmd.append("--suppressions=%s" % platform_suppression_file)
110 109
111 if self._options.valgrind_tool_flags: 110 if self._options.valgrind_tool_flags:
112 cmd += self._options.valgrind_tool_flags.split(" ") 111 cmd += self._options.valgrind_tool_flags.split(" ")
113 if self._options.keep_logs: 112 if self._options.keep_logs:
114 cmd += ["--keep_logs"] 113 cmd += ["--keep_logs"]
115 if valgrind_test_args != None: 114 if valgrind_test_args != None:
116 for arg in valgrind_test_args: 115 for arg in valgrind_test_args:
117 cmd.append(arg) 116 cmd.append(arg)
118 if exe: 117 if exe:
119 self._EnsureBuildDirFound() 118 self._EnsureBuildDirFound()
120 exe_path = os.path.join(self._options.build_dir, exe) 119 exe_path = os.path.join(self._options.build_dir, exe)
121 if not os.path.exists(exe_path): 120 if not os.path.exists(exe_path):
122 raise ExecutableNotFound("Couldn't find '%s'" % exe_path) 121 raise ExecutableNotFound("Couldn't find '%s'" % exe_path)
123 122
124 # Make sure we don't try to test ASan-built binaries
125 # with other dynamic instrumentation-based tools.
126 # TODO(timurrrr): also check TSan and MSan?
127 # `nm` might not be available, so use try-except.
128 try:
129 # Do not perform this check on OS X, as 'nm' on 10.6 can't handle
130 # binaries built with Clang 3.5+.
131 if not common.IsMac():
132 nm_output = subprocess.check_output(["nm", exe_path])
133 if nm_output.find("__asan_init") != -1:
134 raise BadBinary("You're trying to run an executable instrumented "
135 "with AddressSanitizer under %s. Please provide "
136 "an uninstrumented executable." % tool_name)
137 except OSError:
138 pass
139
140 cmd.append(exe_path) 123 cmd.append(exe_path)
141 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time 124 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time
142 # so we can find the slowpokes. 125 # so we can find the slowpokes.
143 cmd.append("--gtest_print_time") 126 cmd.append("--gtest_print_time")
144 # Built-in test launcher for gtest-based executables runs tests using 127 # Built-in test launcher for gtest-based executables runs tests using
145 # multiple process by default. Force the single-process mode back. 128 # multiple process by default. Force the single-process mode back.
146 cmd.append("--single-process-tests") 129 cmd.append("--single-process-tests")
147 if self._options.gtest_repeat: 130 if self._options.gtest_repeat:
148 cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat) 131 cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat)
149 if self._options.gtest_shuffle: 132 if self._options.gtest_shuffle:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 344
362 for t in options.test: 345 for t in options.test:
363 tests = ChromeTests(options, args, t) 346 tests = ChromeTests(options, args, t)
364 ret = tests.Run() 347 ret = tests.Run()
365 if ret: return ret 348 if ret: return ret
366 return 0 349 return 0
367 350
368 351
369 if __name__ == "__main__": 352 if __name__ == "__main__":
370 sys.exit(_main()) 353 sys.exit(_main())
OLDNEW
« no previous file with comments | « no previous file | tools/drmemory/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698