[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v5 07/10] qemu-iotests: run python tests in own subd
From: |
Jeff Cody |
Subject: |
[Qemu-block] [PATCH v5 07/10] qemu-iotests: run python tests in own subdirectories |
Date: |
Tue, 17 Oct 2017 12:31:52 -0400 |
This adds the framework to iotests.py to run python iotests in a
subdirectory structure, structured like so:
scratch/
├── TestNumber
│ ├── TestClassName
│ │ ├── test_method_name
Prior to this patch, tests were run in a test subdirectory from
previous patches in the series, like this:
scratch/
├── TestNumber
However, given the nature of python's unittest framework, additional
subdirectories are needed, if we want to insure that we can save
intermediate files in case of test failures (as we will do in a
subsequent patch) without running the risk of tainting other test
methods from the test file.
In python tests using iiotests.QMPTestCase, any reference to
'iotests.test_dir' should be replaced by 'self.workdir'. This
may also require changing the scope of path name variables.
Suggested-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
---
tests/qemu-iotests/iotests.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 6f05790..7ff400a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -262,6 +262,17 @@ index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
class QMPTestCase(unittest.TestCase):
'''Abstract base class for QMP test cases'''
+ def __init__(self, *args):
+ super(QMPTestCase, self).__init__(*args)
+ self.workdir = os.path.join(test_dir, self.__class__.__name__,
+ self._testMethodName)
+ try:
+ os.makedirs(self.workdir)
+ except OSError, error:
+ if error.errno != errno.EEXIST:
+ raise
+ os.chdir(self.workdir)
+
def dictpath(self, d, path):
'''Traverse a path in a nested dict'''
for component in path.split('/'):
--
2.9.5
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, (continued)
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Jeff Cody, 2017/10/18
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Paolo Bonzini, 2017/10/18
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Jeff Cody, 2017/10/18
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Paolo Bonzini, 2017/10/19
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Jeff Cody, 2017/10/19
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Paolo Bonzini, 2017/10/19
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Eric Blake, 2017/10/18
- Re: [Qemu-block] [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers, Daniel P. Berrange, 2017/10/18
[Qemu-block] [PATCH v5 06/10] qemu-iotests: make ./check automatically reap QEMU processes, Jeff Cody, 2017/10/17
[Qemu-block] [PATCH v5 07/10] qemu-iotests: run python tests in own subdirectories,
Jeff Cody <=
[Qemu-block] [PATCH v5 04/10] qemu-iotests: remove file cleanup from bash tests, Jeff Cody, 2017/10/17
[Qemu-block] [PATCH v5 09/10] qemu-iotests: add option to save temp files on error, Jeff Cody, 2017/10/17
[Qemu-block] [PATCH v5 10/10] qemu-iotests: add support for running multi-threaded iotests, Jeff Cody, 2017/10/17
[Qemu-block] [PATCH v5 08/10] qemu-iotests: modify python tests to run from subdir, Jeff Cody, 2017/10/17