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

@ -77,7 +77,7 @@ class BananaPiMachine(LinuxKernelTest):
dtb_path = '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-orangepi-pc.dtb'
dtb_path = self.extract_from_deb(deb_path, dtb_path)
initrd_path_gz = self.ASSET_INITRD.fetch()
initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
initrd_path = self.scratch_file('rootfs.cpio')
gzip_uncompress(initrd_path_gz, initrd_path)
self.vm.set_console()
@ -113,7 +113,7 @@ class BananaPiMachine(LinuxKernelTest):
dtb_path = '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-orangepi-pc.dtb'
dtb_path = self.extract_from_deb(deb_path, dtb_path)
rootfs_path_xz = self.ASSET_ROOTFS.fetch()
rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
rootfs_path = self.scratch_file('rootfs.cpio')
lzma_uncompress(rootfs_path_xz, rootfs_path)
image_pow2ceil_expand(rootfs_path)
@ -156,7 +156,7 @@ class BananaPiMachine(LinuxKernelTest):
# to 1036 MiB, but the underlying filesystem is 1552 MiB...
# As we expand it to 2 GiB we are safe.
image_path_xz = self.ASSET_ARMBIAN.fetch()
image_path = os.path.join(self.workdir, 'armbian.img')
image_path = self.scratch_file('armbian.img')
lzma_uncompress(image_path_xz, image_path)
image_pow2ceil_expand(image_path)
@ -197,7 +197,7 @@ class BananaPiMachine(LinuxKernelTest):
uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
uboot_path = self.extract_from_deb(deb_path, uboot_path)
image_path_gz = self.ASSET_NETBSD.fetch()
image_path = os.path.join(self.workdir, 'armv7.img')
image_path = self.scratch_file('armv7.img')
gzip_uncompress(image_path_gz, image_path)
image_pow2ceil_expand(image_path)
image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path