Merge pull request #1830 from rneugeba/tests

Tidy up the tests
This commit is contained in:
Rolf Neugebauer 2017-05-17 15:14:55 +01:00 committed by GitHub
commit 5fca56e356
50 changed files with 235 additions and 460 deletions

View File

@ -24,10 +24,18 @@ To run add a label you may use:
rtf -x -l slow run
```
To run tests that match the pattern `linuxkit.examples` you would use the following command:
You can list the tests which will be run using:
```
rtf -x run linuxkit.examples
rtf list
```
Some tests may be marked as `SKIP` and `LABELS` column will typically provide and indication as to why a test may be skipped.
To run tests that match the pattern `linuxkit.build` you would use the following command:
```
rtf -x run linuxkit.build
```
### Writing new tests
@ -41,7 +49,7 @@ If you feel that a new group is warranted you can create one by `mkdir 000_name`
You must copy an existing `group.sh` in to this folder and adjust as required or you may use the
[example](https://github.com/linuxkit/rtf/tree/master/etc/templates/group.sh)
To write your test, create a folder within the group using the `000_name` format as described aboce.
To write your test, create a folder within the group using the `000_name` format as described above.
You should then copy an existing `test.sh` in to this directory and amdend it,
or start from an [example](http://github.com/linuxkit/rtf/tree/master/etc/templates/test.sh)
@ -50,9 +58,13 @@ avoid it being run by default and document the use of the label in `tests/README
## Continuous Integration
The LiunxKit CI system uses [DatakitCI](https://github.com/moby/datakit/tree/master/ci)
*Note: This will hopefully change significantly soon*
The LinuxKit CI system uses [DatakitCI](https://github.com/moby/datakit/tree/master/ci)
The configuration can be found [here](https://github.com/linuxkit/linuxkit-ci)
The test logs are available via the `Details` link but also via this [website](https://linuxkit.datakit.ci). The raw test logs are also stored on [GitHub](https://github.com/linuxkit/linuxkit-logs) where each branch contains the results for a particular run.
## PR Testing
Each PR is tested on disposable VM's spawned in Google Cloud Platform
@ -61,9 +73,9 @@ This machine has no privileges or credentials to talk to GCP or other cloud plat
TODO: Add instructions on how to build a base image for LinuxKit CI in GCP.
LinuxKit CI runs `make ci-pr` in the VM.
This target runs the tests using `rtf` and the results directory is SCP'd back to the controller.
This target runs the tests using `rtf` and the results directory is `scp`'ed back to the controller.
The test results will be stored in DataKit for additional access
Additionally a the `./artifacts` folder is SCP'd back to the controller.
Additionally, the `./artifacts` folder is `scp`'ed back to the controller.
If the tests passed the next step is to check if the kernel config test image runs on GCP.
The `./artifacts/test.img.tar.gz` file is used to create a GCP image by the Python scripts

View File

@ -2,7 +2,7 @@
default: check-deps test
pr: check-deps test-pr
# TODO: all should point to test-all once ltp is no longer required
# TODO: should have a separate target
all: check-deps test-pr ltp
MOBY:=$(shell command -v moby 2> /dev/null)
@ -24,6 +24,15 @@ endif
# TODO: Remove this section once we no longer depend on this in CI
### -------
# Currently the linuxkit-ci runs GCP tests outside of rtf and expects some
# files in ../artifacts. This hacky target puts them there until
# the CI can use rtf for running GCP tests
gcp-hack: ../artifacts/test.img.tar.gz
../artifacts/test.img.tar.gz:
rm -rf ../artifacts
mkdir -p ../artifacts
$(MOBY) build --pull -name ../artifacts/test hack/test.yml
define check_test_log
@cat $1 |grep -q 'test suite PASSED'
endef
@ -31,17 +40,14 @@ endef
.PHONY: ltp
ltp: export CLOUDSDK_IMAGE_NAME?=test-ltp
ltp: $(LINUXKIT) test-ltp.img.tar.gz
$(MOBY) build --pull cases/020_stress/000_ltp/test-ltp.yml
$(MOBY) build --pull hack/test-ltp.yml
$(LINUXKIT) push gcp test-ltp.img.tar.gz
$(LINUXKIT) run gcp -skip-cleanup -machine n1-highcpu-4 $(CLOUDSDK_IMAGE_NAME) | tee test-ltp.log
$(call check_test_log, test-ltp.log)
### ------
test:
test: gcp-hack
@rtf -l build -x run
test-pr:
@rtf -vvv -l build -x run
test-all:
@rtf -vvv -x -l build,slow run
test-pr: gcp-hack
@rtf -l build -x run

View File

@ -1,19 +0,0 @@
Linuxkit Tests Labels
=====================
## Usage of Artifacts vs Temporary Directory
As the Build Machines have no secrets they will not be able to test running the build output on any cloud providers.
In this instance, the build tests should copy their output to the `LINUXKIT_ARTIFACTS_DIRECTORY`
## Labels
The `gcp` label is applied when the system where the tests are being run meets the requirements for using Google Cloud Platform.
These requirements are:
- The system has the necessary `CLOUDSDK_*` environment variables exported
- The system has either keys for a GCP service account or is able to use application default credentials
The `packet.net` label is applied when a system is able to create machines on Packet.net
The `vmware` label is used when the machine has VMware Workstation or Fusion installed

View File

@ -0,0 +1,35 @@
#!/bin/sh
# SUMMARY: Check that all supported output formats are generated
# LABELS:
# AUTHOR: Rolf Neugebauer <rolf.neugebauer@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=check
clean_up() {
# remove any images
find . -iname "${NAME}*" -exec rm {} \;
}
trap clean_up EXIT
moby build -name "${NAME}" test.yml
[ -f "${NAME}.tar" ] || exit 1
[ -f "${NAME}-kernel" ] || exit 1
[ -f "${NAME}-initrd.img" ] || exit 1
[ -f "${NAME}-cmdline" ] || exit 1
[ -f "${NAME}.iso" ] || exit 1
[ -f "${NAME}-efi.iso" ] || exit 1
[ -f "${NAME}.img.gz" ] || exit 1
[ -f "${NAME}.qcow2" ] || exit 1
# VHD currently requires a lot of memory, disable for now
# [ -f "${NAME}.vhd" ] || exit 1
[ -f "${NAME}.vmdk" ] || exit 1
exit 0

View File

@ -0,0 +1,33 @@
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0 console=tty0 page_poison=1"
init:
- linuxkit/init:b3740303f3d1e5689a84c87b7dfb48fd2a40a192
- linuxkit/runc:47b1c38d63468c0f3078f8b1b055d07965a1895d
- linuxkit/containerd:cf2614f5a96c569a0bd4bd54e054a65ba17d167f
onboot:
- name: dhcpcd
image: "linuxkit/dhcpcd:2def74ab3f9233b4c09ebb196ba47c27c08b0ed8"
binds:
- /var:/var
- /tmp/etc:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
trust:
image:
- linuxkit/kernel
outputs:
- format: tar
- format: kernel+initrd
- format: iso-bios
- format: iso-efi
- format: img-gz
- format: gcp-img
- format: qcow2
# Disable VHD for now. It requires a lot of memory, which our CI instance currently doesn't have
# - format: vhd
- format: vmdk

View File

@ -1,12 +1,6 @@
#!/bin/sh
# SUMMARY: LinuxKit configuration tests
# SUMMARY: Check that the examples YAML files work
# LABELS:
# For the top level group.sh also specify a 'NAME:' comment
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
#. "${RT_PROJECT_ROOT}/_lib/lib.sh"
group_init() {
# Group initialisation code goes here

View File

@ -0,0 +1,31 @@
#!/bin/sh
# SUMMARY: LinuxKit tests for 'moby build'
# LABELS:
group_init() {
# Group initialisation code goes here
return 0
}
group_deinit() {
# Group de-initialisation code goes here
return 0
}
CMD=$1
case $CMD in
init)
group_init
res=$?
;;
deinit)
group_deinit
res=$?
;;
*)
res=1
;;
esac
exit $res

View File

@ -1,28 +0,0 @@
#!/bin/sh
# SUMMARY: Test building an image for qemu
# LABELS: build
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test-qemu-build
clean_up() {
# remove any files, containers, images etc
find . -iname "${IMAGE_NAME}*" -not -iname "*.yml" -exec rm {} \;
}
trap clean_up EXIT
# Test code goes here
moby build -name "${IMAGE_NAME}" test.yml
[ -f "${IMAGE_NAME}-kernel" ] || exit 1
[ -f "${IMAGE_NAME}-initrd.img" ] || exit 1
[ -f "${IMAGE_NAME}-cmdline" ]|| exit 1
find . -iname "${IMAGE_NAME}-*" -exec cp {} "${LINUXKIT_TMPDIR}/{}" \;
exit 0

View File

@ -0,0 +1,27 @@
#!/bin/sh
# SUMMARY: Check that the kernel+initrd image boots in qemu
# LABELS:
# AUTHOR: Dave Tucker <dt@docker.com>
# AUTHOR: Rolf Neugebauer <rolf.neugebauer@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=qemu-kernel
clean_up() {
# 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
linuxkit run qemu "${NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@ -6,17 +6,6 @@ init:
- linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
- linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed
onboot:
- name: dhcpcd
image: "linuxkit/dhcpcd:8837289b78ecd80f59524883085424e115dd0b3a"
binds:
- /var:/var
- /tmp/etc:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host

View File

@ -1,24 +0,0 @@
#!/bin/sh
# SUMMARY: Test running an image with qemu
# LABELS:
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test-qemu-build
clean_up() {
# remove any files, containers, images etc
rm -rf "${LINUXKIT_TMPDIR:?}/${IMAGE_NAME:?}*" || true
}
trap clean_up EXIT
# Test code goes here
[ -f "${LINUXKIT_TMPDIR}/${IMAGE_NAME}-kernel" ] || exit 1
linuxkit run qemu "${LINUXKIT_TMPDIR}/${IMAGE_NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@ -1,26 +0,0 @@
#!/bin/sh
# SUMMARY: Test building an ISO image for qemu
# LABELS: build
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test-qemu-build
clean_up() {
# remove any files, containers, images etc
find . -iname "${IMAGE_NAME}*" -not -iname "*.yml" -exec rm {} \;
}
trap clean_up EXIT
# Test code goes here
moby build -name "${IMAGE_NAME}" test.yml
[ -f "${IMAGE_NAME}.iso" ] || exit 1
cp "${IMAGE_NAME}.iso" "${LINUXKIT_TMPDIR}/"
exit 0

View File

@ -0,0 +1,24 @@
#!/bin/sh
# SUMMARY: Check that legacy BIOS ISO boots in qemu
# LABELS:
# AUTHOR: Dave Tucker <dt@docker.com>
# AUTHOR: Rolf Neugebauer <rolf.neugebauer@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=qemu-iso
clean_up() {
rm -rf "${NAME}*" || true
}
trap clean_up EXIT
moby build -name "${NAME}" test.yml
[ -f "${NAME}.iso" ] || exit 1
linuxkit run qemu -iso "${NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@ -6,17 +6,6 @@ init:
- linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
- linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed
onboot:
- name: dhcpcd
image: "linuxkit/dhcpcd:8837289b78ecd80f59524883085424e115dd0b3a"
binds:
- /var:/var
- /tmp/etc:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host

View File

@ -1,24 +0,0 @@
#!/bin/sh
# SUMMARY: Test running an ISO image with qemu
# LABELS:
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test-qemu-build
clean_up() {
# remove any files, containers, images etc
rm -rf "${LINUXKIT_TMPDIR:?}/${IMAGE_NAME:?}*" || true
}
trap clean_up EXIT
# Test code goes here
[ -f "${LINUXKIT_TMPDIR}/${IMAGE_NAME}.iso" ] || exit 1
linuxkit run qemu -iso "${LINUXKIT_TMPDIR}/${IMAGE_NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@ -1,25 +0,0 @@
#!/bin/sh
# SUMMARY: Test building a UEFI image for qemu
# LABELS: build
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test-qemu-build
clean_up() {
# remove any files, containers, images etc
find . -iname "${IMAGE_NAME}*" -not -iname "*.yml" -exec rm {} \;
}
trap clean_up EXIT
# Test code goes here
moby build -name "${IMAGE_NAME}" test.yml
[ -f "${IMAGE_NAME}-efi.iso" ] || exit 1
cp "${IMAGE_NAME}-efi.iso" "${LINUXKIT_TMPDIR}/"
exit 0

View File

@ -1,7 +1,8 @@
#!/bin/sh
# SUMMARY: Test running a UEFI image with qemu
# SUMMARY: Check that legacy BIOS ISO boots in qemu
# LABELS:
# AUTHOR: Dave Tucker <dt@docker.com>
# AUTHOR: Rolf Neugebauer <rolf.neugebauer@docker.com>
set -e
@ -9,11 +10,11 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test-qemu-build
NAME=qemu-efi
clean_up() {
# remove any files, containers, images etc
rm -rf "${LINUXKIT_TMPDIR:?}/${IMAGE_NAME:?}*" || true
rm -rf "${NAME}*" || true
}
trap clean_up EXIT
@ -24,8 +25,7 @@ if command -v qemu; then
fi
fi
# Test code goes here
[ -f "${LINUXKIT_TMPDIR}/${IMAGE_NAME}-efi.iso" ] || exit 1
linuxkit run qemu -uefi "${LINUXKIT_TMPDIR}/${IMAGE_NAME}" | grep -q "Welcome to LinuxKit"
moby build -name "${NAME}" test.yml
[ -f "${NAME}-efi.iso" ] || exit 1
linuxkit run qemu -uefi "${NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@ -6,17 +6,6 @@ init:
- linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
- linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed
onboot:
- name: dhcpcd
image: "linuxkit/dhcpcd:8837289b78ecd80f59524883085424e115dd0b3a"
binds:
- /var:/var
- /tmp/etc:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host

View File

@ -1,27 +0,0 @@
#!/bin/sh
# SUMMARY: Test building an image for GCP
# LABELS: build
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=gcp
clean_up() {
# remove any files, containers, images etc
rm -rf ${IMAGE_NAME}*
}
trap clean_up EXIT
# Test code goes here
moby build -name "${IMAGE_NAME}" test.yml
[ -f "${IMAGE_NAME}.img.tar.gz" ] || exit 1
# As build and run on different machines, copy to the artifacts directory
cp -f "${IMAGE_NAME}.img.tar.gz" "${LINUXKIT_ARTIFACTS_DIR}/test.img.tar.gz"
exit 0

View File

@ -1,24 +0,0 @@
#!/bin/sh
# SUMMARY: Test running an image with qemu
# LABELS: gcp
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=test
clean_up() {
# remove any files, containers, images etc
echo "Nothing to cleanup..."
}
trap clean_up EXIT
# Test code goes here
[ -f "${LINUXKIT_ARTIFACTS_DIR}/${IMAGE_NAME}.img.tar.gz" ] || exit 1
linuxkit run gcp "${LINUXKIT_ARTIFACTS_DIR}/${IMAGE_NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@ -1,27 +0,0 @@
#!/bin/sh
# SUMMARY: Test building an image for packet.net
# LABELS: build
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=packet
clean_up() {
# remove any files, containers, images etc
rm -rf ${IMAGE_NAME}*
}
trap clean_up EXIT
# Test code goes here
moby build --name "${IMAGE_NAME}" test.yml
[ -f "${IMAGE_NAME}-kernel" ] || exit 1
# As build and run on different machines, copy to the artifacts directory
find . -iname "${IMAGE_NAME}-*" -exec cp {} "${LINUXKIT_ARTFACTS_DIR}/{}" \;
exit 0

View File

@ -1,31 +0,0 @@
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: dhcpcd
image: "linuxkit/dhcpcd:8837289b78ecd80f59524883085424e115dd0b3a"
binds:
- /var:/var
- /tmp/etc:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host
command: ["/bin/sh", "/poweroff.sh", "10"]
capabilities:
- CAP_SYS_BOOT
readonly: true
trust:
image:
- linuxkit/kernel
outputs:
- format: kernel+initrd

View File

@ -1,6 +1,6 @@
#!/bin/sh
# SUMMARY: LinuxKit configuration tests
# LABELS:
# SUMMARY: LinuxKit VMware tests
# LABELS: darwin
# For the top level group.sh also specify a 'NAME:' comment
# Source libraries. Uncomment if needed/defined

View File

@ -1,27 +0,0 @@
#!/bin/sh
# SUMMARY: Test building an image for VMware
# LABELS: build
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME=vmware
clean_up() {
# remove any files, containers, images etc
rm -rf ${IMAGE_NAME}*
}
trap clean_up EXIT
# Test code goes here
moby build --name "${IMAGE_NAME}" test.yml
[ -f "${IMAGE_NAME}.vmdk" ] || exit 1
# As build and run on different machines, copy to the artifacts directory
cp "${IMAGE_NAME}.vmdk" "${LINUXKIT_ARTIFACTS_DIR}/"
exit 0

View File

@ -1,31 +0,0 @@
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: dhcpcd
image: "linuxkit/dhcpcd:8837289b78ecd80f59524883085424e115dd0b3a"
binds:
- /var:/var
- /tmp/etc:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host
command: ["/bin/sh", "/poweroff.sh", "10"]
capabilities:
- CAP_SYS_BOOT
readonly: true
trust:
image:
- linuxkit/kernel
outputs:
- format: vmdk

View File

@ -1,5 +1,5 @@
#!/bin/sh
# SUMMARY: LinuxKit stress tests
# SUMMARY: LinuxKit packet.net tests
# LABELS:
# For the top level group.sh also specify a 'NAME:' comment

View File

@ -1,5 +1,5 @@
#!/bin/sh
# SUMMARY: LinuxKit configuration tests
# SUMMARY: LinuxKit Google Cloud tests
# LABELS:
# For the top level group.sh also specify a 'NAME:' comment

View File

@ -1,5 +1,5 @@
#!/bin/sh
# SUMMARY: Test the kernel configuration is suitable for running Docker
# SUMMARY: Sanity check on the kernel config file
# LABELS:
# REPEAT:
# AUTHOR: Dave Tucker <dt@docker.com>

View File

@ -0,0 +1,31 @@
#!/bin/sh
# SUMMARY: Kernel tests
# LABELS:
group_init() {
# Group initialisation code goes here
return 0
}
group_deinit() {
# Group de-initialisation code goes here
return 0
}
CMD=$1
case $CMD in
init)
group_init
res=$?
;;
deinit)
group_deinit
res=$?
;;
*)
res=1
;;
esac
exit $res

