aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/mutation/init.py
diff options
context:
space:
mode:
authorSandeep Hegde <dsandeephegde@gmail.com>2017-10-24 22:16:48 -0400
committerSandeep Hegde <dsandeephegde@gmail.com>2017-11-06 13:00:12 -0500
commitba2152900cc0aa82e62905033e943fb3e4320945 (patch)
tree087e04d17b1483bae08bab3b306d6fd6497a6c77 /python/servo/mutation/init.py
parent0d2ad9a5beebfb2ac19e99139dd6ddb747bb4bbb (diff)
downloadservo-ba2152900cc0aa82e62905033e943fb3e4320945.tar.gz
servo-ba2152900cc0aa82e62905033e943fb3e4320945.zip
Added Test Mapping framework and running through a path.
Diffstat (limited to 'python/servo/mutation/init.py')
-rw-r--r--python/servo/mutation/init.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/python/servo/mutation/init.py b/python/servo/mutation/init.py
new file mode 100644
index 00000000000..e3d4aea9bcd
--- /dev/null
+++ b/python/servo/mutation/init.py
@@ -0,0 +1,29 @@
+from os import listdir
+from os.path import isfile, isdir, join
+import json
+import sys
+import test
+
+def get_folders_list(path):
+ folder_list = []
+ for filename in listdir(path):
+ if (isdir(join(path, filename))):
+ folder_name = join(path,filename)
+ folder_list.append(folder_name)
+ return(folder_list)
+
+def mutation_test_for(mutation_path):
+ test_mapping_file = join(mutation_path, 'Test_mapping.json')
+ if(isfile(test_mapping_file)):
+ json_data = open(test_mapping_file).read()
+ test_mapping = json.loads(json_data)
+
+ for src_file in test_mapping.keys():
+ test.mutation_test(join(mutation_path,src_file.encode('utf-8')), test_mapping[src_file])
+
+ for folder in get_folders_list(mutation_path):
+ mutation_test_for(folder)
+ else:
+ print ("This folder %s has no test mapping file." %(mutation_path))
+
+mutation_test_for(sys.argv[1])