summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-03-17 13:25:09 -0700
committerTom Sepez <tsepez@chromium.org>2015-03-17 13:25:09 -0700
commit2c4f5eaa7bdad0454c311a1cc41f43e4238e4308 (patch)
tree04b30cbb43d74712b04c4e9dd89ba02fc4cd4bfb
parenta4161734ee7f2b64cbe3431385a4b4c9a426ca47 (diff)
downloadpdfium-2c4f5eaa7bdad0454c311a1cc41f43e4238e4308.tar.xz
Return OS status code from python test driver scripts.
Consequently, some of the tests may diff but the waterfall remains green. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1014083003
-rwxr-xr-xtesting/tools/run_corpus_tests.py11
-rwxr-xr-xtesting/tools/run_javascript_tests.py11
-rwxr-xr-xtesting/tools/run_pixel_tests.py11
3 files changed, 24 insertions, 9 deletions
diff --git a/testing/tools/run_corpus_tests.py b/testing/tools/run_corpus_tests.py
index 674334f33e..2f6de07212 100755
--- a/testing/tools/run_corpus_tests.py
+++ b/testing/tools/run_corpus_tests.py
@@ -39,6 +39,8 @@ def test_one_file(input_filename, source_dir, working_dir,
i += 1
except subprocess.CalledProcessError as e:
print "FAILURE: " + input_filename + "; " + str(e)
+ return False
+ return True
def main():
parser = optparse.OptionParser()
@@ -83,6 +85,7 @@ def main():
os.makedirs(working_dir)
# test files are under .../pdfium/testing/corpus.
+ os_exit_code = 0
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):
@@ -90,9 +93,11 @@ def main():
if input_file_re.match(input_filename):
input_path = os.path.join(source_dir, input_filename)
if os.path.isfile(input_path):
- test_one_file(input_filename, source_dir, working_dir,
- pdfium_test_path, pdfium_diff_path)
- return 0
+ if not test_one_file(input_filename, source_dir, working_dir,
+ pdfium_test_path, pdfium_diff_path):
+ os_exit_code = 1
+
+ return os_exit_code
if __name__ == '__main__':
diff --git a/testing/tools/run_javascript_tests.py b/testing/tools/run_javascript_tests.py
index 4361ea08f9..ddc82665d5 100755
--- a/testing/tools/run_javascript_tests.py
+++ b/testing/tools/run_javascript_tests.py
@@ -30,6 +30,8 @@ def generate_and_test(input_filename, source_dir, working_dir,
subprocess.check_call(['diff', expected_path, txt_path])
except subprocess.CalledProcessError as e:
print "FAILURE: " + input_filename + "; " + str(e)
+ return False
+ return True
def main():
parser = optparse.OptionParser()
@@ -78,14 +80,17 @@ def main():
if not os.path.exists(working_dir):
os.makedirs(working_dir)
+ os_exit_code = 0
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):
input_path = os.path.join(source_dir, input_filename)
if os.path.isfile(input_path):
- generate_and_test(input_filename, source_dir, working_dir,
- fixup_path, pdfium_test_path)
- return 0
+ if not generate_and_test(input_filename, source_dir, working_dir,
+ fixup_path, pdfium_test_path):
+ os_exit_code = 1
+
+ return os_exit_code
if __name__ == '__main__':
diff --git a/testing/tools/run_pixel_tests.py b/testing/tools/run_pixel_tests.py
index 3cd9a0a060..9bd321b560 100755
--- a/testing/tools/run_pixel_tests.py
+++ b/testing/tools/run_pixel_tests.py
@@ -40,6 +40,8 @@ def generate_and_test(input_filename, source_dir, working_dir,
i += 1
except subprocess.CalledProcessError as e:
print "FAILURE: " + input_filename + "; " + str(e)
+ return False
+ return True
def main():
parser = optparse.OptionParser()
@@ -90,14 +92,17 @@ def main():
if not os.path.exists(working_dir):
os.makedirs(working_dir)
+ os_exit_code = 0
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):
input_path = os.path.join(source_dir, input_filename)
if os.path.isfile(input_path):
- generate_and_test(input_filename, source_dir, working_dir,
- fixup_path, pdfium_test_path, pdfium_diff_path)
- return 0
+ 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
if __name__ == '__main__':