View File

@ -1,24 +0,0 @@
#!/bin/sh
# SUMMARY: Run the Linux Testing Project tests
# LABELS: slow, gcp
# REPEAT:
# AUTHOR: Dave Tucker <dt@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
clean_up() {
find . -iname "test-ltp*" -not -iname "*.yml" -exec rm -rf {} \;
}
trap clean_up EXIT
# Test code goes here
moby build test-ltp
linuxkit push test-ltp.img.tar.gz
RESULT="$(linuxkit run gcp -skip-cleanup -machine n1-highcpu-4 test-ltp)"
echo "${RESULT}" | grep -q "suite has passed"
exit 0

View File

@ -1,49 +0,0 @@
kernel:
# Alternatively:
#image: "linuxkit/kernel:4.11.x"
# image: "linuxkit/kernel:4.10.x"
image: "linuxkit/kernel:4.9.x"
# image: "linuxkit/kernel:4.4.x"
cmdline: "console=ttyS0 page_poison=1"
init:
- linuxkit/init:b3740303f3d1e5689a84c87b7dfb48fd2a40a192
- linuxkit/runc:47b1c38d63468c0f3078f8b1b055d07965a1895d
- linuxkit/containerd:cf2614f5a96c569a0bd4bd54e054a65ba17d167f
- linuxkit/ca-certificates:3344cdca1bc59fdfa17bd7f0fcbf491b9dbaa288
onboot:
- name: sysctl
image: "linuxkit/sysctl:1f5ec5d5e6f7a7a1b3d2ff9dd9e36fd6fb14756a"
net: host
pid: host
ipc: host
capabilities:
- CAP_SYS_ADMIN
readonly: true
services:
- name: rngd
image: "linuxkit/rngd:61a07ced77a9747708223ca16a4aec621eacf518"
capabilities:
- CAP_SYS_ADMIN
oomScoreAdj: -800
readonly: true
- name: dhcpcd
image: "linuxkit/dhcpcd:2def74ab3f9233b4c09ebb196ba47c27c08b0ed8"
binds:
- /var:/var
- /tmp:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
oomScoreAdj: -800
- name: virtsock-server
image: "linuxkit/test-virtsock:a7dc8e477d99ea82f56eacd94579ca65985eb0b3"
readonly: true
trust:
image:
- linuxkit/kernel
- linuxkit/rngd
outputs:
- format: kernel+initrd
- format: iso-efi

