aboutsummaryrefslogtreecommitdiff
path: root/tests/avocado
diff options
context:
space:
mode:
authorAni Sinha <ani@anisinha.ca>2022-11-17 17:06:30 +0530
committerMichael S. Tsirkin <mst@redhat.com>2022-11-22 05:19:00 -0500
commit04e5bd441a9c60d21d38beb1b2b52ce12830cb99 (patch)
tree9e6b311e0b55d37d87954290f101a6f565e4b084 /tests/avocado
parentc4d4c40c516a52419be8ed2e1e7a7c1fd0dea3ee (diff)
acpi/tests/avocado/bits: keep the work directory when BITS_DEBUG is set in env
Debugging bits issue often involves running the QEMU command line manually outside of the avocado environment with the generated ISO. Hence, its inconvenient if the iso gets cleaned up after the test has finished. This change makes sure that the work directory is kept after the test finishes if the test is run with BITS_DEBUG=1 in the environment so that the iso is available for use with the QEMU command line. CC: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Ani Sinha <ani@anisinha.ca> Message-Id: <20221117113630.543495-1-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tests/avocado')
-rw-r--r--tests/avocado/acpi-bits.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/avocado/acpi-bits.py b/tests/avocado/acpi-bits.py
index ac13e22dc9..4be663968c 100644
--- a/tests/avocado/acpi-bits.py
+++ b/tests/avocado/acpi-bits.py
@@ -260,7 +260,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
self.logger.info('using grub-mkrescue for generating biosbits iso ...')
try:
- if os.getenv('V'):
+ if os.getenv('V') or os.getenv('BITS_DEBUG'):
subprocess.check_call([mkrescue_script, '-o', iso_file,
bits_dir], stderr=subprocess.STDOUT)
else:
@@ -344,7 +344,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
self._print_log(log)
raise e
else:
- if os.getenv('V'):
+ if os.getenv('V') or os.getenv('BITS_DEBUG'):
self._print_log(log)
def tearDown(self):
@@ -353,8 +353,13 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
"""
if self._vm:
self.assertFalse(not self._vm.is_running)
- self.logger.info('removing the work directory %s', self._workDir)
- shutil.rmtree(self._workDir)
+ if not os.getenv('BITS_DEBUG'):
+ self.logger.info('removing the work directory %s', self._workDir)
+ shutil.rmtree(self._workDir)
+ else:
+ self.logger.info('not removing the work directory %s ' \
+ 'as BITS_DEBUG is ' \
+ 'passed in the environment', self._workDir)
super().tearDown()
def test_acpi_smbios_bits(self):