Skip to content

Commit

Permalink
tests/avocado: don't use tags to define drive
Browse files Browse the repository at this point in the history
We are abusing the avocado tags which are intended to provide test
selection metadata to provide parameters to our test. This works OK up
until the point you need to have ,'s in the field as this is the tag
separator character which is the case for a number of the drive
parameters. Fix this by making drive a parameter to the common helper
function.

Fixes: 267fe57 (tests: add tuxrun baseline test to avocado)
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230315174331.2959-11-alex.bennee@linaro.org>
  • Loading branch information
stsquad committed Mar 22, 2023
1 parent 6f6ca06 commit fb3af2d
Showing 1 changed file with 24 additions and 36 deletions.
60 changes: 24 additions & 36 deletions tests/avocado/tuxrun_baselines.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ def setUp(self):
# The name of the kernel Image file
self.image = self.get_tag('image', "Image")

# The block device drive type
self.drive = self.get_tag('drive', "virtio-blk-device")

self.root = self.get_tag('root', "vda")

# Occasionally we need extra devices to hook things up
Expand Down Expand Up @@ -99,7 +96,7 @@ def fetch_tuxrun_assets(self, dt=None):

return (kernel_image, self.workdir + "/rootfs.ext4", dtb)

def prepare_run(self, kernel, disk, dtb=None, console_index=0):
def prepare_run(self, kernel, disk, drive, dtb=None, console_index=0):
"""
Setup to run and add the common parameters to the system
"""
Expand All @@ -121,10 +118,8 @@ def prepare_run(self, kernel, disk, dtb=None, console_index=0):
if self.extradev:
self.vm.add_args('-device', self.extradev)

# Some machines already define a drive device
if self.drive != "none":
self.vm.add_args('-device',
f"{self.drive},drive=hd0")
self.vm.add_args('-device',
f"{drive},drive=hd0")

# Some machines need an explicit DTB
if dtb:
Expand Down Expand Up @@ -154,7 +149,9 @@ def run_tuxtest_tests(self, haltmsg):
else:
self.vm.wait()

def common_tuxrun(self, dt=None, haltmsg="reboot: System halted",
def common_tuxrun(self, dt=None,
drive="virtio-blk-device",
haltmsg="reboot: System halted",
console_index=0):
"""
Common path for LKFT tests. Unless we need to do something
Expand All @@ -163,7 +160,7 @@ def common_tuxrun(self, dt=None, haltmsg="reboot: System halted",
"""
(kernel, disk, dtb) = self.fetch_tuxrun_assets(dt)

self.prepare_run(kernel, disk, dtb, console_index)
self.prepare_run(kernel, disk, drive, dtb, console_index)
self.vm.launch()
self.run_tuxtest_tests(haltmsg)

Expand Down Expand Up @@ -206,11 +203,11 @@ def test_armv5(self):
:avocado: tags=machine:versatilepb
:avocado: tags=tuxboot:armv5
:avocado: tags=image:zImage
:avocado: tags=drive:virtio-blk-pci
:avocado: tags=console:ttyAMA0
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun(dt="versatile-pb.dtb")
self.common_tuxrun(drive="virtio-blk-pci",
dt="versatile-pb.dtb")

def test_armv7(self):
"""
Expand Down Expand Up @@ -244,10 +241,9 @@ def test_i386(self):
:avocado: tags=machine:q35
:avocado: tags=tuxboot:i386
:avocado: tags=image:bzImage
:avocado: tags=drive:virtio-blk-pci
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="virtio-blk-pci")

def test_mips32(self):
"""
Expand All @@ -257,11 +253,10 @@ def test_mips32(self):
:avocado: tags=endian:big
:avocado: tags=tuxboot:mips32
:avocado: tags=image:vmlinux
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=root:sda
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")

def test_mips32el(self):
"""
Expand All @@ -270,11 +265,10 @@ def test_mips32el(self):
:avocado: tags=cpu:mips32r6-generic
:avocado: tags=tuxboot:mips32el
:avocado: tags=image:vmlinux
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=root:sda
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")

@skip("QEMU currently broken") # regression against stable QEMU
def test_mips64(self):
Expand All @@ -284,23 +278,21 @@ def test_mips64(self):
:avocado: tags=tuxboot:mips64
:avocado: tags=endian:big
:avocado: tags=image:vmlinux
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=root:sda
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")

def test_mips64el(self):
"""
:avocado: tags=arch:mips64el
:avocado: tags=machine:malta
:avocado: tags=tuxboot:mips64el
:avocado: tags=image:vmlinux
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=root:sda
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")

def test_ppc32(self):
"""
Expand All @@ -309,10 +301,9 @@ def test_ppc32(self):
:avocado: tags=cpu:e500mc
:avocado: tags=tuxboot:ppc32
:avocado: tags=image:uImage
:avocado: tags=drive:virtio-blk-pci
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="virtio-blk-pci")

def test_ppc64(self):
"""
Expand All @@ -324,10 +315,9 @@ def test_ppc64(self):
:avocado: tags=tuxboot:ppc64
:avocado: tags=image:vmlinux
:avocado: tags=extradev:driver=spapr-vscsi
:avocado: tags=drive:scsi-hd
:avocado: tags=root:sda
"""
self.common_tuxrun()
self.common_tuxrun(drive="scsi-hd")

def test_ppc64le(self):
"""
Expand All @@ -338,10 +328,9 @@ def test_ppc64le(self):
:avocado: tags=tuxboot:ppc64le
:avocado: tags=image:vmlinux
:avocado: tags=extradev:driver=spapr-vscsi
:avocado: tags=drive:scsi-hd
:avocado: tags=root:sda
"""
self.common_tuxrun()
self.common_tuxrun(drive="scsi-hd")

def test_riscv32(self):
"""
Expand All @@ -365,10 +354,10 @@ def test_s390(self):
:avocado: tags=endian:big
:avocado: tags=tuxboot:s390
:avocado: tags=image:bzImage
:avocado: tags=drive:virtio-blk-ccw
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun(haltmsg="Requesting system halt")
self.common_tuxrun(drive="virtio-blk-ccw",
haltmsg="Requesting system halt")

# Note: some segfaults caused by unaligned userspace access
@skipIf(os.getenv('GITLAB_CI'), 'Skipping unstable test on GitLab')
Expand All @@ -380,15 +369,16 @@ def test_sh4(self):
:avocado: tags=tuxboot:sh4
:avocado: tags=image:zImage
:avocado: tags=root:sda
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=console:ttySC1
"""
# The test is currently too unstable to do much in userspace
# so we skip common_tuxrun and do a minimal boot and shutdown.
(kernel, disk, dtb) = self.fetch_tuxrun_assets()

# the console comes on the second serial port
self.prepare_run(kernel, disk, console_index=1)
self.prepare_run(kernel, disk,
"driver=ide-hd,bus=ide.0,unit=0",
console_index=1)
self.vm.launch()

self.wait_for_console_pattern("Welcome to TuxTest")
Expand All @@ -404,10 +394,9 @@ def test_sparc64(self):
:avocado: tags=tuxboot:sparc64
:avocado: tags=image:vmlinux
:avocado: tags=root:sda
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")

def test_x86_64(self):
"""
Expand All @@ -417,7 +406,6 @@ def test_x86_64(self):
:avocado: tags=tuxboot:x86_64
:avocado: tags=image:bzImage
:avocado: tags=root:sda
:avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0
:avocado: tags=shutdown:nowait
"""
self.common_tuxrun()
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")

0 comments on commit fb3af2d

Please sign in to comment.