From 85f2a92945ef7e412079bd9f6c702e7a6468a0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 12 Mar 2023 10:49:54 +0100 Subject: Add dep8 tests --- debian/changelog | 10 +++++++ debian/tests/control | 16 ++++++++++ debian/tests/qemuvbmc | 55 +++++++++++++++++++++++++++++++++++ debian/tests/smoke | 8 +++++ debian/tests/vbmc-qemu-vm-session.xml | 32 ++++++++++++++++++++ 5 files changed, 121 insertions(+) create mode 100644 debian/tests/control create mode 100644 debian/tests/qemuvbmc create mode 100644 debian/tests/smoke create mode 100644 debian/tests/vbmc-qemu-vm-session.xml 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 + + -- Jörg Frings-Fürst 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 @@ + + bmctest + 256000 + 256000 + 1 + + hvm + /boot/vmlinuz + /boot/initrd.img + console=ttyS0 quiet loglevel=0 edd=off printk.time=1 noreplace-smp cgroup_disable=memory pci=noearly noapic panic=-1 selinux=0 + + + + + + + destroy + destroy + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + + + + + -- cgit v1.2.3