mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-30 14:10:57 +00:00
tests: Add initial hyperkit tun test
This uses 'expect' instead of 'grep' because hyperkit is a bit finicky with re-directing the output (it expects a tty). 'expect' handles this and is installed on macOS by default. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
e62e94a240
commit
822d179a2b
31
test/cases/010_platforms/010_hyperkit/000_run_kernel/test.exp
Executable file
31
test/cases/010_platforms/010_hyperkit/000_run_kernel/test.exp
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env expect
|
||||
spawn linuxkit run hyperkit hyperkit-kernel
|
||||
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
|
27
test/cases/010_platforms/010_hyperkit/000_run_kernel/test.sh
Normal file
27
test/cases/010_platforms/010_hyperkit/000_run_kernel/test.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that the kernel+initrd image boots on hyperkit
|
||||
# LABELS:
|
||||
# AUTHOR: Rolf Neugebauer <rolf.neugebauer@docker.com>
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=hyperkit-kernel
|
||||
|
||||
clean_up() {
|
||||
echo $(pwd)
|
||||
# remove any files, containers, images etc
|
||||
rm -rf "${NAME}"* || true
|
||||
}
|
||||
trap clean_up EXIT
|
||||
|
||||
moby build -name "${NAME}" test.yml
|
||||
[ -f "${NAME}-kernel" ] || exit 1
|
||||
[ -f "${NAME}-initrd.img" ] || exit 1
|
||||
[ -f "${NAME}-cmdline" ]|| exit 1
|
||||
./test.exp
|
||||
exit 0
|
@ -0,0 +1,16 @@
|
||||
kernel:
|
||||
image: "linuxkit/kernel:4.9.x"
|
||||
cmdline: "console=ttyS0 console=tty0 page_poison=1"
|
||||
init:
|
||||
- linuxkit/init:f71c3b30ac1ba4ef16c160c89610fa4976f9752f
|
||||
- linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
|
||||
- linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed
|
||||
onboot:
|
||||
- name: poweroff
|
||||
image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8"
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
trust:
|
||||
image:
|
||||
- linuxkit/kernel
|
||||
outputs:
|
||||
- format: kernel+initrd
|
Loading…
Reference in New Issue
Block a user