tests/functional: switch over to using self.scratch_file()

Replace any instances of

  os.path.join(self.workdir, ".../...")
  self.workdir + "/.../..."

with

  self.scratch_file("...", "...")

which is more compact and portable

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-15-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-12-17 15:59:35 +00:00 committed by Thomas Huth
parent bd96e460d3
commit beaf88c895
45 changed files with 118 additions and 139 deletions

View file

@ -4,7 +4,6 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os
import shutil
from qemu_test import LinuxKernelTest, Asset
@ -22,11 +21,12 @@ class R2dEBTest(LinuxKernelTest):
file_path = self.ASSET_TGZ.fetch()
archive_extract(file_path, self.workdir)
self.vm.add_args('-append', 'console=ttySC1 noiotrap')
self.launch_kernel(os.path.join(self.workdir, 'sh4eb/linux-kernel'),
initrd=os.path.join(self.workdir, 'sh4eb/initramfs.cpio.gz'),
self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'),
initrd=self.scratch_file('sh4eb',
'initramfs.cpio.gz'),
console_index=1, wait_for='Type exit when done')
exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system')
shutil.rmtree(os.path.join(self.workdir, 'sh4eb'))
shutil.rmtree(self.scratch_file('sh4eb'))
if __name__ == '__main__':
LinuxKernelTest.main()