vmcheck/multitest: Time execution of each test

For some reason c7 is consistently timing out, let's gather
data on how long our tests take to execute.

Closes: #1676
Approved by: cgwalters
This commit is contained in:
Colin Walters 2018-11-15 09:03:20 -05:00 committed by Atomic Bot
parent 33178cb621
commit c08e9620d6

View File

@ -76,6 +76,7 @@ class Host:
self.hostname = hostname
self.test = ""
self._p = None
self._starttime = None
self.saw_fail = False
def is_done(self):
@ -94,6 +95,7 @@ class Host:
if not os.path.isdir("vmcheck"):
os.mkdir("vmcheck")
testsh = os.path.join(sys.path[0], "test.sh")
self._starttime = time.time()
self._p = subprocess.Popen([testsh], env=env,
stdout=open("vmcheck/%s.log" % test, 'wb'),
stderr=subprocess.STDOUT)
@ -104,6 +106,7 @@ class Host:
if not self._p:
return 0
rc = self._p.wait()
endtime = time.time()
# just merge the two files
outfile = "vmcheck/{}.out".format(self.test)
@ -114,7 +117,7 @@ class Host:
os.remove(outfile)
rcs = "PASS" if rc == 0 else ("FAIL (rc %d)" % rc)
print("%s: %s" % (rcs, self.test))
print("{}: {} (took {}s)".format(rcs, self.test, int(endtime - self._starttime)))
self.test = ""
self._p = None