Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 cmd = self._DefaultCommand(tool, None, self._args) | 262 cmd = self._DefaultCommand(tool, None, self._args) |
| 263 self.SetupLdPath(False) | 263 self.SetupLdPath(False) |
| 264 return tool.Run(cmd, None) | 264 return tool.Run(cmd, None) |
| 265 | 265 |
| 266 def TestPDFiumUnitTests(self): | 266 def TestPDFiumUnitTests(self): |
| 267 return self.SimpleTest("pdfium_unittests", "pdfium_unittests") | 267 return self.SimpleTest("pdfium_unittests", "pdfium_unittests") |
| 268 | 268 |
| 269 def TestPDFiumEmbedderTests(self): | 269 def TestPDFiumEmbedderTests(self): |
| 270 return self.SimpleTest("pdfium_embeddertests", "pdfium_embeddertests") | 270 return self.SimpleTest("pdfium_embeddertests", "pdfium_embeddertests") |
| 271 | 271 |
| 272 def TestPDFiumTest(self, script_name): | |
| 273 # Build the commandline in 'cmd'. | |
|
Lei Zhang
2015/11/20 00:17:47
nit: command line
zhaoqin1
2015/11/21 04:20:46
Done.
| |
| 274 # It's going to be roughly | |
| 275 # python valgrind_test.py ... | |
| 276 # but we'll use the --indirect_pdfium_test flag to valgrind_test.py | |
| 277 # to avoid valgrinding python. | |
| 278 | |
| 279 # Start by building the valgrind_test.py commandline. | |
| 280 tool = valgrind_test.CreateTool(self._options.valgrind_tool) | |
| 281 cmd = self._DefaultCommand(tool) | |
| 282 cmd.append("--trace_children") | |
| 283 cmd.append("--indirect_pdfium_test") | |
| 284 cmd.append("--ignore_exit_code") | |
| 285 # Now build script_cmd, the run_corpus_tests commandline. | |
| 286 script = os.path.join(self._source_dir, "..", "testing", "tools", script_nam e) | |
|
Lei Zhang
2015/11/20 00:17:47
80 chars / line, ditto on line 290.
Lei Zhang
2015/11/20 00:17:47
I think the |self._source_dir| calculation is wron
zhaoqin1
2015/11/21 04:20:45
line 57:
self._source_dir = os.path.dirname(os.pat
zhaoqin1
2015/11/21 04:20:45
Done.
| |
| 287 script_cmd = ["python", script] | |
| 288 if self._options.build_dir: | |
| 289 script_cmd.extend(["--build-dir", self._options.build_dir]) | |
| 290 # TODO(zhaoqin): figure out why wrapper does not work with test_one_file_par allel | |
| 291 # in run_corpus_tests.py, now it only runs in single process mode. | |
| 292 if script_name == "run_corpus_tests.py": | |
| 293 script_cmd.extend(["-j", "1"]) | |
| 294 # Now run script_cmd with the wrapper in cmd | |
| 295 cmd.extend(["--"]) | |
|
Lei Zhang
2015/11/20 00:17:47
Just append("--")
zhaoqin1
2015/11/21 04:20:45
Done.
| |
| 296 cmd.extend(script_cmd) | |
| 297 | |
| 298 ret = tool.Run(cmd, "layout", min_runtime_in_seconds=0) | |
| 299 return ret | |
| 300 | |
| 301 def TestPDFiumJavascript(self): | |
| 302 return self.TestPDFiumTest("run_javascript_tests.py") | |
| 303 | |
| 304 def TestPDFiumPixel(self): | |
| 305 return self.TestPDFiumTest("run_pixel_tests.py") | |
| 306 | |
| 307 def TestPDFiumCorpus(self): | |
| 308 return self.TestPDFiumTest("run_corpus_tests.py") | |
|
Lei Zhang
2015/11/20 00:17:47
blank line after this
zhaoqin1
2015/11/21 04:20:45
Done.
| |
| 272 # The known list of tests. | 309 # The known list of tests. |
| 273 _test_list = { | 310 _test_list = { |
| 274 "cmdline" : RunCmdLine, | 311 "cmdline" : RunCmdLine, |
| 275 "pdfium_unittests": TestPDFiumUnitTests, | 312 "pdfium_unittests": TestPDFiumUnitTests, |
| 276 "pdfium_embeddertests": TestPDFiumEmbedderTests, | 313 "pdfium_embeddertests": TestPDFiumEmbedderTests, |
| 314 "pdfium_javascript": TestPDFiumJavascript, | |
|
Lei Zhang
2015/11/20 00:17:47
Can we sort the list?
zhaoqin1
2015/11/21 04:20:45
Done.
| |
| 315 "pdfium_pixel": TestPDFiumPixel, | |
| 316 "pdfium_corpus": TestPDFiumCorpus, | |
| 277 } | 317 } |
| 278 | 318 |
| 279 | 319 |
| 280 def _main(): | 320 def _main(): |
| 281 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " | 321 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " |
| 282 "[-t <test> ...]") | 322 "[-t <test> ...]") |
| 283 | 323 |
| 284 parser.add_option("--help-tests", dest="help_tests", action="store_true", | 324 parser.add_option("--help-tests", dest="help_tests", action="store_true", |
| 285 default=False, help="List all available tests") | 325 default=False, help="List all available tests") |
| 286 parser.add_option("-b", "--build-dir", | 326 parser.add_option("-b", "--build-dir", |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 | 384 |
| 345 for t in options.test: | 385 for t in options.test: |
| 346 tests = ChromeTests(options, args, t) | 386 tests = ChromeTests(options, args, t) |
| 347 ret = tests.Run() | 387 ret = tests.Run() |
| 348 if ret: return ret | 388 if ret: return ret |
| 349 return 0 | 389 return 0 |
| 350 | 390 |
| 351 | 391 |
| 352 if __name__ == "__main__": | 392 if __name__ == "__main__": |
| 353 sys.exit(_main()) | 393 sys.exit(_main()) |
| OLD | NEW |