summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-05-02 11:40:40 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-05-08 10:20:55 -0700
commit401e4b6a198621ccc6620366788975e9ea5eca66 (patch)
treea06d20f9261b1d4a5da50345305176a44baa58f6
parente87a6e1011f46ac896c0bab1c64a3383dce6cb38 (diff)
crucible: use tempfiles to allow running with concurrency
Because concurrency is nice. v2: - squash always remove tempfile into this (Juan) Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
-rw-r--r--tests/crucible.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/crucible.py b/tests/crucible.py
index 796d0951a..476869a31 100644
--- a/tests/crucible.py
+++ b/tests/crucible.py
@@ -30,6 +30,7 @@ from __future__ import (
import os
import six
import subprocess
+import tempfile
from framework import grouptools, backends, exceptions
from framework.core import PIGLIT_CONFIG
@@ -49,16 +50,20 @@ if crucible_bin is None:
class CrucibleTest(Test):
"""Test representation for Crucible"""
def __init__(self, case_name):
- command = [crucible_bin, 'run', '--junit-xml=crucible.xml', case_name]
+ self.__out_xml = tempfile.NamedTemporaryFile(delete=True).name
+ command = [crucible_bin, 'run',
+ '--junit-xml={}'.format(self.__out_xml), case_name]
self._case = case_name
super(CrucibleTest, self).__init__(command)
def interpret_result(self):
- test = backends.junit.REGISTRY.load('crucible.xml', 'none')
- result = test.get_result(next(six.iterkeys(test.tests)))
- self.result.result = result.name
- os.remove('crucible.xml')
- super(CrucibleTest, self).interpret_result()
+ try:
+ test = backends.junit.REGISTRY.load(self.__out_xml, 'none')
+ result = test.get_result(next(six.iterkeys(test.tests)))
+ self.result.result = result.name
+ super(CrucibleTest, self).interpret_result()
+ finally:
+ os.remove(self.__out_xml)
def gen_caselist_txt(bin_):
with open('crucible.txt', 'w') as d: