mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-16 14:41:55 -06:00
tests/functional: switch over to using self.log_file(...)
This removes direct access of the 'self.logdir' variable. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-12-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
f84f8e71eb
commit
bcc12768c2
2 changed files with 5 additions and 8 deletions
|
@ -126,7 +126,7 @@ class QemuBaseTest(unittest.TestCase):
|
||||||
Returns: string representing a file path
|
Returns: string representing a file path
|
||||||
'''
|
'''
|
||||||
def log_file(self, *args):
|
def log_file(self, *args):
|
||||||
return str(Path(self.logdir, *args))
|
return str(Path(self.outputdir, *args))
|
||||||
|
|
||||||
def setUp(self, bin_prefix):
|
def setUp(self, bin_prefix):
|
||||||
self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be set')
|
self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be set')
|
||||||
|
@ -138,8 +138,7 @@ class QemuBaseTest(unittest.TestCase):
|
||||||
self.workdir = os.path.join(self.outputdir, 'scratch')
|
self.workdir = os.path.join(self.outputdir, 'scratch')
|
||||||
os.makedirs(self.workdir, exist_ok=True)
|
os.makedirs(self.workdir, exist_ok=True)
|
||||||
|
|
||||||
self.logdir = self.outputdir
|
self.log_filename = self.log_file('base.log')
|
||||||
self.log_filename = os.path.join(self.logdir, 'base.log')
|
|
||||||
self.log = logging.getLogger('qemu-test')
|
self.log = logging.getLogger('qemu-test')
|
||||||
self.log.setLevel(logging.DEBUG)
|
self.log.setLevel(logging.DEBUG)
|
||||||
self._log_fh = logging.FileHandler(self.log_filename, mode='w')
|
self._log_fh = logging.FileHandler(self.log_filename, mode='w')
|
||||||
|
@ -215,7 +214,7 @@ class QemuSystemTest(QemuBaseTest):
|
||||||
|
|
||||||
console_log = logging.getLogger('console')
|
console_log = logging.getLogger('console')
|
||||||
console_log.setLevel(logging.DEBUG)
|
console_log.setLevel(logging.DEBUG)
|
||||||
self.console_log_name = os.path.join(self.logdir, 'console.log')
|
self.console_log_name = self.log_file('console.log')
|
||||||
self._console_log_fh = logging.FileHandler(self.console_log_name,
|
self._console_log_fh = logging.FileHandler(self.console_log_name,
|
||||||
mode='w')
|
mode='w')
|
||||||
self._console_log_fh.setLevel(logging.DEBUG)
|
self._console_log_fh.setLevel(logging.DEBUG)
|
||||||
|
@ -269,7 +268,7 @@ class QemuSystemTest(QemuBaseTest):
|
||||||
vm = QEMUMachine(self.qemu_bin,
|
vm = QEMUMachine(self.qemu_bin,
|
||||||
name=name,
|
name=name,
|
||||||
base_temp_dir=self.workdir,
|
base_temp_dir=self.workdir,
|
||||||
log_dir=self.logdir)
|
log_dir=self.log_file())
|
||||||
self.log.debug('QEMUMachine "%s" created', name)
|
self.log.debug('QEMUMachine "%s" created', name)
|
||||||
self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir)
|
self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir)
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,7 @@ class VirtioGPUx86(QemuSystemTest):
|
||||||
os.set_inheritable(qemu_sock.fileno(), True)
|
os.set_inheritable(qemu_sock.fileno(), True)
|
||||||
os.set_inheritable(vug_sock.fileno(), True)
|
os.set_inheritable(vug_sock.fileno(), True)
|
||||||
|
|
||||||
self._vug_log_path = os.path.join(
|
self._vug_log_path = self.log_file("vhost-user-gpu.log")
|
||||||
self.logdir, "vhost-user-gpu.log"
|
|
||||||
)
|
|
||||||
self._vug_log_file = open(self._vug_log_path, "wb")
|
self._vug_log_file = open(self._vug_log_path, "wb")
|
||||||
self.log.info('Complete vhost-user-gpu.log file can be '
|
self.log.info('Complete vhost-user-gpu.log file can be '
|
||||||
'found at %s', self._vug_log_path)
|
'found at %s', self._vug_log_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue