mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 10:31:35 +00:00
tests: Clean-up and fix extend tests
- Consistently use env variables for names - Make sure temporary files are removed (the 'create' images were left behind) Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
4541e8511a
commit
59a085efc0
@ -9,24 +9,23 @@ set -ex
|
|||||||
#. "${RT_LIB}"
|
#. "${RT_LIB}"
|
||||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||||
|
|
||||||
NAME=test-extend-ext4
|
NAME_CREATE=create-ext4
|
||||||
DISK=disk0.img
|
NAME_EXTEND=extend-ext4
|
||||||
clean_up() {
|
DISK=disk.img
|
||||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
|
||||||
rm -rf "create*" || true
|
|
||||||
rm -rf ${DISK} || true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
rm -rf ${NAME_CREATE}-* ${NAME_EXTEND}-* ${DISK}
|
||||||
|
}
|
||||||
trap clean_up EXIT
|
trap clean_up EXIT
|
||||||
|
|
||||||
# Test code goes here
|
# Test code goes here
|
||||||
moby build --name create -format kernel+initrd test-create.yml
|
moby build -name "${NAME_CREATE}" -format kernel+initrd test-create.yml
|
||||||
linuxkit run -disk file=${DISK},format=raw,size=256M create
|
linuxkit run -disk file="${DISK}",format=raw,size=256M "${NAME_CREATE}"
|
||||||
[ -f ${DISK} ] || exit 1
|
[ -f "${DISK}" ] || exit 1
|
||||||
# osx takes issue with bs=1M
|
# osx takes issue with bs=1M
|
||||||
dd if=/dev/zero bs=1048576 count=256 >> ${DISK}
|
dd if=/dev/zero bs=1048576 count=256 >> "${DISK}"
|
||||||
moby build -name ${NAME} -format kernel+initrd test.yml
|
moby build -format kernel+initrd -name ${NAME_EXTEND} test.yml
|
||||||
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
|
RESULT="$(linuxkit run -disk file=${DISK} ${NAME_EXTEND})"
|
||||||
echo "${RESULT}"
|
echo "${RESULT}"
|
||||||
echo "${RESULT}" | grep -q "suite PASSED"
|
echo "${RESULT}" | grep -q "suite PASSED"
|
||||||
|
|
||||||
|
@ -9,24 +9,23 @@ set -ex
|
|||||||
#. "${RT_LIB}"
|
#. "${RT_LIB}"
|
||||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||||
|
|
||||||
NAME=test-extend-btrfs
|
NAME_CREATE=extend-btrfs
|
||||||
DISK=disk0.img
|
NAME_EXTEND=extend-btrfs
|
||||||
clean_up() {
|
DISK=disk.img
|
||||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
|
||||||
rm -rf "create*" || true
|
|
||||||
rm -rf ${DISK} || true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
rm -rf ${NAME_CREATE}-* ${NAME_EXTEND}-* ${DISK}
|
||||||
|
}
|
||||||
trap clean_up EXIT
|
trap clean_up EXIT
|
||||||
|
|
||||||
# Test code goes here
|
# Test code goes here
|
||||||
moby build --name create -format kernel+initrd test-create.yml
|
moby build -name "${NAME_CREATE}" -format kernel+initrd test-create.yml
|
||||||
linuxkit run -disk file=${DISK},format=raw,size=256M create
|
linuxkit run -disk file="${DISK}",format=raw,size=256M "${NAME_CREATE}"
|
||||||
[ -f ${DISK} ] || exit 1
|
[ -f "${DISK}" ] || exit 1
|
||||||
# osx takes issue with bs=1M
|
# osx takes issue with bs=1M
|
||||||
dd if=/dev/zero bs=1048576 count=256 >> ${DISK}
|
dd if=/dev/zero bs=1048576 count=256 >> "${DISK}"
|
||||||
moby build -name ${NAME} -format kernel+initrd test.yml
|
moby build -format kernel+initrd -name ${NAME_EXTEND} test.yml
|
||||||
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
|
RESULT="$(linuxkit run -disk file=${DISK} ${NAME_EXTEND})"
|
||||||
echo "${RESULT}"
|
echo "${RESULT}"
|
||||||
echo "${RESULT}" | grep -q "suite PASSED"
|
echo "${RESULT}" | grep -q "suite PASSED"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# SUMMARY: Check that an XFS partition can be extended
|
# SUMMARY: Check that a xfs partition can be extended
|
||||||
# LABELS:
|
# LABELS:
|
||||||
# REPEAT:
|
# REPEAT:
|
||||||
|
|
||||||
@ -9,24 +9,23 @@ set -ex
|
|||||||
#. "${RT_LIB}"
|
#. "${RT_LIB}"
|
||||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||||
|
|
||||||
NAME=test-extend-xfs
|
NAME_CREATE=extend-xfs
|
||||||
DISK=disk0.img
|
NAME_EXTEND=extend-xfs
|
||||||
clean_up() {
|
DISK=disk.img
|
||||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
|
||||||
rm -rf "create*" || true
|
|
||||||
rm -rf ${DISK} || true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
rm -rf ${NAME_CREATE}-* ${NAME_EXTEND}-* ${DISK}
|
||||||
|
}
|
||||||
trap clean_up EXIT
|
trap clean_up EXIT
|
||||||
|
|
||||||
# Test code goes here
|
# Test code goes here
|
||||||
moby build --name create -format kernel+initrd test-create.yml
|
moby build -name "${NAME_CREATE}" -format kernel+initrd test-create.yml
|
||||||
linuxkit run -disk file=${DISK},format=raw,size=256M create
|
linuxkit run -disk file="${DISK}",format=raw,size=256M "${NAME_CREATE}"
|
||||||
[ -f ${DISK} ] || exit 1
|
[ -f "${DISK}" ] || exit 1
|
||||||
# osx takes issue with bs=1M
|
# osx takes issue with bs=1M
|
||||||
dd if=/dev/zero bs=1048576 count=256 >> ${DISK}
|
dd if=/dev/zero bs=1048576 count=256 >> "${DISK}"
|
||||||
moby build -name ${NAME} -format kernel+initrd test.yml
|
moby build -format kernel+initrd -name ${NAME_EXTEND} test.yml
|
||||||
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
|
RESULT="$(linuxkit run -disk file=${DISK} ${NAME_EXTEND})"
|
||||||
echo "${RESULT}"
|
echo "${RESULT}"
|
||||||
echo "${RESULT}" | grep -q "suite PASSED"
|
echo "${RESULT}" | grep -q "suite PASSED"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user