summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyutaroh Matsumoto <ryutaroh@ict.e.titech.ac.jp>2021-01-12 02:13:25 +0100
committerLars Wirzenius <liw@liw.fi>2021-01-16 09:11:02 +0200
commit3c8c5c5a52a6a77c47a55076d1915102cbe9eded (patch)
treec4e25bb9df71b94ea2064b468ce559faab4e4efa
parentc49594f240132d2d9a0eeef407d9219c21c86f85 (diff)
downloadvmdb2-3c8c5c5a52a6a77c47a55076d1915102cbe9eded.tar.gz
test: Add tests for ppc64el
-rwxr-xr-xcheck-all9
-rw-r--r--ppc64el.vmdb61
-rwxr-xr-xsmoke-ppc64el.sh8
-rw-r--r--smoke-ppc64el.vmdb73
-rw-r--r--smoke-ppc64el.yarn65
5 files changed, 216 insertions, 0 deletions
diff --git a/check-all b/check-all
index 6b87cad..b4ff3a6 100755
--- a/check-all
+++ b/check-all
@@ -9,6 +9,7 @@ amd64_tarball="$tarballdir/amd64.tar.gz"
i386_tarball="$tarballdir/i386.tar.gz"
arm64_tarball="$tarballdir/arm64.tar.gz"
armhf_tarball="$tarballdir/armhf.tar.gz"
+ppc64el_tarball="$tarballdir/ppc64el.tar.gz"
tryit()
{
@@ -77,4 +78,12 @@ do
done
+./smoke-ppc64el.sh "$ppc64el_tarball"
+
+for x in "$@" ppc64el
+do
+ tryit "$tarballdir/$x.img" "$x.vmdb" "$ppc64el_tarball"
+done
+
+
echo All test images built successfully.
diff --git a/ppc64el.vmdb b/ppc64el.vmdb
new file mode 100644
index 0000000..60f4223
--- /dev/null
+++ b/ppc64el.vmdb
@@ -0,0 +1,61 @@
+# This is a sample VMDB2 input file that specifies a simple system for
+# a ppc64el machine that boots with IEEE1275.
+
+steps:
+ - mkimg: "{{ output }}"
+ size: 4G
+
+ - mklabel: gpt
+ device: "{{ output }}"
+
+ - mkpart: primary
+ device: "{{ output }}"
+ start: 0%
+ end: 10M
+ tag: prep
+
+ - mkpart: primary
+ device: "{{ output }}"
+ start: 10M
+ end: 100%
+ tag: /
+
+ - kpartx: "{{ output }}"
+
+ - mkfs: ext4
+ partition: /
+
+ - mount: /
+
+ # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
+ # which ends up unable to create /dev/fd within the chroot, causing
+ # the qemu-debootstrap phase to fail. Until we get to the bottom
+ # that, don't enable the plugin.
+ #- virtual-filesystems: /
+
+ - unpack-rootfs: /
+
+ - qemu-debootstrap: buster
+ arch: ppc64el
+ mirror: http://deb.debian.org/debian
+ target: /
+ unless: rootfs_unpacked
+
+ - apt: install
+ packages:
+ - linux-image-powerpc64le
+ fs-tag: /
+ unless: rootfs_unpacked
+
+ - cache-rootfs: /
+ unless: rootfs_unpacked
+
+ - chroot: /
+ shell: |
+ sed -i '/^root:[^:]*:/s//root::/' /etc/passwd
+ echo ppc64el-vmdb2 > /etc/hostname
+
+ - grub: ieee1275
+ tag: /
+ prep: prep
+ quiet: false
diff --git a/smoke-ppc64el.sh b/smoke-ppc64el.sh
new file mode 100755
index 0000000..d3e9016
--- /dev/null
+++ b/smoke-ppc64el.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -eu
+
+tarball="$1"
+shift
+
+yarn smoke-ppc64el.yarn --env ROOTFS_TARBALL="$tarball" "$@"
diff --git a/smoke-ppc64el.vmdb b/smoke-ppc64el.vmdb
new file mode 100644
index 0000000..74ce1c9
--- /dev/null
+++ b/smoke-ppc64el.vmdb
@@ -0,0 +1,73 @@
+steps:
+ - mkimg: "{{ output }}"
+ size: 4G
+
+ - mklabel: gpt
+ device: "{{ output }}"
+
+ - mkpart: primary
+ device: "{{ output }}"
+ start: 0%
+ end: 10M
+ tag: prep
+
+ - mkpart: primary
+ device: "{{ output }}"
+ start: 10M
+ end: 100%
+ tag: rootfs
+
+ - kpartx: "{{ output }}"
+
+ - mkfs: ext4
+ partition: rootfs
+ label: smoke
+
+ - mount: rootfs
+
+ - create-dir: /smoke-dir
+ perm: 0777
+ uid: 1000
+ gid: 1000
+
+ - create-file: /smoke-create-file.txt
+ contents: No smoke here.
+ perm: 0777
+ uid: 1000
+ gid: 1000
+
+ - copy-file: /smoke-copy-file.txt
+ src: smoke-copy-file.txt
+ perm: 0777
+ uid: 1000
+ gid: 1000
+
+ - unpack-rootfs: rootfs
+
+ - qemu-debootstrap: buster
+ arch: ppc64el
+ mirror: http://deb.debian.org/debian
+ keyring: /usr/share/keyrings/debian-archive-keyring.gpg
+ target: rootfs
+ unless: rootfs_unpacked
+
+ - apt: install
+ packages:
+ - linux-image-powerpc64le
+ tag: rootfs
+ unless: rootfs_unpacked
+
+ - cache-rootfs: rootfs
+ unless: rootfs_unpacked
+
+ - chroot: rootfs
+ shell: |
+ sed -i '/^root:[^:]*:/s//root::/' /etc/passwd
+ echo ppc64el-vmdb2 > /etc/hostname
+
+ - fstab: rootfs
+
+ - grub: ieee1275
+ tag: rootfs
+ prep: prep
+ quiet: false
diff --git a/smoke-ppc64el.yarn b/smoke-ppc64el.yarn
new file mode 100644
index 0000000..2b97796
--- /dev/null
+++ b/smoke-ppc64el.yarn
@@ -0,0 +1,65 @@
+# Smoke test vmdb2-built images
+
+This yarn file builds a basic image, and runs it under Qemu. The image
+is configured to have a serial console enabled, and the scenario below
+will log in as root (no password), and command the virtual machine to
+power off. If this works, the image is at least minimally functional,
+so the "smoke test" passes.
+
+More elaborate testing can be added, but smoke testing is enough for
+now.
+
+To run this yarn file, you need to run it as root (since it needs to
+build an image as root), and you need to run on a system where
+qemu-system-ppc64le is installed. Additionally, you need to add the
+following option to yarn:
+
+ EXAMPLE
+ --env ROOTFS_TARBALL=/path/to/rootfs/tarball
+
+This means vmdb2 will use the given tarball when creating an image,
+and if the tarball doesn't exist yet, it will create it. This makes
+testing multiple time much faster.
+
+ SCENARIO smoke test ppc64el IEEE1275 image
+ WHEN user runs vmdb smoke-ppc64el.vmdb --output smoke-ppc64el.img
+ THEN user can IEEE1275 boot smoke-ppc64el.img and power it off from root shell
+
+ IMPLEMENTS WHEN user runs vmdb (\S+) --output (\S+)
+ "$SRCDIR/vmdb2" "$SRCDIR/$MATCH_1" \
+ --output "$DATADIR/$MATCH_2" \
+ --log "$DATADIR/vmdb.log" \
+ --verbose \
+ --rootfs-tarball "$ROOTFS_TARBALL"
+
+ IMPLEMENTS THEN user can IEEE1275 boot (\S+) and power it off from root shell
+ cd "$DATADIR"
+ img="$MATCH_1"
+ cat << EOF > run.sh
+ qemu-system-ppc64le \
+ -m 1024 \
+ -nographic \
+ "$img"
+ EOF
+ chmod a+rx run.sh
+ cat << EOF > expect.txt
+ set timeout 600
+ proc abort {} {
+ puts "ERROR ERROR\n"
+ exit 1
+ }
+ spawn ./run.sh
+ expect "login: "
+ send "root\n"
+ expect "# "
+ send "poweroff\r"
+ set timeout 30
+ expect {
+ "reboot: Power down" {puts poweroffing\n}
+ eof abort
+ timeout abort
+ }
+ expect eof
+ wait
+ EOF
+ expect -d expect.txt > expect.out