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

Unified Diff: testing/tools/run_corpus_tests.py

Issue 1407913005: Allow running individual tests. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | testing/tools/run_javascript_tests.py » ('j') | testing/tools/run_javascript_tests.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/tools/run_corpus_tests.py
diff --git a/testing/tools/run_corpus_tests.py b/testing/tools/run_corpus_tests.py
index b6cbff75377fe696575847d9aac080f64e429b9f..4461833fa618d21c970b62f3b34b6a2d640d9557 100755
--- a/testing/tools/run_corpus_tests.py
+++ b/testing/tools/run_corpus_tests.py
@@ -104,14 +104,22 @@ def main():
walk_from_dir = finder.TestingDir('corpus');
input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$')
test_cases = []
- for source_dir, _, filename_list in os.walk(walk_from_dir):
- for input_filename in filename_list:
- if input_file_re.match(input_filename):
- input_path = os.path.join(source_dir, input_filename)
- if os.path.isfile(input_path):
- test_cases.append((input_filename, source_dir))
- if options.num_workers > 1:
+ if len(args) != 0:
Tom Sepez 2015/10/28 20:25:48 nit: can just write if len(args):
dsinclair 2015/10/28 20:56:46 Done.
+ for file_name in args:
+ input_path = os.path.join(walk_from_dir, file_name)
+ if os.path.isfile(input_path):
Tom Sepez 2015/10/28 20:25:48 This is to filter out directories, you shouldn't b
dsinclair 2015/10/28 20:56:46 Done.
+ test_cases.append((os.path.basename(input_path),
+ os.path.dirname(input_path)))
Tom Sepez 2015/10/28 20:25:48 nit: this should line up under the above.
dsinclair 2015/10/28 20:56:46 Like this?
+ else:
+ for source_dir, _, filename_list in os.walk(walk_from_dir):
+ for input_filename in filename_list:
+ if input_file_re.match(input_filename):
+ input_path = os.path.join(source_dir, input_filename)
+ if os.path.isfile(input_path):
+ test_cases.append((input_filename, source_dir))
+
+ if options.num_workers > 1 and len(test_cases) > 1:
try:
pool = multiprocessing.Pool(options.num_workers)
worker_func = functools.partial(test_one_file_parallel, working_dir,
« no previous file with comments | « no previous file | testing/tools/run_javascript_tests.py » ('j') | testing/tools/run_javascript_tests.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698