summaryrefslogtreecommitdiff
path: root/scripts/Util.py
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-07-11 11:39:29 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-07-11 11:39:29 +0200
commit9cb65142b7ce6fdf3a8ad6458ef78ba2b8f3a1a9 (patch)
tree6deaf4d4580d64bfb3468a1cb231227df28d8d11 /scripts/Util.py
parentAdded JUnit XML reports to allTests.py (diff)
downloadice-9cb65142b7ce6fdf3a8ad6458ef78ba2b8f3a1a9.tar.bz2
ice-9cb65142b7ce6fdf3a8ad6458ef78ba2b8f3a1a9.tar.xz
ice-9cb65142b7ce6fdf3a8ad6458ef78ba2b8f3a1a9.zip
Revert "Added JUnit XML reports to allTests.py"
This reverts commit 2d8b44932779f887ce47c43e25dbda72b817e45d.
Diffstat (limited to 'scripts/Util.py')
-rw-r--r--scripts/Util.py61
1 files changed, 4 insertions, 57 deletions
diff --git a/scripts/Util.py b/scripts/Util.py
index c792a187257..7d83362842d 100644
--- a/scripts/Util.py
+++ b/scripts/Util.py
@@ -9,8 +9,6 @@
import os, sys, runpy, getopt, traceback, types, threading, time, datetime, re, itertools, random, subprocess, shutil, copy, inspect
-import xml.sax.saxutils
-
isPython2 = sys.version_info[0] == 2
if isPython2:
import Queue as queue
@@ -50,13 +48,6 @@ def val(v, escapeQuotes=False, quoteValue=True):
else:
return str(v)
-def escape(s):
- # Remove backspace characters from the output (they aren't accepted by Jenkins XML parser)
- if isPython2:
- return xml.sax.saxutils.escape("".join(ch for ch in unicode(s) if ch != u"\u0008").encode("utf-8"))
- else:
- return xml.sax.saxutils.escape("".join(ch for ch in s if ch != u"\u0008"))
-
def getIceSoVersion():
config = open(os.path.join(toplevel, "cpp", "include", "IceUtil", "Config.h"), "r")
intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1))
@@ -1556,14 +1547,13 @@ class Result:
def __init__(self, testsuite, writeToStdout):
self.testsuite = testsuite
+ self._skipped = []
self._failed = {}
self._succeeded = []
- self._skipped = []
self._stdout = StringIO()
self._writeToStdout = writeToStdout
self._testcases = {}
self._duration = 0
- self._testCaseDuration = 0;
def start(self):
self._duration = time.time()
@@ -1572,13 +1562,11 @@ class Result:
self._duration = time.time() - self._duration
def started(self, testcase):
- self._testCaseDuration = time.time();
self._start = self._stdout.tell()
def failed(self, testcase, exception):
- self._testCaseDuration = time.time() - self._testCaseDuration;
self.writeln("\ntest in {0} failed:\n{1}".format(self.testsuite, exception))
- self._testcases[testcase] = (self._start, self._stdout.tell(), self._testCaseDuration)
+ self._testcases[testcase] = (self._start, self._stdout.tell())
self._failed[testcase] = exception
output = self.getOutput(testcase)
for s in ["EADDRINUSE", "Address already in use"]:
@@ -1590,16 +1578,9 @@ class Result:
self.writeln(run("lsof -n -P -i; ps ax"))
def succeeded(self, testcase):
- self._testCaseDuration = time.time() - self._testCaseDuration;
- self._testcases[testcase] = (self._start, self._stdout.tell(), self._testCaseDuration)
+ self._testcases[testcase] = (self._start, self._stdout.tell())
self._succeeded.append(testcase)
- def skipped(self, testcase, reason):
- self._start = self._stdout.tell()
- self.writeln("skipped, " + reason)
- self._testcases[testcase] = (self._start, self._stdout.tell(), 0)
- self._skipped[testcase] = reason
-
def isSuccess(self):
return len(self._failed) == 0
@@ -1612,7 +1593,7 @@ class Result:
def getOutput(self, testcase=None):
if testcase:
if testcase in self._testcases:
- (start, end, duration) = self._testcases[testcase]
+ (start, end) = self._testcases[testcase]
self._stdout.seek(start)
try:
return self._stdout.read(end - start)
@@ -1651,40 +1632,6 @@ class Result:
self._stdout.write(msg)
self._stdout.write("\n")
- def writeAsXml(self, out, hostname=""):
- out.write(' <testsuite tests="{0}" failures="{1}" skipped="{2}" time="{3}" name="{4}">\n'
- .format(len(self._testcases) - 2,
- len(self._failed),
- len(self._skipped),
- self._duration,
- self.testsuite))
-
- for (tc, v) in self._testcases.items():
- if isinstance(tc, TestCase):
- (s, e, d) = v
- out.write(' <testcase name="{0}" time="{1}" classname="{2}.{3}">\n'
- .format(tc,
- d,
- self.testsuite.getMapping(),
- self.testsuite.getId().replace("/", ".")))
- if tc in self._failed:
- last = self._failed[tc].strip().split('\n')
- if len(last) > 0:
- last = last[len(last) - 1]
- if hostname:
- last = "Failed on {0}\n{1}".format(hostname, last)
- out.write(' <failure message="{1}">{0}</failure>\n'.format(escape(self._failed[tc]), last))
- elif tc in self._skipped:
- out.write(' <skipped message="{0}"/>\n'.format(escape(self._skipped[tc])))
- out.write(' <system-out>\n')
- if hostname:
- out.write('Running on {0}\n'.format(hostname))
- out.write(escape(self.getOutput(tc)))
- out.write(' </system-out>\n')
- out.write(' </testcase>\n')
-
- out.write( '</testsuite>\n')
-
class TestSuite:
def __init__(self, path, testcases=None, options=None, libDirs=None, runOnMainThread=False, chdir=False,