mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
tests/functional: switch over to using self.data_file(...)
This removes direct path manipulation to figure out the source dir Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-14-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
8b5a0dd3a8
commit
bd96e460d3
1 changed files with 7 additions and 15 deletions
|
@ -38,7 +38,6 @@ import subprocess
|
||||||
import tarfile
|
import tarfile
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import (
|
from typing import (
|
||||||
List,
|
List,
|
||||||
Optional,
|
Optional,
|
||||||
|
@ -119,7 +118,6 @@ class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attribute
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._vm = None
|
self._vm = None
|
||||||
self._baseDir = None
|
|
||||||
|
|
||||||
self._debugcon_addr = '0x403'
|
self._debugcon_addr = '0x403'
|
||||||
self._debugcon_log = 'debugcon-log.txt'
|
self._debugcon_log = 'debugcon-log.txt'
|
||||||
|
@ -134,26 +132,22 @@ class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attribute
|
||||||
def copy_bits_config(self):
|
def copy_bits_config(self):
|
||||||
""" copies the bios bits config file into bits.
|
""" copies the bios bits config file into bits.
|
||||||
"""
|
"""
|
||||||
config_file = 'bits-cfg.txt'
|
bits_config_file = self.data_file('acpi-bits',
|
||||||
bits_config_dir = os.path.join(self._baseDir, 'acpi-bits',
|
'bits-config',
|
||||||
'bits-config')
|
'bits-cfg.txt')
|
||||||
target_config_dir = os.path.join(self.workdir,
|
target_config_dir = os.path.join(self.workdir,
|
||||||
'bits-%d' %self.BITS_INTERNAL_VER,
|
'bits-%d' %self.BITS_INTERNAL_VER,
|
||||||
'boot')
|
'boot')
|
||||||
self.assertTrue(os.path.exists(bits_config_dir))
|
self.assertTrue(os.path.exists(bits_config_file))
|
||||||
self.assertTrue(os.path.exists(target_config_dir))
|
self.assertTrue(os.path.exists(target_config_dir))
|
||||||
self.assertTrue(os.access(os.path.join(bits_config_dir,
|
shutil.copy2(bits_config_file, target_config_dir)
|
||||||
config_file), os.R_OK))
|
|
||||||
shutil.copy2(os.path.join(bits_config_dir, config_file),
|
|
||||||
target_config_dir)
|
|
||||||
self.logger.info('copied config file %s to %s',
|
self.logger.info('copied config file %s to %s',
|
||||||
config_file, target_config_dir)
|
bits_config_file, target_config_dir)
|
||||||
|
|
||||||
def copy_test_scripts(self):
|
def copy_test_scripts(self):
|
||||||
"""copies the python test scripts into bits. """
|
"""copies the python test scripts into bits. """
|
||||||
|
|
||||||
bits_test_dir = os.path.join(self._baseDir, 'acpi-bits',
|
bits_test_dir = self.data_file('acpi-bits', 'bits-tests')
|
||||||
'bits-tests')
|
|
||||||
target_test_dir = os.path.join(self.workdir,
|
target_test_dir = os.path.join(self.workdir,
|
||||||
'bits-%d' %self.BITS_INTERNAL_VER,
|
'bits-%d' %self.BITS_INTERNAL_VER,
|
||||||
'boot', 'python')
|
'boot', 'python')
|
||||||
|
@ -256,8 +250,6 @@ class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attribute
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.logger = self.log
|
self.logger = self.log
|
||||||
|
|
||||||
self._baseDir = Path(__file__).parent
|
|
||||||
|
|
||||||
prebuiltDir = os.path.join(self.workdir, 'prebuilt')
|
prebuiltDir = os.path.join(self.workdir, 'prebuilt')
|
||||||
if not os.path.isdir(prebuiltDir):
|
if not os.path.isdir(prebuiltDir):
|
||||||
os.mkdir(prebuiltDir, mode=0o775)
|
os.mkdir(prebuiltDir, mode=0o775)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue