summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-03-23 11:31:24 -0700
committerTom Sepez <tsepez@chromium.org>2015-03-23 11:31:24 -0700
commitda06966129f0a8ab918d2e28a3aae00bee237308 (patch)
treef92a0ec07c219a2e97430c5dc363f28a3b978e55 /testing
parentb0115665b0f33971f1b7077740d51e155583cec0 (diff)
downloadpdfium-da06966129f0a8ab918d2e28a3aae00bee237308.tar.xz
Flush stdout before launching sub-processes.
This should make the test logs more readable. Also give failure summary at end of tests, since searching through the log is tedious. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1026903002
Diffstat (limited to 'testing')
-rwxr-xr-xtesting/tools/run_corpus_tests.py14
-rwxr-xr-xtesting/tools/run_javascript_tests.py12
-rwxr-xr-xtesting/tools/run_pixel_tests.py14
3 files changed, 30 insertions, 10 deletions
diff --git a/testing/tools/run_corpus_tests.py b/testing/tools/run_corpus_tests.py
index 2f6de07212..3cfc3e7dbb 100755
--- a/testing/tools/run_corpus_tests.py
+++ b/testing/tools/run_corpus_tests.py
@@ -24,6 +24,7 @@ def test_one_file(input_filename, source_dir, working_dir,
expected_path_template = os.path.join(source_dir,
input_root + '_expected.pdf.%d.png')
try:
+ sys.stdout.flush()
subprocess.check_call(['cp', input_path, pdf_path])
subprocess.check_call([pdfium_test_path, '--png', pdf_path])
i = 0;
@@ -35,6 +36,7 @@ def test_one_file(input_filename, source_dir, working_dir,
print "WARNING: no expected results files found for " + input_filename
break
print "Checking " + actual_path
+ sys.stdout.flush()
subprocess.check_call([pdfium_diff_path, expected_path, actual_path])
i += 1
except subprocess.CalledProcessError as e:
@@ -85,7 +87,7 @@ def main():
os.makedirs(working_dir)
# test files are under .../pdfium/testing/corpus.
- os_exit_code = 0
+ failures = []
walk_from_dir = os.path.join(testing_dir, 'corpus');
input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$')
for source_dir, _, filename_list in os.walk(walk_from_dir):
@@ -95,9 +97,15 @@ def main():
if os.path.isfile(input_path):
if not test_one_file(input_filename, source_dir, working_dir,
pdfium_test_path, pdfium_diff_path):
- os_exit_code = 1
+ failures.append(input_path)
- return os_exit_code
+ if failures:
+ print '\n\nSummary of Failures:'
+ for failure in failures:
+ print failure
+ return 1
+
+ return 0
if __name__ == '__main__':
diff --git a/testing/tools/run_javascript_tests.py b/testing/tools/run_javascript_tests.py
index ddc82665d5..fd9cf5f870 100755
--- a/testing/tools/run_javascript_tests.py
+++ b/testing/tools/run_javascript_tests.py
@@ -23,6 +23,7 @@ def generate_and_test(input_filename, source_dir, working_dir,
txt_path = os.path.join(working_dir, input_root + '.txt')
expected_path = os.path.join(source_dir, input_root + '_expected.txt')
try:
+ sys.stdout.flush()
subprocess.check_call(
[fixup_path, '--output-dir=' + working_dir, input_path])
with open(txt_path, 'w') as outfile:
@@ -80,7 +81,7 @@ def main():
if not os.path.exists(working_dir):
os.makedirs(working_dir)
- os_exit_code = 0
+ failures = []
input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$')
for input_filename in os.listdir(source_dir):
if input_file_re.match(input_filename):
@@ -88,9 +89,14 @@ def main():
if os.path.isfile(input_path):
if not generate_and_test(input_filename, source_dir, working_dir,
fixup_path, pdfium_test_path):
- os_exit_code = 1
+ failures.append(input_path)
- return os_exit_code
+ if failures:
+ print '\n\nSummary of Failures:'
+ for failure in failures:
+ print failure
+ return 1
+ return 0
if __name__ == '__main__':
diff --git a/testing/tools/run_pixel_tests.py b/testing/tools/run_pixel_tests.py
index 9bd321b560..ef2c31ef47 100755
--- a/testing/tools/run_pixel_tests.py
+++ b/testing/tools/run_pixel_tests.py
@@ -24,6 +24,7 @@ def generate_and_test(input_filename, source_dir, working_dir,
expected_path_template = os.path.join(source_dir,
input_root + '_expected.pdf.%d.png')
try:
+ sys.stdout.flush()
subprocess.check_call(
[fixup_path, '--output-dir=' + working_dir, input_path])
subprocess.check_call([pdfium_test_path, '--png', pdf_path])
@@ -36,6 +37,7 @@ def generate_and_test(input_filename, source_dir, working_dir,
print "WARNING: no expected results files found for " + input_filename
break
print "Checking " + actual_path
+ sys.stdout.flush()
subprocess.check_call([pdfium_diff_path, expected_path, actual_path])
i += 1
except subprocess.CalledProcessError as e:
@@ -92,7 +94,7 @@ def main():
if not os.path.exists(working_dir):
os.makedirs(working_dir)
- os_exit_code = 0
+ failures = []
input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$')
for input_filename in os.listdir(source_dir):
if input_file_re.match(input_filename):
@@ -100,10 +102,14 @@ def main():
if os.path.isfile(input_path):
if not generate_and_test(input_filename, source_dir, working_dir,
fixup_path, pdfium_test_path, pdfium_diff_path):
- os_exit_code = 1
-
- return os_exit_code
+ failures.append(input_path)
+ if failures:
+ print '\n\nSummary of Failures:'
+ for failure in failures:
+ print failure
+ return 1
+ return 0
if __name__ == '__main__':
sys.exit(main())