View File

@ -1,4 +0,0 @@
#!/bin/sh
# LABELS: windows, skip
# FIXME: Write this test!!!

View File

@ -5,7 +5,6 @@
# Temporary directory for tests to use.
LINUXKIT_TMPDIR="${RT_PROJECT_ROOT}/_tmp"
LINUXKIT_ARTIFACTS_DIR="${RT_PROJECT_ROOT}/../../artifacts"
# The top-level group.sh of the project creates a env.sh file
# containing environment variables for tests. Source it if present.

View File

@ -1,7 +1,6 @@
#!/bin/sh
# NAME: linuxkit
# SUMMARY: LinuxKit Regression Tests
# LABELS:
# Source libraries. Uncomment if needed/defined
# . "${RT_LIB}"
@ -11,9 +10,16 @@ group_init() {
# Group initialisation code goes here
[ -r "${LINUXKIT_TMPDIR}" ] && rm -rf "${LINUXKIT_TMPDIR}"
mkdir "${LINUXKIT_TMPDIR}"
[ -r "${LINUXKIT_ARTIFACTS_DIR}" ] && rm -rf "${LINUXKIT_ARTIFACTS_DIR}"
mkdir "${LINUXKIT_ARTIFACTS_DIR}"
echo "export LINUXKIT_EXAMPLES_DIR=${RT_PROJECT_ROOT}/../../examples" >> "${LINUXKIT_TMPDIR}/env.sh"
if rt_label_set "gcp"; then
# If we run GCP tests, make sure it is configured
if [ -z "${CLOUDSDK_CORE_PROJECT}" ]; then
echo "GCP does not seem to be configured"
return 1
fi
fi
return 0
}