summaryrefslogtreecommitdiff
path: root/tests/scripts/exclusion.py
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /tests/scripts/exclusion.py
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'tests/scripts/exclusion.py')
-rw-r--r--tests/scripts/exclusion.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/scripts/exclusion.py b/tests/scripts/exclusion.py
new file mode 100644
index 0000000000..87ea48521e
--- /dev/null
+++ b/tests/scripts/exclusion.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+#
+## Licensed to the .NET Foundation under one or more agreements.
+## The .NET Foundation licenses this file to you under the MIT license.
+## See the LICENSE file in the project root for more information.
+#
+##
+# Title :exclusion.py
+#
+# Script to create a new list file from the old list file by refelcting
+# exclusion project file (issues.target)
+#
+################################################################################
+
+import os
+import os.path
+import sys
+import re
+
+###############################################################################
+# Main
+################################################################################
+
+if __name__ == "__main__":
+ print "Starting exclusion"
+ print "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
+ print
+
+ if len(sys.argv) == 3:
+ # Update test file in place
+ issuesFile = sys.argv[1]
+ oldTestFile = sys.argv[2]
+ newTestFile = oldTestFile
+ elif len(sys.argv) == 4:
+ issuesFile = sys.argv[1]
+ oldTestFile = sys.argv[2]
+ newTestFile = sys.argv[3]
+ else:
+ print "Ex usage: python exclusion.py <issues profile file> <old lst file> {<new lst file>}"
+ exit(1)
+
+ with open(issuesFile) as issuesFileHandle:
+ issues = issuesFileHandle.readlines()
+
+ with open(oldTestFile) as oldTestsHandle:
+ oldTests = oldTestsHandle.readlines()
+
+ # Build exculsion set from issues
+ exclusions = set()
+ for i in range(len(issues)):
+ matchObj = re.search( r'(XunitTestBinBase\)\\)(.+)(\\)(.+)\"', issues[i])
+ if matchObj:
+ exclusions.add(matchObj.group(2));
+ print "Exclusions list from " + issuesFile + ": ", len(exclusions)
+
+ # Build new test by copying old test except the exclusion
+ removed = 0
+ with open(newTestFile, 'w') as newTestsHandle:
+ j = 0
+ while(j < len(oldTests)):
+ currLine = oldTests[j]
+ matchObj = re.search( r'[(.+)]', currLine)
+ if matchObj:
+ nextLine = oldTests[j+1]
+ matchObj = re.search( r'(RelativePath=)(.+)(\\)(.+)(.exe)', nextLine)
+ if matchObj:
+ relPath = matchObj.group(2)
+ if (relPath in exclusions):
+ # Skip to the next item. Currently each test consists of 7 lines.
+ removed += 1
+ j += 7
+ continue
+
+ newTestsHandle.write(currLine)
+ j += 1
+
+ print "Removed Tests: ", removed
+ print newTestFile + " is successfuly built."
+