Package: ipmitool
Version: 1.8.19-4
Severity: wishlist
Tags: patch

Dear Maintainer,

I have been doing package merging of ipmitool and I bumped into the  
delta that includes tests for ipmitool.
Autopkgtests are important to test the package and that's why I am 
writing to you to propose those tests.
I'll attach a debdiff.
Among these tests, we also have the "Add a qemu + virtualbmc dep-8 test for 
ipmitool", but there is no virtualbmc in Debian. Simply, it will not 
work. You can decide whether you want to drop them or not. At the end
Debian gains one smoke test.

Best regards,
Michal Maloszewski

Kernel: Linux 5.15.0-60-generic (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru ipmitool-1.8.19/debian/changelog ipmitool-1.8.19/debian/changelog
--- ipmitool-1.8.19/debian/changelog    2022-12-30 10:07:51.000000000 +0100
+++ ipmitool-1.8.19/debian/changelog    2023-01-16 16:28:56.000000000 +0100
@@ -1,3 +1,13 @@
+ipmitool (1.8.19-4ubuntu1~ppa1) lunar; urgency=medium
+
+  * Merge with Debian unstable. Remaining changes:
+    - 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
+
+ -- Michal Maloszewski <michal.maloszew...@canonical.com>  Mon, 16 Jan 2023 
16:28:56 +0100
+
 ipmitool (1.8.19-4) unstable; urgency=medium
 
   * debian/patches/0110-unpdate_IANA_URL.patch:
@@ -23,6 +33,16 @@
 
  -- Jörg Frings-Fürst <debian@jff.email>  Sun, 25 Dec 2022 14:32:31 +0100
 
diff -Nru ipmitool-1.8.19/debian/control ipmitool-1.8.19/debian/control
--- ipmitool-1.8.19/debian/control      2022-10-30 19:30:24.000000000 +0100
+++ ipmitool-1.8.19/debian/control      2023-01-16 16:28:56.000000000 +0100
@@ -1,7 +1,8 @@
 Source: ipmitool
 Section: utils
 Priority: optional
-Maintainer: Jörg Frings-Fürst <debian@jff.email>
+Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
+XSBC-Original-Maintainer: Jörg Frings-Fürst <debian@jff.email>
 Build-Depends:
  debhelper-compat (= 13),
  init-system-helpers (>= 1.58),
diff -Nru ipmitool-1.8.19/debian/tests/control 
ipmitool-1.8.19/debian/tests/control
--- ipmitool-1.8.19/debian/tests/control        1970-01-01 01:00:00.000000000 
+0100
+++ ipmitool-1.8.19/debian/tests/control        2023-01-16 16:26:29.000000000 
+0100
@@ -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 -Nru ipmitool-1.8.19/debian/tests/qemuvbmc 
ipmitool-1.8.19/debian/tests/qemuvbmc
--- ipmitool-1.8.19/debian/tests/qemuvbmc       1970-01-01 01:00:00.000000000 
+0100
+++ ipmitool-1.8.19/debian/tests/qemuvbmc       2023-01-16 16:26:29.000000000 
+0100
@@ -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 -Nru ipmitool-1.8.19/debian/tests/smoke ipmitool-1.8.19/debian/tests/smoke
--- ipmitool-1.8.19/debian/tests/smoke  1970-01-01 01:00:00.000000000 +0100
+++ ipmitool-1.8.19/debian/tests/smoke  2023-01-16 16:26:29.000000000 +0100
@@ -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 -Nru ipmitool-1.8.19/debian/tests/vbmc-qemu-vm-session.xml 
ipmitool-1.8.19/debian/tests/vbmc-qemu-vm-session.xml
--- ipmitool-1.8.19/debian/tests/vbmc-qemu-vm-session.xml       1970-01-01 
01:00:00.000000000 +0100
+++ ipmitool-1.8.19/debian/tests/vbmc-qemu-vm-session.xml       2023-01-16 
16:26:29.000000000 +0100
@@ -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>

Reply via email to