From 6f80f53ea1e6027cbac269c82a9f974d652b0d6c Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Wed, 5 Jul 2017 16:26:37 +0100
Subject: [PATCH] tests: Add test cases for format, mount and extend pkgs
This commit adds a myriad of test cases to ensure the format and mount
and extend packages are working as expected
Signed-off-by: Dave Tucker
---
.../008_format_mount/000_auto/check.sh | 10 +++++
.../008_format_mount/000_auto/test.sh | 26 +++++++++++++
.../008_format_mount/000_auto/test.yml | 30 +++++++++++++++
.../008_format_mount/001_by_label/check.sh | 10 +++++
.../008_format_mount/001_by_label/test.sh | 26 +++++++++++++
.../008_format_mount/001_by_label/test.yml | 30 +++++++++++++++
.../008_format_mount/002_by_name/.gitignore | 1 +
.../008_format_mount/002_by_name/check.sh | 10 +++++
.../008_format_mount/002_by_name/test.sh | 33 +++++++++++++++++
.../002_by_name/test.yml.orig | 30 +++++++++++++++
.../008_format_mount/003_btrfs/check.sh | 10 +++++
.../008_format_mount/003_btrfs/test.sh | 26 +++++++++++++
.../008_format_mount/003_btrfs/test.yml | 37 +++++++++++++++++++
.../008_format_mount/004_xfs/check.sh | 10 +++++
.../008_format_mount/004_xfs/test.sh | 26 +++++++++++++
.../008_format_mount/004_xfs/test.yml | 30 +++++++++++++++
.../008_format_mount/010_multiple/check.sh | 11 ++++++
.../008_format_mount/010_multiple/test.sh | 26 +++++++++++++
.../008_format_mount/010_multiple/test.yml | 37 +++++++++++++++++++
.../009_extend/000_ext4/Dockerfile | 2 +
.../040_packages/009_extend/000_ext4/check.sh | 13 +++++++
.../009_extend/000_ext4/extend.sh | 3 ++
.../009_extend/000_ext4/test-create.yml | 25 +++++++++++++
.../040_packages/009_extend/000_ext4/test.sh | 35 ++++++++++++++++++
.../040_packages/009_extend/000_ext4/test.yml | 29 +++++++++++++++
.../009_extend/001_btrfs/Dockerfile | 2 +
.../009_extend/001_btrfs/check.sh | 13 +++++++
.../009_extend/001_btrfs/extend.sh | 3 ++
.../009_extend/001_btrfs/test-create.yml | 33 +++++++++++++++++
.../040_packages/009_extend/001_btrfs/test.sh | 35 ++++++++++++++++++
.../009_extend/001_btrfs/test.yml | 37 +++++++++++++++++++
.../009_extend/002_xfs/Dockerfile | 2 +
.../040_packages/009_extend/002_xfs/check.sh | 13 +++++++
.../040_packages/009_extend/002_xfs/extend.sh | 3 ++
.../009_extend/002_xfs/test-create.yml | 26 +++++++++++++
.../040_packages/009_extend/002_xfs/test.sh | 35 ++++++++++++++++++
.../040_packages/009_extend/002_xfs/test.yml | 30 +++++++++++++++
37 files changed, 758 insertions(+)
create mode 100755 test/cases/040_packages/008_format_mount/000_auto/check.sh
create mode 100644 test/cases/040_packages/008_format_mount/000_auto/test.sh
create mode 100644 test/cases/040_packages/008_format_mount/000_auto/test.yml
create mode 100755 test/cases/040_packages/008_format_mount/001_by_label/check.sh
create mode 100644 test/cases/040_packages/008_format_mount/001_by_label/test.sh
create mode 100644 test/cases/040_packages/008_format_mount/001_by_label/test.yml
create mode 100644 test/cases/040_packages/008_format_mount/002_by_name/.gitignore
create mode 100755 test/cases/040_packages/008_format_mount/002_by_name/check.sh
create mode 100644 test/cases/040_packages/008_format_mount/002_by_name/test.sh
create mode 100644 test/cases/040_packages/008_format_mount/002_by_name/test.yml.orig
create mode 100755 test/cases/040_packages/008_format_mount/003_btrfs/check.sh
create mode 100644 test/cases/040_packages/008_format_mount/003_btrfs/test.sh
create mode 100644 test/cases/040_packages/008_format_mount/003_btrfs/test.yml
create mode 100755 test/cases/040_packages/008_format_mount/004_xfs/check.sh
create mode 100644 test/cases/040_packages/008_format_mount/004_xfs/test.sh
create mode 100644 test/cases/040_packages/008_format_mount/004_xfs/test.yml
create mode 100755 test/cases/040_packages/008_format_mount/010_multiple/check.sh
create mode 100644 test/cases/040_packages/008_format_mount/010_multiple/test.sh
create mode 100644 test/cases/040_packages/008_format_mount/010_multiple/test.yml
create mode 100644 test/cases/040_packages/009_extend/000_ext4/Dockerfile
create mode 100755 test/cases/040_packages/009_extend/000_ext4/check.sh
create mode 100755 test/cases/040_packages/009_extend/000_ext4/extend.sh
create mode 100644 test/cases/040_packages/009_extend/000_ext4/test-create.yml
create mode 100644 test/cases/040_packages/009_extend/000_ext4/test.sh
create mode 100644 test/cases/040_packages/009_extend/000_ext4/test.yml
create mode 100644 test/cases/040_packages/009_extend/001_btrfs/Dockerfile
create mode 100755 test/cases/040_packages/009_extend/001_btrfs/check.sh
create mode 100755 test/cases/040_packages/009_extend/001_btrfs/extend.sh
create mode 100644 test/cases/040_packages/009_extend/001_btrfs/test-create.yml
create mode 100644 test/cases/040_packages/009_extend/001_btrfs/test.sh
create mode 100644 test/cases/040_packages/009_extend/001_btrfs/test.yml
create mode 100644 test/cases/040_packages/009_extend/002_xfs/Dockerfile
create mode 100755 test/cases/040_packages/009_extend/002_xfs/check.sh
create mode 100755 test/cases/040_packages/009_extend/002_xfs/extend.sh
create mode 100644 test/cases/040_packages/009_extend/002_xfs/test-create.yml
create mode 100644 test/cases/040_packages/009_extend/002_xfs/test.sh
create mode 100644 test/cases/040_packages/009_extend/002_xfs/test.yml
diff --git a/test/cases/040_packages/008_format_mount/000_auto/check.sh b/test/cases/040_packages/008_format_mount/000_auto/check.sh
new file mode 100755
index 000000000..7f0b16d2e
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/000_auto/check.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+function failed {
+ printf "format_mount test suite FAILED\n" >&1
+ exit 1
+}
+
+touch /var/lib/docker/foo || failed
+
+printf "format_mount test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/008_format_mount/000_auto/test.sh b/test/cases/040_packages/008_format_mount/000_auto/test.sh
new file mode 100644
index 000000000..adcf20390
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/000_auto/test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# SUMMARY: Check that a disk can be formatted and mounted
+# LABELS:
+# REPEAT:
+
+set -e
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-format
+
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/008_format_mount/000_auto/test.yml b/test/cases/040_packages/008_format_mount/000_auto/test.yml
new file mode 100644
index 000000000..29f73bcc7
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/000_auto/test.yml
@@ -0,0 +1,30 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/008_format_mount/001_by_label/check.sh b/test/cases/040_packages/008_format_mount/001_by_label/check.sh
new file mode 100755
index 000000000..7f0b16d2e
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/001_by_label/check.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+function failed {
+ printf "format_mount test suite FAILED\n" >&1
+ exit 1
+}
+
+touch /var/lib/docker/foo || failed
+
+printf "format_mount test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/008_format_mount/001_by_label/test.sh b/test/cases/040_packages/008_format_mount/001_by_label/test.sh
new file mode 100644
index 000000000..47017b995
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/001_by_label/test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# SUMMARY: Check that a formatted disk can be mounted by label
+# LABELS:
+# REPEAT:
+
+set -e
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-format
+
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/008_format_mount/001_by_label/test.yml b/test/cases/040_packages/008_format_mount/001_by_label/test.yml
new file mode 100644
index 000000000..fffb9f486
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/001_by_label/test.yml
@@ -0,0 +1,30 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-label", "docker"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "-label", "docker", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/008_format_mount/002_by_name/.gitignore b/test/cases/040_packages/008_format_mount/002_by_name/.gitignore
new file mode 100644
index 000000000..e9af030ae
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/002_by_name/.gitignore
@@ -0,0 +1 @@
+test.yml
diff --git a/test/cases/040_packages/008_format_mount/002_by_name/check.sh b/test/cases/040_packages/008_format_mount/002_by_name/check.sh
new file mode 100755
index 000000000..7f0b16d2e
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/002_by_name/check.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+function failed {
+ printf "format_mount test suite FAILED\n" >&1
+ exit 1
+}
+
+touch /var/lib/docker/foo || failed
+
+printf "format_mount test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/008_format_mount/002_by_name/test.sh b/test/cases/040_packages/008_format_mount/002_by_name/test.sh
new file mode 100644
index 000000000..35ccad89a
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/002_by_name/test.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# SUMMARY: Check that a formatted disk can be mounted by name
+# LABELS:
+# REPEAT:
+
+set -e
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-format
+
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+ rm -rf test.yml || true
+}
+
+trap clean_up EXIT
+# Test code goes here
+if [ "${RT_OS}" = "osx" ]; then
+ DEVICE="/dev/vda"
+else
+ DEVICE="/dev/sda"
+fi
+
+sed -e "s,@DEVICE@,${DEVICE},g" test.yml.orig > test.yml
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/008_format_mount/002_by_name/test.yml.orig b/test/cases/040_packages/008_format_mount/002_by_name/test.yml.orig
new file mode 100644
index 000000000..829e333ec
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/002_by_name/test.yml.orig
@@ -0,0 +1,30 @@
+kernel:
+ image: linuxkit/kernel:4.9.38
+ cmdline: "console=ttyS0 page_poison=1"
+init:
+ - linuxkit/init:059b2bb4b6efa5c58cf53fed4d0ea863521959fc
+ - linuxkit/runc:4a35484aa6f90a1f06cdf1fb36f7056926a084b9
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "@DEVICE@"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "-device", "@DEVICE@1", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/008_format_mount/003_btrfs/check.sh b/test/cases/040_packages/008_format_mount/003_btrfs/check.sh
new file mode 100755
index 000000000..7f0b16d2e
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/003_btrfs/check.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+function failed {
+ printf "format_mount test suite FAILED\n" >&1
+ exit 1
+}
+
+touch /var/lib/docker/foo || failed
+
+printf "format_mount test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/008_format_mount/003_btrfs/test.sh b/test/cases/040_packages/008_format_mount/003_btrfs/test.sh
new file mode 100644
index 000000000..c102353f9
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/003_btrfs/test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# SUMMARY: Check that a btrfs formatted disk can be mounted
+# LABELS:
+# REPEAT:
+
+set -e
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-format
+
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/008_format_mount/003_btrfs/test.yml b/test/cases/040_packages/008_format_mount/003_btrfs/test.yml
new file mode 100644
index 000000000..207b79660
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/003_btrfs/test.yml
@@ -0,0 +1,37 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: modprobe
+ image: alpine:3.6
+ capabilities: [all]
+ binds:
+ - /lib/modules:/lib/modules
+ - /sys:/sys
+ command: ["modprobe", "btrfs"]
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-type", "btrfs" ]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/008_format_mount/004_xfs/check.sh b/test/cases/040_packages/008_format_mount/004_xfs/check.sh
new file mode 100755
index 000000000..7f0b16d2e
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/004_xfs/check.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+function failed {
+ printf "format_mount test suite FAILED\n" >&1
+ exit 1
+}
+
+touch /var/lib/docker/foo || failed
+
+printf "format_mount test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/008_format_mount/004_xfs/test.sh b/test/cases/040_packages/008_format_mount/004_xfs/test.sh
new file mode 100644
index 000000000..29a4ea81f
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/004_xfs/test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# SUMMARY: Check that an XFS formatted disk can be mounted
+# LABELS:
+# REPEAT:
+
+set -e
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-format
+
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/008_format_mount/004_xfs/test.yml b/test/cases/040_packages/008_format_mount/004_xfs/test.yml
new file mode 100644
index 000000000..04a746238
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/004_xfs/test.yml
@@ -0,0 +1,30 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-type", "xfs" ]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/008_format_mount/010_multiple/check.sh b/test/cases/040_packages/008_format_mount/010_multiple/check.sh
new file mode 100755
index 000000000..e630c59ea
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/010_multiple/check.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+function failed {
+ printf "format_mount test suite FAILED\n" >&1
+ exit 1
+}
+
+touch /var/lib/docker/foo || failed
+touch /var/foo/bar || failed
+
+printf "format_mount test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/008_format_mount/010_multiple/test.sh b/test/cases/040_packages/008_format_mount/010_multiple/test.sh
new file mode 100644
index 000000000..93d763700
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/010_multiple/test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# SUMMARY: Check that the format and mount packages work
+# LABELS:
+# REPEAT:
+
+set -e
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-format
+
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M -disk file=${NAME}2.img,size=512M ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/008_format_mount/010_multiple/test.yml b/test/cases/040_packages/008_format_mount/010_multiple/test.yml
new file mode 100644
index 000000000..b668db2d7
--- /dev/null
+++ b/test/cases/040_packages/008_format_mount/010_multiple/test.yml
@@ -0,0 +1,37 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-label", "docker"]
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-label", "foo"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "-label", "docker", "/var/lib/docker"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "-label", "foo", "/var/foo"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /var/foo:/var/foo
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/009_extend/000_ext4/Dockerfile b/test/cases/040_packages/009_extend/000_ext4/Dockerfile
new file mode 100644
index 000000000..7d65b7bf1
--- /dev/null
+++ b/test/cases/040_packages/009_extend/000_ext4/Dockerfile
@@ -0,0 +1,2 @@
+FROM alpine:3.6
+RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux
diff --git a/test/cases/040_packages/009_extend/000_ext4/check.sh b/test/cases/040_packages/009_extend/000_ext4/check.sh
new file mode 100755
index 000000000..c14eef3c5
--- /dev/null
+++ b/test/cases/040_packages/009_extend/000_ext4/check.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -x
+
+function failed {
+ printf "extend test suite FAILED\n" >&1
+ exit 1
+}
+
+[ -f /var/lib/docker/bar ] || failed
+touch /var/lib/docker/foo || failed
+df -h | grep -q "490.9M" || failed
+printf "extend test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/009_extend/000_ext4/extend.sh b/test/cases/040_packages/009_extend/000_ext4/extend.sh
new file mode 100755
index 000000000..f7f9e5788
--- /dev/null
+++ b/test/cases/040_packages/009_extend/000_ext4/extend.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -ex
+qemu-img resize -f qcow2 "$1" +256M
diff --git a/test/cases/040_packages/009_extend/000_ext4/test-create.yml b/test/cases/040_packages/009_extend/000_ext4/test-create.yml
new file mode 100644
index 000000000..4d0f6e533
--- /dev/null
+++ b/test/cases/040_packages/009_extend/000_ext4/test-create.yml
@@ -0,0 +1,25 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ command: ["touch", "/var/lib/docker/bar"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/009_extend/000_ext4/test.sh b/test/cases/040_packages/009_extend/000_ext4/test.sh
new file mode 100644
index 000000000..91b8e86a2
--- /dev/null
+++ b/test/cases/040_packages/009_extend/000_ext4/test.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# SUMMARY: Check that an ext4 partition can be extended
+# LABELS:
+# REPEAT:
+
+set -ex
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-extend
+DISK=disk0.img
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+ rm -rf ${DISK} || true
+ docker rmi ${NAME} || true
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+rm -rf ${DISK} || true
+docker build -t ${NAME} .
+moby build --name create -output kernel+initrd test-create.yml
+linuxkit run -disk file=${DISK},size=256M create
+rm -rf "create*"
+[ -f ${DISK} ] || exit 1
+docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK}
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/009_extend/000_ext4/test.yml b/test/cases/040_packages/009_extend/000_ext4/test.yml
new file mode 100644
index 000000000..431743f30
--- /dev/null
+++ b/test/cases/040_packages/009_extend/000_ext4/test.yml
@@ -0,0 +1,29 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: extend
+ image: linuxkit/extend:1e81ffe40ad63887d6210228c2a791f28375ee0f
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/009_extend/001_btrfs/Dockerfile b/test/cases/040_packages/009_extend/001_btrfs/Dockerfile
new file mode 100644
index 000000000..7d65b7bf1
--- /dev/null
+++ b/test/cases/040_packages/009_extend/001_btrfs/Dockerfile
@@ -0,0 +1,2 @@
+FROM alpine:3.6
+RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux
diff --git a/test/cases/040_packages/009_extend/001_btrfs/check.sh b/test/cases/040_packages/009_extend/001_btrfs/check.sh
new file mode 100755
index 000000000..905634e7d
--- /dev/null
+++ b/test/cases/040_packages/009_extend/001_btrfs/check.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -x
+
+function failed {
+ printf "extend test suite FAILED\n" >&1
+ exit 1
+}
+
+[ -f /var/lib/docker/bar ] || failed
+touch /var/lib/docker/foo || failed
+df -h | grep -q "511.0M" || failed
+printf "extend test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/009_extend/001_btrfs/extend.sh b/test/cases/040_packages/009_extend/001_btrfs/extend.sh
new file mode 100755
index 000000000..f7f9e5788
--- /dev/null
+++ b/test/cases/040_packages/009_extend/001_btrfs/extend.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -ex
+qemu-img resize -f qcow2 "$1" +256M
diff --git a/test/cases/040_packages/009_extend/001_btrfs/test-create.yml b/test/cases/040_packages/009_extend/001_btrfs/test-create.yml
new file mode 100644
index 000000000..cc0f430fe
--- /dev/null
+++ b/test/cases/040_packages/009_extend/001_btrfs/test-create.yml
@@ -0,0 +1,33 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: modprobe
+ image: alpine:3.6
+ capabilities: [all]
+ binds:
+ - /lib/modules:/lib/modules
+ - /sys:/sys
+ command: ["modprobe", "btrfs"]
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-type", "btrfs" ]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ command: ["touch", "/var/lib/docker/bar"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/009_extend/001_btrfs/test.sh b/test/cases/040_packages/009_extend/001_btrfs/test.sh
new file mode 100644
index 000000000..9649bc8f6
--- /dev/null
+++ b/test/cases/040_packages/009_extend/001_btrfs/test.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# SUMMARY: Check that a btrfs partition can be extended
+# LABELS:
+# REPEAT:
+
+set -ex
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-extend
+DISK=disk0.img
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+ rm -rf ${DISK} || true
+ docker rmi ${NAME} || true
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+rm -rf disk0.img || true
+docker build -t ${NAME} .
+moby build --name create -output kernel+initrd test-create.yml
+linuxkit run -disk file=${DISK},size=256M create
+rm -rf "create*"
+[ -f ${DISK} ] || exit 1
+docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK}
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/009_extend/001_btrfs/test.yml b/test/cases/040_packages/009_extend/001_btrfs/test.yml
new file mode 100644
index 000000000..6cc722d6a
--- /dev/null
+++ b/test/cases/040_packages/009_extend/001_btrfs/test.yml
@@ -0,0 +1,37 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: modprobe
+ image: alpine:3.6
+ capabilities: [all]
+ binds:
+ - /lib/modules:/lib/modules
+ - /sys:/sys
+ command: ["modprobe", "btrfs"]
+ - name: extend
+ image: linuxkit/extend:1e81ffe40ad63887d6210228c2a791f28375ee0f
+ command: ["/usr/bin/extend", "-type", "btrfs"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/009_extend/002_xfs/Dockerfile b/test/cases/040_packages/009_extend/002_xfs/Dockerfile
new file mode 100644
index 000000000..7d65b7bf1
--- /dev/null
+++ b/test/cases/040_packages/009_extend/002_xfs/Dockerfile
@@ -0,0 +1,2 @@
+FROM alpine:3.6
+RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux
diff --git a/test/cases/040_packages/009_extend/002_xfs/check.sh b/test/cases/040_packages/009_extend/002_xfs/check.sh
new file mode 100755
index 000000000..4523db10d
--- /dev/null
+++ b/test/cases/040_packages/009_extend/002_xfs/check.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -x
+
+function failed {
+ printf "extend test suite FAILED\n" >&1
+ exit 1
+}
+
+[ -f /var/lib/docker/bar ] || failed
+touch /var/lib/docker/foo || failed
+df -h | grep -q "507.7M" || failed
+printf "extend test suite PASSED\n" >&1
diff --git a/test/cases/040_packages/009_extend/002_xfs/extend.sh b/test/cases/040_packages/009_extend/002_xfs/extend.sh
new file mode 100755
index 000000000..f7f9e5788
--- /dev/null
+++ b/test/cases/040_packages/009_extend/002_xfs/extend.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -ex
+qemu-img resize -f qcow2 "$1" +256M
diff --git a/test/cases/040_packages/009_extend/002_xfs/test-create.yml b/test/cases/040_packages/009_extend/002_xfs/test-create.yml
new file mode 100644
index 000000000..c97b2a616
--- /dev/null
+++ b/test/cases/040_packages/009_extend/002_xfs/test-create.yml
@@ -0,0 +1,26 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: format
+ image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
+ command: ["/usr/bin/format", "-type", "xfs"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ command: ["touch", "/var/lib/docker/bar"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+trust:
+ org:
+ - linuxkit
+ - library
diff --git a/test/cases/040_packages/009_extend/002_xfs/test.sh b/test/cases/040_packages/009_extend/002_xfs/test.sh
new file mode 100644
index 000000000..cc05a834f
--- /dev/null
+++ b/test/cases/040_packages/009_extend/002_xfs/test.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# SUMMARY: Check that an XFS partition can be extended
+# LABELS:
+# REPEAT:
+
+set -ex
+
+# Source libraries. Uncomment if needed/defined
+#. "${RT_LIB}"
+. "${RT_PROJECT_ROOT}/_lib/lib.sh"
+
+NAME=test-extend
+DISK=disk0.img
+clean_up() {
+ find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
+ rm -rf ${DISK} || true
+ docker rmi ${NAME} || true
+}
+
+trap clean_up EXIT
+
+# Test code goes here
+rm -rf disk0.img || true
+docker build -t ${NAME} .
+moby build --name create -output kernel+initrd test-create.yml
+linuxkit run -disk file=${DISK},size=256M create
+rm -rf "create*"
+[ -f ${DISK} ] || exit 1
+docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK}
+moby build -name ${NAME} -output kernel+initrd test.yml
+RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
+echo "${RESULT}"
+echo "${RESULT}" | grep -q "suite PASSED"
+
+exit 0
diff --git a/test/cases/040_packages/009_extend/002_xfs/test.yml b/test/cases/040_packages/009_extend/002_xfs/test.yml
new file mode 100644
index 000000000..535764a6e
--- /dev/null
+++ b/test/cases/040_packages/009_extend/002_xfs/test.yml
@@ -0,0 +1,30 @@
+kernel:
+ image: linuxkit/kernel:4.9.39
+ cmdline: "console=ttyS0"
+init:
+ - linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
+ - linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
+onboot:
+ - name: extend
+ image: linuxkit/extend:1e81ffe40ad63887d6210228c2a791f28375ee0f
+ command: ["/usr/bin/extend", "-type", "xfs"]
+ - name: mount
+ image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
+ command: ["/usr/bin/mountie", "/var/lib/docker"]
+ - name: test
+ image: alpine:3.6
+ readonly: true
+ binds:
+ - /var/lib/docker:/var/lib/docker
+ - /check.sh:/check.sh
+ command: ["sh", "./check.sh"]
+ - name: poweroff
+ image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
+ command: ["/bin/sh", "/poweroff.sh", "10"]
+files:
+ - path: check.sh
+ source: ./check.sh
+trust:
+ org:
+ - linuxkit
+ - library