summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog10
-rw-r--r--debian/tests/control16
-rw-r--r--debian/tests/qemuvbmc55
-rw-r--r--debian/tests/smoke8
-rw-r--r--debian/tests/vbmc-qemu-vm-session.xml32
5 files changed, 121 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index b1395ec..9536323 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+ipmitool (1.8.19-5) UNRELEASED; urgency=medium
+
+ * Add dep8 tests
+ - d/t/smoke: Add a smoke dep-8 test to confirm ipmitool installs.
+ - d/t/qemuvbmc: Add a qemu + virtualbmc dep-8 test for ipmitool.
+ - d/t/vbmc-qemu-vm-session.xml: define the qemu vm for qemuvbmc.
+ Thanks to Michal Maloszewski <michal.maloszewski@canonical.com>
+
+ -- Jörg Frings-Fürst <debian@jff.email> Sun, 12 Mar 2023 10:33:42 +0100
+
ipmitool (1.8.19-4) unstable; urgency=medium
* debian/patches/0110-unpdate_IANA_URL.patch:
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..a11e46b
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,16 @@
+Tests: smoke
+Depends: ipmitool
+Restrictions: allow-stderr, superficial
+
+Tests: qemuvbmc
+Depends: ipmitool,
+ python3-libvirt,
+ virtualbmc,
+ bridge-utils,
+ libvirt-clients,
+ libvirt-daemon-system,
+ libxml2-utils,
+ linux-image-amd64 [amd64] | linux-generic [amd64],
+ qemu-kvm,
+ qemu-system,
+Restrictions: allow-stderr, isolation-container, skippable, skip-not-installable, needs-root
diff --git a/debian/tests/qemuvbmc b/debian/tests/qemuvbmc
new file mode 100644
index 0000000..d1bafb3
--- /dev/null
+++ b/debian/tests/qemuvbmc
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+set -e
+
+# dep8 qemu + virtualbmc test for ipmitool
+# Start by defining and creating a qemu vm, then attach vbmc to it.
+# Afterward test ipmitool commands on the vm.
+
+XML=debian/tests/vbmc-qemu-vm-session.xml
+DOMAIN=bmctest
+
+# Clean vm setup on exit
+cleanup()
+{
+ if [ -z "$CLEANED_UP" ]; then
+ virsh destroy ${DOMAIN} > /dev/null 2>&1 || true
+ virsh undefine ${DOMAIN} > /dev/null 2>&1 || true
+ CLEANED_UP=1
+ fi
+}
+
+trap cleanup EXIT
+
+# Confirm the test is running on amd64
+if [ $(uname -m) != "x86_64" ]; then
+ echo "Not on x86_64...skipping"
+ exit 77
+fi
+
+# Confirm kernel and initrd are available for running vm
+if [ ! -f /boot/vmlinuz ] || [ ! -f /boot/initrd.img ]; then
+ echo "Kernel or initrd not found...fail".
+ exit 1
+fi
+
+# We don't want libvirt using xattrs
+# https://discuss.linuxcontainers.org/t/cant-run-libvirt-qemu-kvm-in-an-unprivileged-domain-anymore-unable-to-set-xattr/9466/3
+sed -r -i 's,^(#|[[:blank:]])*(remember_owner).*$,\2 = 0,' /etc/libvirt/qemu.conf
+systemctl restart libvirtd.service
+
+# Setup vm
+virt-xml-validate ${XML}
+virsh define ${XML}
+virsh start ${DOMAIN}
+
+# Attach virtualbmc to vm
+vbmc add ${DOMAIN} --port 6230 --username testuser --password pass
+vbmc start ${DOMAIN}
+
+# Test ipmitool
+ipmitool -I lanplus -U testuser -P pass -H 127.0.0.1 -p 6230 power up
+ipmitool -I lanplus -U testuser -P pass -H 127.0.0.1 -p 6230 power status
+ipmitool -I lanplus -U testuser -P pass -H 127.0.0.1 -p 6230 chassis status
+ipmitool -I lanplus -U testuser -P pass -H 127.0.0.1 -p 6230 power down
+ipmitool -I lanplus -U testuser -P pass -H 127.0.0.1 -p 6230 power status
diff --git a/debian/tests/smoke b/debian/tests/smoke
new file mode 100644
index 0000000..a2adbb2
--- /dev/null
+++ b/debian/tests/smoke
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -ex
+
+# dep8 smoke test for ipmitool
+# Test that the ipmitool binary exists and can get the version and help page
+
+ipmitool -h
+ipmitool -V
diff --git a/debian/tests/vbmc-qemu-vm-session.xml b/debian/tests/vbmc-qemu-vm-session.xml
new file mode 100644
index 0000000..f345b8b
--- /dev/null
+++ b/debian/tests/vbmc-qemu-vm-session.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+ <name>bmctest</name>
+ <memory unit='KiB'>256000</memory>
+ <currentMemory unit='KiB'>256000</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
+ <kernel>/boot/vmlinuz</kernel>
+ <initrd>/boot/initrd.img</initrd>
+ <cmdline> console=ttyS0 quiet loglevel=0 edd=off printk.time=1 noreplace-smp cgroup_disable=memory pci=noearly noapic panic=-1 selinux=0</cmdline>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='virtio-serial' index='0'>
+ <alias name='virtio-serial0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </controller>
+ <filesystem type='mount' accessmode='squash'>
+ <source dir='/'/>
+ <target dir='bmctest:root'/>
+ <readonly/>
+ </filesystem>
+ </devices>
+</domain>