mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
test: Run TEST-64-UDEV-STORAGE with mkosi
We add a configure script for each subtest to add the required qemu arguments. Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
This commit is contained in:
@@ -42,7 +42,9 @@ Packages=
|
||||
kmod
|
||||
knot
|
||||
less
|
||||
lvm2
|
||||
man
|
||||
mdadm
|
||||
mtools
|
||||
nano
|
||||
nftables
|
||||
|
||||
@@ -30,6 +30,8 @@ Packages=
|
||||
iputils
|
||||
linux
|
||||
man-db
|
||||
multipath-tools
|
||||
open-iscsi
|
||||
openbsd-netcat
|
||||
openssh
|
||||
openssl
|
||||
@@ -44,6 +46,7 @@ Packages=
|
||||
shadow
|
||||
squashfs-tools
|
||||
stress
|
||||
tgt
|
||||
tpm2-tools
|
||||
tpm2-tss
|
||||
vim
|
||||
|
||||
@@ -24,6 +24,8 @@ Packages=
|
||||
bind-utils
|
||||
bpftool
|
||||
cryptsetup
|
||||
device-mapper-event
|
||||
device-mapper-multipath
|
||||
dfuzzer
|
||||
dhcp-server
|
||||
dnf
|
||||
@@ -35,7 +37,9 @@ Packages=
|
||||
iproute
|
||||
iproute-tc
|
||||
iputils
|
||||
iscsi-initiator-utils
|
||||
kernel-core
|
||||
kernel-modules # For squashfs and megasas2
|
||||
libasan
|
||||
libcap-ng-utils
|
||||
libubsan
|
||||
|
||||
@@ -9,4 +9,3 @@ RepartDirectories=mkosi.repart
|
||||
[Content]
|
||||
Packages=
|
||||
rpmautospec-rpm-macros
|
||||
kernel-modules # For squashfs
|
||||
|
||||
@@ -54,7 +54,9 @@ Packages=
|
||||
libtss2-tcti-device0
|
||||
locales
|
||||
man-db
|
||||
multipath-tools
|
||||
netcat-openbsd
|
||||
open-iscsi
|
||||
openssh-client
|
||||
openssh-server
|
||||
passwd
|
||||
@@ -66,6 +68,7 @@ Packages=
|
||||
sbsigntool
|
||||
squashfs-tools
|
||||
stress
|
||||
tgt
|
||||
tpm2-tools
|
||||
tzdata
|
||||
xxd
|
||||
|
||||
@@ -2,3 +2,7 @@
|
||||
|
||||
[Match]
|
||||
Distribution=debian
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
linux-image-generic
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Match]
|
||||
Architecture=x86-64
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
linux-image-cloud-amd64
|
||||
@@ -1,8 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Match]
|
||||
Architecture=arm64
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
linux-image-cloud-arm64
|
||||
@@ -7,8 +7,9 @@ Distribution=fedora
|
||||
Packages=
|
||||
btrfs-progs
|
||||
compsize
|
||||
f2fs-tools
|
||||
dnf5
|
||||
f2fs-tools
|
||||
scsi-target-utils
|
||||
|
||||
InitrdPackages=
|
||||
btrfs-progs
|
||||
|
||||
@@ -50,6 +50,8 @@ Packages=
|
||||
libasan8
|
||||
libkmod2
|
||||
libubsan1
|
||||
multipath-tools
|
||||
open-iscsi
|
||||
openssh-clients
|
||||
openssh-server
|
||||
pam
|
||||
@@ -65,6 +67,7 @@ Packages=
|
||||
sed
|
||||
shadow
|
||||
squashfs
|
||||
tgt
|
||||
timezone
|
||||
tpm2.0-tools
|
||||
user(bin)
|
||||
|
||||
3
mkosi.images/system/mkosi.extra/etc/iscsi/iscsid.conf
Normal file
3
mkosi.images/system/mkosi.extra/etc/iscsi/iscsid.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
iscsid.startup = /usr/bin/systemctl start iscsid.socket
|
||||
26
test/TEST-64-UDEV-STORAGE/btrfs_basic.configure
Executable file
26
test/TEST-64-UDEV-STORAGE/btrfs_basic.configure
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
|
||||
|
||||
for i in range(4):
|
||||
id = f"drivebtrfsbasic{i}"
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": id,
|
||||
"Size": "350M" if i == 0 else "128M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += [
|
||||
"-device",
|
||||
f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefbtrfs{i}",
|
||||
]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
26
test/TEST-64-UDEV-STORAGE/iscsi_lvm.configure
Executable file
26
test/TEST-64-UDEV-STORAGE/iscsi_lvm.configure
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
|
||||
|
||||
for i in range(4):
|
||||
id = f"driveiscsibasic{i}"
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": id,
|
||||
"Size": "150M" if i == 0 else "70M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += [
|
||||
"-device",
|
||||
f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefiscsi{i}",
|
||||
]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
32
test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure
Executable file
32
test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": "drive0",
|
||||
"Size": "64M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += ["-device", "pci-bridge,id=pci_bridge0,chassis_nr=64"]
|
||||
|
||||
# Create 25 additional PCI bridges, each one connected to the previous one
|
||||
# (basically a really long extension cable), and attach a virtio drive to
|
||||
# the last one. This should force udev into attempting to create a device
|
||||
# unit with a _really_ long name.
|
||||
for bridge in range(1, 26):
|
||||
config["QemuArgs"] += [
|
||||
"-device",
|
||||
f"pci-bridge,id=pci_bridge{bridge},bus=pci_bridge{bridge - 1},"
|
||||
f"chassis_nr={64 + bridge}"
|
||||
]
|
||||
|
||||
config["QemuArgs"] += ["-device", f"virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25"]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
25
test/TEST-64-UDEV-STORAGE/lvm_basic.configure
Executable file
25
test/TEST-64-UDEV-STORAGE/lvm_basic.configure
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
|
||||
|
||||
for i in range(4):
|
||||
id = f"drivelvmbasic{i}"
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": id,
|
||||
"Size": "32M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += [
|
||||
"-device", f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeeflvm{i}",
|
||||
]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
25
test/TEST-64-UDEV-STORAGE/mdadm_basic.configure
Executable file
25
test/TEST-64-UDEV-STORAGE/mdadm_basic.configure
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
|
||||
|
||||
for i in range(5):
|
||||
id = f"drivemdadmbasic{i}"
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": id,
|
||||
"Size": "64M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += [
|
||||
"-device", f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefmdadm{i}",
|
||||
]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
25
test/TEST-64-UDEV-STORAGE/mdadm_lvm.configure
Executable file
25
test/TEST-64-UDEV-STORAGE/mdadm_lvm.configure
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
|
||||
|
||||
for i in range(5):
|
||||
id = f"drivemdadmlvm{i}"
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": id,
|
||||
"Size": "64M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += [
|
||||
"-device", f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefmdadmlvm{i}",
|
||||
]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
36
test/TEST-64-UDEV-STORAGE/megasas2_basic.configure
Executable file
36
test/TEST-64-UDEV-STORAGE/megasas2_basic.configure
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
config = json.load(sys.stdin)
|
||||
|
||||
qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}"
|
||||
result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE)
|
||||
if 'name "megasas-gen2"' not in result.stdout:
|
||||
print("megasas-gen2 device driver is not available, skipping test...", file=sys.stderr)
|
||||
exit(77)
|
||||
|
||||
for i in range(4):
|
||||
config["QemuArgs"] += ['-device', f"megasas-gen2,id=scsi{i}"]
|
||||
|
||||
for i in range(128):
|
||||
id = f"drive{i}"
|
||||
config["QemuDrives"] += [
|
||||
{
|
||||
"Id": id,
|
||||
"Size": "1M",
|
||||
"Options": "cache=unsafe",
|
||||
}
|
||||
]
|
||||
config["QemuArgs"] += [
|
||||
'-device',
|
||||
f"scsi-hd,drive={id},bus=scsi{i // 32}.0,channel=0,"
|
||||
f"scsi-id={i % 32},lun=0",
|
||||
]
|
||||
|
||||
json.dump(config, sys.stdout)
|
||||
@@ -1,8 +1,37 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
integration_tests += [
|
||||
integration_test_template + {
|
||||
'name' : fs.name(meson.current_source_dir()),
|
||||
'enabled' : false,
|
||||
},
|
||||
name = fs.name(meson.current_source_dir())
|
||||
unit = configure_file(
|
||||
input : files('../test.service.in'),
|
||||
output : '@0@.service'.format(name),
|
||||
configuration : integration_test_template['configuration'],
|
||||
)
|
||||
|
||||
foreach testcase : [
|
||||
'btrfs_basic',
|
||||
'iscsi_lvm',
|
||||
'long_sysfs_path',
|
||||
'lvm_basic',
|
||||
'mdadm_basic',
|
||||
'mdadm_lvm',
|
||||
'megasas2_basic',
|
||||
'multipath_basic_failover',
|
||||
'nvme_basic',
|
||||
'nvme_subsystem',
|
||||
'simultaneous_events',
|
||||
'virtio_scsi_identically_named_partitions',
|
||||
]
|
||||
integration_tests += [
|
||||
integration_test_template + {
|
||||
'name' : '@0@-@1@'.format(name, testcase),
|
||||
# Make sure the service is still named TEST-64-UDEV-STORAGE.service.
|
||||
'unit' : unit,
|
||||
'cmdline' : integration_test_template['cmdline'] + [
|
||||
'systemd.setenv=TEST_FUNCTION_NAME=testcase_@0@'.format(testcase)
|
||||
],
|
||||
'mkosi-args' : integration_test_template['mkosi-args'] + [
|
||||
'--configure-script', files('@0@.configure'.format(testcase)),
|
||||
],
|
||||
},
|
||||
]
|
||||
endforeach
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user