diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-05-05 06:44:17 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-05-05 06:44:17 +0300 |
commit | c98be8294ac84880d924fc2cbc65e16dc1420885 (patch) | |
tree | 142f3f13391703eacb29c2ca224185d75e3042e6 | |
parent | 1ec4123409240adfba2f48700114065e7aeb6950 (diff) | |
download | vmdb2-c98be8294ac84880d924fc2cbc65e16dc1420885.tar.gz |
chore: delete no-longer useful test suite bits and examples
Sponsored-by: author
-rwxr-xr-x | format.sh | 45 | ||||
-rwxr-xr-x | smoke-amd64.sh | 8 | ||||
-rw-r--r-- | smoke-amd64.vmdb | 72 | ||||
-rw-r--r-- | smoke-amd64.yarn | 101 | ||||
-rwxr-xr-x | smoke-arm64.sh | 8 | ||||
-rw-r--r-- | smoke-arm64.yarn | 69 | ||||
-rwxr-xr-x | smoke-armhf.sh | 8 | ||||
-rw-r--r-- | smoke-armhf.yarn | 70 | ||||
-rw-r--r-- | smoke-copy-file.txt | 1 | ||||
-rwxr-xr-x | smoke-i386.sh | 8 | ||||
-rw-r--r-- | smoke-i386.vmdb | 72 | ||||
-rw-r--r-- | smoke-i386.yarn | 101 | ||||
-rw-r--r-- | smoke-pc.vmdb | 71 | ||||
-rw-r--r-- | smoke-uefi-amd64.vmdb | 76 | ||||
-rw-r--r-- | smoke-uefi-arm64.vmdb | 76 | ||||
-rw-r--r-- | smoke-uefi-armhf.vmdb | 76 | ||||
-rw-r--r-- | smoke-uefi-i386.vmdb | 76 | ||||
-rw-r--r-- | smoke-uefi.vmdb | 76 | ||||
-rwxr-xr-x | smoke.sh | 8 | ||||
-rw-r--r-- | smoke.yarn | 98 | ||||
-rw-r--r-- | yarns/100-mvp.yarn | 168 | ||||
-rw-r--r-- | yarns/900-implements.yarn | 46 | ||||
-rw-r--r-- | yarns/Makefile | 28 | ||||
-rw-r--r-- | yarns/lib.py | 10 | ||||
-rw-r--r-- | yarns/ugly.css | 79 |
25 files changed, 0 insertions, 1451 deletions
diff --git a/format.sh b/format.sh deleted file mode 100755 index 9de48dc..0000000 --- a/format.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -set -eu - -cleanup() -{ - rm -f tmp.md -} - -trap cleanup EXIT - -(cat vmdb2.md; for x in vmdb/plugins/*.mdwn; do cat "$x"; echo; done) > tmp.md -if command -v sp-docgen > /dev/null -then - sp-docgen tmp.md -o vmdb2.html - if command -v pdflatex > /dev/null - then - sp-docgen tmp.md -o vmdb2.pdf - fi -else - pandoc \ - --self-contained \ - --standalone \ - --css vmdb2.css \ - --toc \ - --number-sections \ - -o vmdb2.html \ - tmp.md - - if command -v pdflatex > /dev/null - then - pandoc \ - --toc \ - --number-sections \ - -Vdocumentclass=report \ - -Vgeometry:a4paper \ - -Vfontsize:12pt \ - -Vmainfont:FreeSerif \ - -Vsansfont:FreeSans \ - -Vmonofont:FreeMonoBold \ - '-Vgeometry:top=2cm, bottom=2.5cm, left=2cm, right=1cm' \ - -o vmdb2.pdf \ - tmp.md - fi -fi diff --git a/smoke-amd64.sh b/smoke-amd64.sh deleted file mode 100755 index 39691e9..0000000 --- a/smoke-amd64.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -eu - -tarball="$1" -shift - -yarn smoke-amd64.yarn --env ROOTFS_TARBALL="$tarball" "$@" diff --git a/smoke-amd64.vmdb b/smoke-amd64.vmdb deleted file mode 100644 index fa20f03..0000000 --- a/smoke-amd64.vmdb +++ /dev/null @@ -1,72 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: msdos - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 1M - end: 10M - tag: unused - - - 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 - - - debootstrap: buster - arch: amd64 - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-amd64 - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo amd64-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: bios - tag: rootfs - console: serial diff --git a/smoke-amd64.yarn b/smoke-amd64.yarn deleted file mode 100644 index 155ee07..0000000 --- a/smoke-amd64.yarn +++ /dev/null @@ -1,101 +0,0 @@ -# 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-x86_64 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 amd64 image - WHEN user runs vmdb smoke-amd64.vmdb --output smoke-amd64.img - THEN user can BIOS boot smoke-amd64.img and power it off from root shell - - WHEN user runs vmdb smoke-uefi-amd64.vmdb --output smoke-uefi-amd64.img - THEN user can UEFI boot smoke-uefi-amd64.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 BIOS boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - qemu-system-x86_64 -drive file="$img",format=raw -m 1024 -nographic - EOF - chmod a+rx run.sh - cat << EOF > expect.txt - set timeout 300 - proc abort {} { - puts "ERROR ERROR\n" - exit 1 - } - spawn ./run.sh - expect "login: " - send "root\n" - expect "# " - send "poweroff\r" - set timeout 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - wait - EOF - expect -d expect.txt > expect.out - - IMPLEMENTS THEN user can UEFI boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - cp /usr/share/OVMF/OVMF_VARS_4M.fd . - qemu-system-x86_64 \ - -machine q35 \ - -cpu max \ - -m 1024 \ - -drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE_4M.fd,readonly=on \ - -drive if=pflash,format=raw,unit=1,file=OVMF_VARS_4M.fd \ - -drive format=raw,file="$img" \ - -nographic - 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 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - wait - EOF - expect -d expect.txt > expect.out diff --git a/smoke-arm64.sh b/smoke-arm64.sh deleted file mode 100755 index 5f99ab9..0000000 --- a/smoke-arm64.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -eu - -tarball="$1" -shift - -yarn smoke-arm64.yarn --env ROOTFS_TARBALL="$tarball" "$@" diff --git a/smoke-arm64.yarn b/smoke-arm64.yarn deleted file mode 100644 index 97506cb..0000000 --- a/smoke-arm64.yarn +++ /dev/null @@ -1,69 +0,0 @@ -# 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-aarch64 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 arm64 UEFI image - WHEN user runs vmdb smoke-uefi-arm64.vmdb --output smoke-uefi-arm64.img - THEN user can UEFI boot smoke-uefi-arm64.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 "$SRCDIR/vmdb.log" \ - --verbose \ - --rootfs-tarball "$ROOTFS_TARBALL" - - IMPLEMENTS THEN user can UEFI boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - cp /usr/share/AAVMF/AAVMF_VARS.fd . - qemu-system-aarch64 \ - -machine virt \ - -cpu max \ - -m 1024 \ - -drive if=pflash,format=raw,unit=0,file=/usr/share/AAVMF/AAVMF_CODE.fd,readonly=on \ - -drive if=pflash,format=raw,unit=1,file=AAVMF_VARS.fd \ - -drive format=raw,file="$img" \ - -nographic - EOF - chmod a+rx run.sh - cat << EOF > expect.txt - set timeout 300 - proc abort {} { - puts "ERROR ERROR\n" - exit 1 - } - spawn ./run.sh - expect "login: " - send "root\n" - expect "# " - send "poweroff\r" - set timeout 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - EOF - expect -d expect.txt > expect.out diff --git a/smoke-armhf.sh b/smoke-armhf.sh deleted file mode 100755 index c346df1..0000000 --- a/smoke-armhf.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -eu - -tarball="$1" -shift - -yarn smoke-armhf.yarn --env ROOTFS_TARBALL="$tarball" "$@" diff --git a/smoke-armhf.yarn b/smoke-armhf.yarn deleted file mode 100644 index 4e06681..0000000 --- a/smoke-armhf.yarn +++ /dev/null @@ -1,70 +0,0 @@ -# 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-aarch64 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 armhf UEFI image - WHEN user runs vmdb smoke-uefi-armhf.vmdb --output smoke-uefi-armhf.img - THEN user can UEFI boot smoke-uefi-armhf.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 UEFI boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - cp /usr/share/AAVMF/AAVMF32_VARS.fd . - qemu-system-arm \ - -machine virt \ - -cpu max \ - -m 1024 \ - -drive if=pflash,format=raw,unit=0,file=/usr/share/AAVMF/AAVMF32_CODE.fd,readonly=on \ - -drive if=pflash,format=raw,unit=1,file=AAVMF32_VARS.fd \ - -drive format=raw,file="$img" \ - -nographic - 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 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - wait - EOF - expect -d expect.txt > expect.out diff --git a/smoke-copy-file.txt b/smoke-copy-file.txt deleted file mode 100644 index 08f7479..0000000 --- a/smoke-copy-file.txt +++ /dev/null @@ -1 +0,0 @@ -No fire here.
\ No newline at end of file diff --git a/smoke-i386.sh b/smoke-i386.sh deleted file mode 100755 index b81a11c..0000000 --- a/smoke-i386.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -eu - -tarball="$1" -shift - -yarn smoke-i386.yarn --env ROOTFS_TARBALL="$tarball" "$@" diff --git a/smoke-i386.vmdb b/smoke-i386.vmdb deleted file mode 100644 index 5f261f6..0000000 --- a/smoke-i386.vmdb +++ /dev/null @@ -1,72 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: msdos - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 1M - end: 10M - tag: unused - - - 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 - - - debootstrap: buster - arch: i386 - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-686-pae - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo pc-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: bios - tag: rootfs - console: serial diff --git a/smoke-i386.yarn b/smoke-i386.yarn deleted file mode 100644 index 3bfcc22..0000000 --- a/smoke-i386.yarn +++ /dev/null @@ -1,101 +0,0 @@ -# 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-i386 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 i386 image - WHEN user runs vmdb smoke-i386.vmdb --output smoke-i386.img - THEN user can BIOS boot smoke-i386.img and power it off from root shell - - WHEN user runs vmdb smoke-uefi-i386.vmdb --output smoke-uefi-i386.img - THEN user can UEFI boot smoke-uefi-i386.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 BIOS boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - qemu-system-i386 -drive file="$img",format=raw -m 1024 -nographic - EOF - chmod a+rx run.sh - cat << EOF > expect.txt - set timeout 300 - proc abort {} { - puts "ERROR ERROR\n" - exit 1 - } - spawn ./run.sh - expect "login: " - send "root\n" - expect "# " - send "poweroff\r" - set timeout 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - wait - EOF - expect -d expect.txt > expect.out - - IMPLEMENTS THEN user can UEFI boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - cp /usr/share/OVMF/OVMF32_VARS_4M.fd . - qemu-system-i386 \ - -machine q35 \ - -cpu max \ - -m 1024 \ - -drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF32_CODE_4M.secboot.fd,readonly=on \ - -drive if=pflash,format=raw,unit=1,file=OVMF32_VARS_4M.fd \ - -drive format=raw,file="$img" \ - -nographic - 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 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - wait - EOF - expect -d expect.txt > expect.out diff --git a/smoke-pc.vmdb b/smoke-pc.vmdb deleted file mode 100644 index 0430a8b..0000000 --- a/smoke-pc.vmdb +++ /dev/null @@ -1,71 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: msdos - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 1M - end: 10M - tag: unused - - - mkpart: primary - device: "{{ output }}" - start: 10M - end: 100% - tag: rootfs - - - kpartx: "{{ output }}" - - - mkfs: ext4 - partition: rootfs - label: smoke - - - mount: rootfs - - - unpack-rootfs: rootfs - - - debootstrap: buster - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-amd64 - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - 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 - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo pc-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: bios - tag: rootfs - console: serial diff --git a/smoke-uefi-amd64.vmdb b/smoke-uefi-amd64.vmdb deleted file mode 100644 index 963508a..0000000 --- a/smoke-uefi-amd64.vmdb +++ /dev/null @@ -1,76 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: gpt - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 0% - end: 1G - tag: efifs - - - mkpart: primary - device: "{{ output }}" - start: 1G - end: 100% - tag: rootfs - - - kpartx: "{{ output }}" - - - mkfs: vfat - partition: efifs - - - 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 - - - debootstrap: buster - arch: amd64 - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-amd64 - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo amd64-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: uefi - tag: rootfs - efi: efifs - console: serial diff --git a/smoke-uefi-arm64.vmdb b/smoke-uefi-arm64.vmdb deleted file mode 100644 index f8d8d79..0000000 --- a/smoke-uefi-arm64.vmdb +++ /dev/null @@ -1,76 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: gpt - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 0% - end: 1G - tag: efifs - - - mkpart: primary - device: "{{ output }}" - start: 1G - end: 100% - tag: rootfs - - - kpartx: "{{ output }}" - - - mkfs: vfat - partition: efifs - - - 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 - - - debootstrap: buster - arch: arm64 - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-arm64 - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo arm64-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: uefi - tag: rootfs - efi: efifs - console: serial diff --git a/smoke-uefi-armhf.vmdb b/smoke-uefi-armhf.vmdb deleted file mode 100644 index b5fb70a..0000000 --- a/smoke-uefi-armhf.vmdb +++ /dev/null @@ -1,76 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: gpt - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 0% - end: 1G - tag: efifs - - - mkpart: primary - device: "{{ output }}" - start: 1G - end: 100% - tag: rootfs - - - kpartx: "{{ output }}" - - - mkfs: vfat - partition: efifs - - - 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 - - - debootstrap: buster - arch: armhf - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-armmp-lpae - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo armhf-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: uefi - tag: rootfs - efi: efifs - console: serial diff --git a/smoke-uefi-i386.vmdb b/smoke-uefi-i386.vmdb deleted file mode 100644 index a0c62a0..0000000 --- a/smoke-uefi-i386.vmdb +++ /dev/null @@ -1,76 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: gpt - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 0% - end: 1G - tag: efifs - - - mkpart: primary - device: "{{ output }}" - start: 1G - end: 100% - tag: rootfs - - - kpartx: "{{ output }}" - - - mkfs: vfat - partition: efifs - - - 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 - - - debootstrap: buster - arch: i386 - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-686-pae - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo i386-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: uefi - tag: rootfs - efi: efifs - console: serial diff --git a/smoke-uefi.vmdb b/smoke-uefi.vmdb deleted file mode 100644 index 2c8545a..0000000 --- a/smoke-uefi.vmdb +++ /dev/null @@ -1,76 +0,0 @@ -steps: - - mkimg: "{{ output }}" - size: 4G - - - mklabel: gpt - device: "{{ output }}" - - - mkpart: primary - device: "{{ output }}" - start: 0% - end: 1G - tag: efifs - - - mkpart: primary - device: "{{ output }}" - start: 1G - end: 100% - tag: rootfs - - - kpartx: "{{ output }}" - - - mkfs: vfat - partition: efifs - - - 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 - - - debootstrap: buster - mirror: http://deb.debian.org/debian - keyring: /usr/share/keyrings/debian-archive-keyring.gpg - target: rootfs - unless: rootfs_unpacked - - - apt: install - packages: - - linux-image-amd64 - tag: rootfs - unless: rootfs_unpacked - - - cache-rootfs: rootfs - unless: rootfs_unpacked - - - chroot: rootfs - shell: | - sed -i '/^root:[^:]*:/s//root::/' /etc/passwd - echo pc-vmdb2 > /etc/hostname - - - fstab: rootfs - - - grub: uefi - tag: rootfs - efi: efifs - console: serial diff --git a/smoke.sh b/smoke.sh deleted file mode 100755 index fa7ff0c..0000000 --- a/smoke.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -eu - -tarball="$1" -shift - -yarn smoke.yarn --env ROOTFS_TARBALL="$tarball" "$@" diff --git a/smoke.yarn b/smoke.yarn deleted file mode 100644 index fde689f..0000000 --- a/smoke.yarn +++ /dev/null @@ -1,98 +0,0 @@ -# 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 an amd64 system (and -thus build an amd64 image). 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 image - WHEN user runs vmdb smoke-pc.vmdb --output smoke-pc.img - THEN user can BIOS boot smoke-pc.img and power it off from root shell - - WHEN user runs vmdb smoke-uefi.vmdb --output smoke-uefi.img - THEN user can UEFI boot smoke-uefi.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 BIOS boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - qemu-system-x86_64 -drive file="$img",format=raw -m 1024 -nographic - EOF - chmod a+rx run.sh - cat << EOF > expect.txt - set timeout 300 - proc abort {} { - puts "ERROR ERROR\n" - exit 1 - } - spawn ./run.sh - expect "login: " - send "root\n" - expect "# " - send "poweroff\r" - set timeout 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - EOF - expect -d expect.txt > expect.out - - IMPLEMENTS THEN user can UEFI boot (\S+) and power it off from root shell - cd "$DATADIR" - img="$MATCH_1" - cat << EOF > run.sh - cp /usr/share/OVMF/OVMF_VARS.fd . - qemu-system-x86_64 \ - -m 1024 \ - -drive if=pflash,format=raw,unit=0,file=/usr/share/ovmf/OVMF.fd,readonly=on \ - -drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd \ - -drive format=raw,file="$img" \ - -nographic - EOF - chmod a+rx run.sh - cat << EOF > expect.txt - set timeout 300 - proc abort {} { - puts "ERROR ERROR\n" - exit 1 - } - spawn ./run.sh - expect "login: " - send "root\n" - expect "# " - send "poweroff\r" - set timeout 5 - expect { - "reboot: Power down" {puts poweroffing\n} - eof abort - timeout abort - } - expect eof - EOF - expect -d expect.txt > expect.out diff --git a/yarns/100-mvp.yarn b/yarns/100-mvp.yarn deleted file mode 100644 index 9ebb650..0000000 --- a/yarns/100-mvp.yarn +++ /dev/null @@ -1,168 +0,0 @@ ---- -title: vmdb2 MVP with echo and error -author: Lars Wirzenius -date: work in progress -... - - -Introduction -============================================================================= - -vmdb2 is a program for producing a disk image with Debian installed. -This document is a manual of sorts, and an automated test suite for it. - -[vmdebootstrap][] installs Debian onto a disk, or disk image. It is -like the [debootstrap][] tool, except the end result is a disk or disk -image, not a directory tree. vmdebootstrap takes care of creating -partitions, and filesystems, and allows some more customization than -vmdebootstrap does. - -vmdebootstrap is also a messy pile of kludge, and not flexible enough. -vmdb2 is a re-implementation from scratch, without a need for -backwards compatibility. It aims to provide more flexibility than -vmdeboostrap, without becoming anywhere near as complicated. Think of -vmdb2 as "vmdebootstrap the second generation". The name has changed -to allow the two tools to installable in paralllel. - -The main user-visible difference between vmdebootstrap and vmdb2 is -that the older program provides extensibitlity via a legion of command -line options and the newer program by having the user user a domain -specific language to express what kind of Debian system they want to -create. - -(Lars Wirzenius wrote both vmdebootstrap and vmdb2 and is entitled to -sneer at his younger self.) - -[vmdebootstrap]: http://liw.fi/vmdebootstrap/ -[debootstrap]: https://packages.debian.org/unstable/debootstrap - - -Contact ------------------------------------------------------------------------------ - -To make contact with the vmdb2 project you can email Lars directly -(`liw@liw.fi?`) or use the `#vmdb2` IRC channel on the irc.oftc.net -network. - - - -Specification files -============================================================================= - -A vmdb2 specification file is a YAML file that looks like this (this -is an imaginary example that doens't actually work right now): - - EXAMPLE - steps: - - mkimg: raw - size: 4G - - mkfs: ext4 - label: vmdb2rootfs - - debootstrap: jessie - - shell: | - rm -rf /usr/share/man - - adduser: jimbo - gecos: James Bond - shell: /bin/zsh - - sudo: jimbo - - ifupdown: eth0 - auto: yes - dhcp: yes - - apt: openssh-server - - convert: qcow2 - - compress: xz - -The list of steps produces the kind of image that the user wants (or -else an unholy mess). The specification file can easily be shared, and -put under version control. - -Every action in a step is provided by a plugin to vmdb2. Each action -(technically, "step runner") is a well-defined task, which may be -parameterised by some of the key/value pairs in the step. For example, -`mkimg` would create a disk image file. In the above example it is a -raw disk image file, as opposed to some other format. The image is 4 -gigabytes in size. `mkfs` creates an ext4 filesystem in the image -file; in thie example there are no partitions. And so on. - -Steps may need to clean up after themselves. For example, a step that -mounts a filesystem will need to unmount it at the end of the image -creation. Also, if a later step fails, then the unmount needs to -happen as well. This is called a "teardown". Some steps are provided -by a plugin that handles the teardown automatically, others may need -to provide instructions for the teardown in the specification file. - -By providing well-defined steps that the user may combine as they -wish, vmdb2 gives great flexibility without much complexity, but at -the cost of forcing the user to write a longer specification file than -a single vmdeboostrap command line. - - -A happy path -============================================================================= - -The first case we look at is one for the happy path: a specification -with two echo steps, and nothing else. It's very simple, and nothing -goes wrong when executing it. In addition to the actual thing to do, -each step may also define a "teardown" thing to do. For example, if -the step mounts a filesystem, the teardown would unmount it. - - SCENARIO happy path - GIVEN a specification file called happy.vmdb containing - ... { - ... steps: [ - ... { echo: "foo", teardown: "foo_teardown" }, - ... { echo: "bar", teardown: "bar_teardown" } - ... ] - ... } - WHEN user runs vmdb2 -v happy.vmdb --output happy.img - THEN exit code is 0 - AND stdout contains "foo" followed by "bar" - AND stdout contains "bar" followed by "bar_teardown" - AND stdout contains "bar_teardown" followed by "foo_teardown" - - -Jinja2 templating in specification file values -============================================================================= - -Vmdb2 allows values in specification files to be processed by the -Jinja2 templating engine. This allows users to do thing such as write -specifications that use configuration values to determine what -happens. For our simple echo/error steps, we will write a rule that -outputs the image file name given by the user. A more realistic -specification file would instead do thing like create the file. - - SCENARIO jinja2 templating - GIVEN a specification file called j2.vmdb containing - ... { - ... steps: [ - ... { echo: "image is {{ output }}" }, - ... { echo: "bar" }, - ... ] - ... } - WHEN user runs vmdb2 -v --output=foo.img j2.vmdb - THEN exit code is 0 - AND stdout contains "image is foo.img" followed by "bar" - - -Error handling -============================================================================= - -Sometimes things do not quite go as they should. What does vmdb2 do -then? - - SCENARIO error handling - GIVEN a specification file called unhappy.vmdb containing - ... { - ... steps: [ - ... { echo: "foo", teardown: "foo_teardown" }, - ... { error: "yikes", teardown: "WAT?!" }, - ... { echo: "bar_step", teardown: "bar_teardown" } - ... ] - ... } - WHEN user runs vmdb2 -v unhappy.vmdb --output=unhappy.img - THEN exit code is 1 - AND stdout contains "foo" followed by "yikes" - AND stdout contains "yikes" followed by "WAT?!" - AND stdout contains "WAT?!" followed by "foo_teardown" - AND stdout does NOT contain "bar_step" - AND stdout does NOT contain "bar_teardown" diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn deleted file mode 100644 index 4123fc6..0000000 --- a/yarns/900-implements.yarn +++ /dev/null @@ -1,46 +0,0 @@ -IMPLEMENTS for all scenario steps -============================================================================= - -This chapter contains the implementations for all scenario steps. - - IMPLEMENTS GIVEN a specification file called (\S+) containing (.+) - filename = get_next_match() - spec = get_next_match() - open(filename, 'w').write(spec) - - IMPLEMENTS WHEN user runs vmdb2 (.*) - args = get_next_match() - vmdb2 = os.path.join(srcdir, 'vmdb2') - p = subprocess.Popen( - [vmdb2] + args.split(), - stdin=subprocess.DEVNULL, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - out, err = p.communicate() - vars['exit'] = p.returncode - vars['stdout'] = out.decode() - vars['stderr'] = err.decode() - - IMPLEMENTS THEN exit code is (\d+) - wanted = int(get_next_match()) - exit = vars['exit'] - print('exit code', exit) - print('stdout:', vars['stdout']) - print('stderr:', vars['stderr']) - assertEqual(exit, wanted) - - IMPLEMENTS THEN stdout contains "(.+)" followed by "(.+)" - first = get_next_match() - second = get_next_match() - stdout = vars['stdout'] - first_i = stdout.find(first) - assertGreaterThan(first_i, 0) - rest = stdout[first_i + len(first):] - second_i = rest.find(second) - assertGreaterThan(second_i, -1) - - IMPLEMENTS THEN stdout does NOT contain "(\S+)" - what = get_next_match() - stdout = vars['stdout'] - i = stdout.find(what) - assertEqual(i, -1) diff --git a/yarns/Makefile b/yarns/Makefile deleted file mode 100644 index b50e685..0000000 --- a/yarns/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2017 Lars Wirzenius -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# =*= License: GPL-3+ =*= - - -all: yarns.html - -yarns.pdf: $(yarns) Makefile - pandoc --chapters --toc -o yarns.pdf *.yarn - -yarns.html: $(yarns) Makefile ugly.css - pandoc -H ugly.css -f markdown+smart --toc \ - --top-level-division=chapter --number-sections \ - -V geometry:lettersize \ - --standalone --self-contained -o yarns.html *.yarn diff --git a/yarns/lib.py b/yarns/lib.py deleted file mode 100644 index e9d9776..0000000 --- a/yarns/lib.py +++ /dev/null @@ -1,10 +0,0 @@ -import os -import subprocess -import sys - -from yarnutils import * - -srcdir = os.environ["SRCDIR"] -datadir = os.environ["DATADIR"] - -vars = Variables(datadir) diff --git a/yarns/ugly.css b/yarns/ugly.css deleted file mode 100644 index 78cd374..0000000 --- a/yarns/ugly.css +++ /dev/null @@ -1,79 +0,0 @@ -<style> -html { - background: white; - font-family: serif; - margin-left: 3em; - margin-right: 2em; - margin-top: 2em; -} - -form#searchform { - font-family: monospace; - text-align: right; -} - -div.actions { - font-family: monospace; - text-align: right; -} - -div.actions ul, div.actions li { - display: inline; -} - -div.pageheader { - font-family: monospace; - margin-bottom: 2em; -} - -div.pageheader span.title { - display: block; - font-size: 200%; - font-weight: bold; - font-family: sans-serif; - margin-top: 0.5em; -} - -div#pagebody { -} - -div.pagefooter { - font-family: monospace; - margin-top: 3em; -} - -div#pagebody { -} - -div#TOC ul { - list-style: none; -} - -h1, h2, h3, h4, h5, h6 { - font-family: sans-serif; - font-weight: bold; - margin-top: 2em; -} - -h1 { - font-size: 150%; -} - -h2 { - font-size: 120%; -} - -h3 { - font-size: 100%; -} - -ul li, ol li { - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -pre { - margin-left: 4em; -} - -</style> |