pkg/bpftrace: Add a trivial test for pkg/bpftrace

Signed-off-by: Simarpreet Singh <simar@linux.com>
This commit is contained in:
Simarpreet Singh 2018-11-20 17:21:59 -08:00
parent 3e0686e5c2
commit 5c4523939b
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#!/bin/sh
nsenter -t1 -m -- /usr/bin/bpftrace -l
if [ "$?" -ne "0" ]; then
printf "bpftrace test suite FAILED\n" >&1
exit 1
fi;
printf "bpftrace test suite PASSED\n" >&1

View File

@ -0,0 +1,23 @@
#!/bin/sh
# SUMMARY: Check that the bpftrace package works
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=bpftrace
clean_up() {
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -0,0 +1,29 @@
kernel:
image: linuxkit/kernel:4.14.86
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:v0.5
- linuxkit/runc:v0.5
- linuxkit/bpftrace:67b5c3b4f13a4acf22eab8f422091e1efc06852d
onboot:
- name: bpftrace-test
image: alpine:3.8
binds:
- /check.sh:/check.sh
command: ["sh", "./check.sh"]
pid: host
net: host
ipc: host
capabilities:
- all
- name: poweroff
image: linuxkit/poweroff:2687ed712690766b8156a77ac600005b532d2c7d
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh
trust:
org:
- linuxkit
image:
- alpine:3.8