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

Side by Side Diff: testing/tools/common.py

Issue 1898353004: Revert of Re-Reland Combined test runner. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months 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 | « testing/resources/pixel/font_size.pdf ('k') | testing/tools/run_corpus_tests.py » ('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 2015 The PDFium Authors. All rights reserved. 2 # Copyright 2015 The PDFium 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 import glob 6 import glob
7 import os 7 import os
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 10
11 def os_name(): 11 def os_name():
12 if sys.platform.startswith('linux'): 12 if sys.platform.startswith('linux'):
13 return 'linux' 13 return 'linux'
14 if sys.platform.startswith('win'): 14 if sys.platform.startswith('win'):
15 return 'win' 15 return 'win'
16 if sys.platform.startswith('darwin'): 16 if sys.platform.startswith('darwin'):
17 return 'mac' 17 return 'mac'
18 raise Exception('Confused, can not determine OS, aborting.') 18 raise Exception('Confused, can not determine OS, aborting.')
19 19
20 20
21 def RunCommandToFile(cmd, file):
22 try:
23 subprocess.check_call(cmd, stdout=file)
24 return None
25 except subprocess.CalledProcessError as e:
26 return e
27
28 def RunCommand(cmd, redirect_output=False): 21 def RunCommand(cmd, redirect_output=False):
29 try: 22 try:
30 if redirect_output: 23 if redirect_output:
31 sys.stdout.write(subprocess.check_output(cmd, stderr=subprocess.STDOUT)) 24 sys.stdout.write(subprocess.check_output(cmd, stderr=subprocess.STDOUT))
32 else: 25 else:
33 subprocess.check_call(cmd) 26 subprocess.check_call(cmd)
34 return None 27 return None
35 except subprocess.CalledProcessError as e: 28 except subprocess.CalledProcessError as e:
36 return e 29 return e
37 30
38
39 # Adjust Dr. Memory wrapper to have separate log directory for each test 31 # Adjust Dr. Memory wrapper to have separate log directory for each test
40 # for better error reporting. 32 # for better error reporting.
41 def DrMemoryWrapper(wrapper, pdf_name): 33 def DrMemoryWrapper(wrapper, pdf_name):
42 if not wrapper: 34 if not wrapper:
43 return [] 35 return []
44 # convert string to list 36 # convert string to list
45 cmd_to_run = wrapper.split() 37 cmd_to_run = wrapper.split()
46 38
47 # Do nothing if using default log directory. 39 # Do nothing if using default log directory.
48 if cmd_to_run.count("-logdir") == 0: 40 if cmd_to_run.count("-logdir") == 0:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if other_components: 106 if other_components:
115 result = os.path.join(result, other_components) 107 result = os.path.join(result, other_components)
116 return result 108 return result
117 109
118 def TestingDir(self, other_components=''): 110 def TestingDir(self, other_components=''):
119 '''Finds test files somewhere under the testing directory.''' 111 '''Finds test files somewhere under the testing directory.'''
120 result = self.testing_dir 112 result = self.testing_dir
121 if other_components: 113 if other_components:
122 result = os.path.join(result, other_components) 114 result = os.path.join(result, other_components)
123 return result 115 return result
OLDNEW
« no previous file with comments | « testing/resources/pixel/font_size.pdf ('k') | testing/tools/run_corpus_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698