mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 10:31:35 +00:00
pkg/kmsg: add simple test case
Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
parent
e7fc5b59a3
commit
9344473ba5
15
test/cases/040_packages/031_kmsg/check.sh
Executable file
15
test/cases/040_packages/031_kmsg/check.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for i in $(seq 1 20); do
|
||||||
|
# Look for a common kernel log message
|
||||||
|
if grep "SCSI subsystem initialized" /var/log/kmsg.out 2>/dev/null; then
|
||||||
|
printf "kmsg test suite PASSED\n" > /dev/console
|
||||||
|
/sbin/poweroff -f
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "kmsg test suite FAILED\n" > /dev/console
|
||||||
|
echo "contents of /var/log/kmsg.out:" > /dev/console
|
||||||
|
cat /var/log/kmsg.out > /dev/console
|
||||||
|
/sbin/poweroff -f
|
24
test/cases/040_packages/031_kmsg/test.sh
Normal file
24
test/cases/040_packages/031_kmsg/test.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# SUMMARY: Check that the kmsg package works
|
||||||
|
# LABELS:
|
||||||
|
# REPEAT:
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Source libraries. Uncomment if needed/defined
|
||||||
|
#. "${RT_LIB}"
|
||||||
|
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||||
|
NAME=kmsg
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
rm -rf ${NAME}-*
|
||||||
|
}
|
||||||
|
trap clean_up EXIT
|
||||||
|
|
||||||
|
# Test code goes here
|
||||||
|
linuxkit build -disable-content-trust -format kernel+initrd -name "${NAME}" test.yml
|
||||||
|
RESULT="$(linuxkit run ${NAME})"
|
||||||
|
echo "${RESULT}"
|
||||||
|
echo "${RESULT}" | grep -q "suite PASSED"
|
||||||
|
|
||||||
|
exit 0
|
32
test/cases/040_packages/031_kmsg/test.yml
Normal file
32
test/cases/040_packages/031_kmsg/test.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
kernel:
|
||||||
|
image: linuxkit/kernel:4.14.53
|
||||||
|
cmdline: "console=ttyS0 console=ttyAMA0"
|
||||||
|
init:
|
||||||
|
- linuxkit/init:6cc1442112980c889230b6449df09d5b48de6854
|
||||||
|
- linuxkit/runc:v0.4
|
||||||
|
- linuxkit/containerd:f2bc1bda1ab18146967fa1a149800aaf14bee81b
|
||||||
|
- linuxkit/ca-certificates:v0.4
|
||||||
|
- linuxkit/memlogd:883f0d46e7d3ae2d787e8acb496da115a4707cbc
|
||||||
|
services:
|
||||||
|
- name: kmsg
|
||||||
|
image: linuxkit/kmsg:3dfa0d5b4027ecc16089f27fbcffa15d6aa5438e
|
||||||
|
- name: write-and-rotate-logs
|
||||||
|
image: linuxkit/logwrite:7859c102a963828fd9c5aa3837db9600483220c7
|
||||||
|
- name: check-the-logs
|
||||||
|
image: alpine:3.8
|
||||||
|
binds:
|
||||||
|
- /check.sh:/check.sh
|
||||||
|
- /dev/console:/dev/console
|
||||||
|
- /var/log:/var/log
|
||||||
|
command: ["sh", "./check.sh"]
|
||||||
|
pid: host
|
||||||
|
capabilities:
|
||||||
|
- CAP_SYS_BOOT
|
||||||
|
files:
|
||||||
|
- path: check.sh
|
||||||
|
source: ./check.sh
|
||||||
|
trust:
|
||||||
|
org:
|
||||||
|
- linuxkit
|
||||||
|
image:
|
||||||
|
- alpine:3.8
|
Loading…
Reference in New Issue
Block a user