mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
tests: Add build/qemu/hyperkit tests for kernel+squashfs
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
59df6426e4
commit
c1447193b3
24
test/cases/000_build/000_formats/011_kernel+squashfs/test.sh
Normal file
24
test/cases/000_build/000_formats/011_kernel+squashfs/test.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that kernel+initrd output format is generated
|
||||
# LABELS:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=check
|
||||
|
||||
clean_up() {
|
||||
rm -f ${NAME}*
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
linuxkit build -format kernel+squashfs -name "${NAME}" ../test.yml
|
||||
[ -f "${NAME}-kernel" ] || exit 1
|
||||
[ -f "${NAME}-squashfs.img" ] || exit 1
|
||||
[ -f "${NAME}-cmdline" ] || exit 1
|
||||
|
||||
exit 0
|
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that the kernel+squashfs image boots in qemu
|
||||
# LABELS:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=qemu-squashfs
|
||||
|
||||
clean_up() {
|
||||
rm -rf ${NAME}-*
|
||||
}
|
||||
trap clean_up EXIT
|
||||
|
||||
linuxkit build -format kernel+squashfs -name "${NAME}" test.yml
|
||||
[ -f "${NAME}-kernel" ] || exit 1
|
||||
[ -f "${NAME}-squashfs.img" ] || exit 1
|
||||
[ -f "${NAME}-cmdline" ]|| exit 1
|
||||
linuxkit run qemu -squashfs "${NAME}" | grep -q "Welcome to LinuxKit"
|
||||
|
||||
exit 0
|
@ -0,0 +1,13 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.14.34
|
||||
cmdline: "console=ttyS0 console=ttyAMA0"
|
||||
init:
|
||||
- linuxkit/init:v0.3
|
||||
- linuxkit/runc:v0.3
|
||||
onboot:
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:5740687bf0a6a0480922c0f59b3a4ca77c866cae
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
31
test/cases/010_platforms/010_hyperkit/005_run_kernel+squashfs/test.exp
Executable file
31
test/cases/010_platforms/010_hyperkit/005_run_kernel+squashfs/test.exp
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env expect
|
||||
spawn linuxkit run hyperkit -squashfs hyperkit-squashfs
|
||||
set pid [exp_pid]
|
||||
set timeout 30
|
||||
|
||||
expect {
|
||||
timeout {
|
||||
puts "FAILED boot"
|
||||
exec kill -9 $pid
|
||||
exit 1
|
||||
}
|
||||
"Welcome to LinuxKit" {
|
||||
puts "SUCCESS boot"
|
||||
}
|
||||
}
|
||||
expect {
|
||||
timeout {
|
||||
puts "FAILED poweroff"
|
||||
exec kill -9 $pid
|
||||
exit 1
|
||||
}
|
||||
"Power down" {
|
||||
puts "SUCCESS poweroff"
|
||||
}
|
||||
eof {
|
||||
puts "SUCCESS poweroff"
|
||||
}
|
||||
}
|
||||
set waitval [wait -i $spawn_id]
|
||||
set exval [lindex $waitval 3]
|
||||
exit $exval
|
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that the kernel+squashfs image boots on hyperkit
|
||||
# LABELS:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=hyperkit-squashfs
|
||||
|
||||
clean_up() {
|
||||
rm -rf ${NAME}-*
|
||||
}
|
||||
trap clean_up EXIT
|
||||
|
||||
linuxkit build -format kernel+squashfs -name "${NAME}" test.yml
|
||||
[ -f "${NAME}-kernel" ] || exit 1
|
||||
[ -f "${NAME}-squashfs.img" ] || exit 1
|
||||
[ -f "${NAME}-cmdline" ]|| exit 1
|
||||
./test.exp
|
||||
|
||||
exit 0
|
@ -0,0 +1,13 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.14.34
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:v0.3
|
||||
- linuxkit/runc:v0.3
|
||||
onboot:
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:5740687bf0a6a0480922c0f59b3a4ca77c866cae
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
Loading…
Reference in New Issue
Block a user