aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/mutation/init.py
diff options
context:
space:
mode:
authorSandeep Hegde <dsandeephegde@gmail.com>2017-11-12 01:18:29 -0500
committerSandeep Hegde <dsandeephegde@gmail.com>2017-11-12 23:43:04 -0500
commitcc6c2eea6ede64280684b5c98795a207c4b78192 (patch)
tree757d5ecb1bf74fa6ec65f2af8688f93e77ce2840 /python/servo/mutation/init.py
parentb8199e11e018d1e4fa35d3ebbe3dbf934cd258d2 (diff)
downloadservo-cc6c2eea6ede64280684b5c98795a207c4b78192.tar.gz
servo-cc6c2eea6ede64280684b5c98795a207c4b78192.zip
Added mutation test summary and made it exit with relevant exit code
Diffstat (limited to 'python/servo/mutation/init.py')
-rw-r--r--python/servo/mutation/init.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/python/servo/mutation/init.py b/python/servo/mutation/init.py
index 6087dc2500d..aa7b86c5f00 100644
--- a/python/servo/mutation/init.py
+++ b/python/servo/mutation/init.py
@@ -12,6 +12,12 @@ from os.path import isfile, isdir, join
import json
import sys
import test
+test_summary = {
+ test.Status.PASSED: 0,
+ test.Status.FAILED: 0,
+ test.Status.SKIPPED: 0,
+ test.Status.UNEXPECTED: 0
+}
def get_folders_list(path):
@@ -30,11 +36,18 @@ def mutation_test_for(mutation_path):
test_mapping = json.loads(json_data)
# Run mutation test for all source files in mapping file.
for src_file in test_mapping.keys():
- test.mutation_test(join(mutation_path, src_file.encode('utf-8')), test_mapping[src_file])
+ status = test.mutation_test(join(mutation_path, src_file.encode('utf-8')), test_mapping[src_file])
+ test_summary[status] += 1
# Run mutation test in all folder in the path.
for folder in get_folders_list(mutation_path):
mutation_test_for(folder)
else:
print("This folder {0} has no test mapping file.".format(mutation_path))
+
mutation_test_for(sys.argv[1])
+print "\nTest Summary:"
+for test_status in test_summary:
+ print "{0} : {1}".format(test_status.name, test_summary[test_status])
+if test_summary[test.Status.FAILED] or test_summary[test.Status.UNEXPECTED]:
+ sys.exit(1)