[2/4] crucible: use tempfiles to allow running with concurrency

Submitted by Dylan Baker on May 2, 2018, 8:57 p.m.

Details

Message ID 20180502205755.4207-2-dylan@pnwbakers.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Dylan Baker May 2, 2018, 8:57 p.m.
Because concurrency is nice.
---
 tests/crucible.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/crucible.py b/tests/crucible.py
index 796d0951a..71ccf9d70 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,18 @@  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')
+        test = backends.junit.REGISTRY.load(self.__out_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()
+        os.remove(self.__out_xml)
 
 def gen_caselist_txt(bin_):
     with open('crucible.txt', 'w') as d: