mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Merge pull request #1655 from dave-tucker/test-cleanup
Clean up the tests
This commit is contained in:
commit
f3157af1db
66
Makefile
66
Makefile
@ -31,62 +31,15 @@ bin/linuxkit: $(LINUXKIT_DEPS) | bin
|
|||||||
rm tmp_linuxkit_bin.tar
|
rm tmp_linuxkit_bin.tar
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
test-initrd.img: $(MOBY) test/test.yml
|
|
||||||
$(MOBY) build --pull test/test.yml
|
|
||||||
|
|
||||||
test-bzImage: test-initrd.img
|
|
||||||
|
|
||||||
.PHONY: test-qemu-efi
|
|
||||||
test-qemu-efi: $(LINUXKIT) test-efi.iso
|
|
||||||
$(LINUXKIT) run qemu test | tee test-efi.log
|
|
||||||
$(call check_test_log, test-efi.log)
|
|
||||||
|
|
||||||
bin:
|
bin:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cp -R ./bin/* $(PREFIX)/bin
|
cp -R ./bin/* $(PREFIX)/bin
|
||||||
|
|
||||||
define check_test_log
|
|
||||||
@cat $1 |grep -q 'test suite PASSED'
|
|
||||||
endef
|
|
||||||
|
|
||||||
.PHONY: test-hyperkit
|
|
||||||
test-hyperkit: $(LINUXKIT) test-initrd.img test-bzImage test-cmdline
|
|
||||||
rm -f disk.img
|
|
||||||
$(LINUXKIT) run hyperkit test | tee test.log
|
|
||||||
$(call check_test_log, test.log)
|
|
||||||
|
|
||||||
.PHONY: test-gcp
|
|
||||||
test-gcp: export CLOUDSDK_IMAGE_NAME?=test
|
|
||||||
test-gcp: $(LINUXKIT) test.img.tar.gz
|
|
||||||
$(LINUXKIT) push gcp test.img.tar.gz
|
|
||||||
$(LINUXKIT) run gcp $(CLOUDSDK_IMAGE_NAME) | tee test-gcp.log
|
|
||||||
$(call check_test_log, test-gcp.log)
|
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: $(LINUXKIT) test-initrd.img test-bzImage test-cmdline
|
test:
|
||||||
$(LINUXKIT) run test | tee test.log
|
$(MAKE) -C test
|
||||||
$(call check_test_log, test.log)
|
|
||||||
|
|
||||||
test-ltp.img.tar.gz: $(MOBY) test/ltp/test-ltp.yml
|
|
||||||
$(MOBY) build --pull test/ltp/test-ltp.yml
|
|
||||||
|
|
||||||
.PHONY: test-ltp
|
|
||||||
test-ltp: export CLOUDSDK_IMAGE_NAME?=test-ltp
|
|
||||||
test-ltp: $(LINUXKIT) artifacts/test-ltp.img.tar.gz
|
|
||||||
$(LINUXKIT) push gcp artifacts/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)
|
|
||||||
|
|
||||||
artifacts:
|
|
||||||
mkdir -p $@
|
|
||||||
|
|
||||||
artifacts/test.img.tar.gz: test.img.tar.gz | artifacts
|
|
||||||
cp test.img.tar.gz artifacts/
|
|
||||||
|
|
||||||
artifacts/test-ltp.img.tar.gz: test-ltp.img.tar.gz | artifacts
|
|
||||||
cp test-ltp.img.tar.gz artifacts/
|
|
||||||
|
|
||||||
.PHONY: collect-artifacts
|
.PHONY: collect-artifacts
|
||||||
collect-artifacts: artifacts/test.img.tar.gz artifacts/test-ltp.img.tar.gz
|
collect-artifacts: artifacts/test.img.tar.gz artifacts/test-ltp.img.tar.gz
|
||||||
@ -95,23 +48,22 @@ collect-artifacts: artifacts/test.img.tar.gz artifacts/test-ltp.img.tar.gz
|
|||||||
ci:
|
ci:
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
$(MAKE)
|
$(MAKE)
|
||||||
$(MAKE) test
|
$(MAKE) install
|
||||||
$(MAKE) collect-artifacts
|
$(MAKE) -C test all
|
||||||
$(MAKE) test-ltp
|
|
||||||
|
|
||||||
ci-tag:
|
ci-tag:
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
$(MAKE)
|
$(MAKE)
|
||||||
$(MAKE) test
|
$(MAKE) install
|
||||||
$(MAKE) collect-artifacts
|
$(MAKE) -C test all
|
||||||
$(MAKE) test-ltp
|
|
||||||
|
|
||||||
ci-pr:
|
ci-pr:
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
$(MAKE)
|
$(MAKE)
|
||||||
$(MAKE) test
|
$(MAKE) install
|
||||||
$(MAKE) artifacts/test.img.tar.gz
|
$(MAKE) -C test pr
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf bin *.log *-kernel *-cmdline *.img *.iso *.tar.gz *.qcow2 *.vhd *.vmx *.vmdk
|
rm -rf bin *.log *-kernel *-cmdline *.img *.iso *.tar.gz *.qcow2 *.vhd *.vmx *.vmdk
|
||||||
|
$(MAKE) -C test clean
|
||||||
|
68
test/Makefile
Normal file
68
test/Makefile
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
.PHONY: default pr all
|
||||||
|
|
||||||
|
default: check-deps kernel-config
|
||||||
|
pr: check-deps kernel-config ../artifacts/test.img.tar.gz
|
||||||
|
all: check-deps kernel-config ltp ../artifacts/test.img.tar.gz ../artifacts/test-ltp.img.tar.gz
|
||||||
|
|
||||||
|
MOBY:=$(shell command -v moby 2> /dev/null)
|
||||||
|
LINUXKIT:=$(shell command -v linuxkit 2> /dev/null)
|
||||||
|
|
||||||
|
.PHONY: check-deps
|
||||||
|
check-deps:
|
||||||
|
ifndef MOBY
|
||||||
|
$(error "moby is not available. please install it.")
|
||||||
|
endif
|
||||||
|
ifndef LINUXKIT
|
||||||
|
$(error "linuxkit binary not found. please install it.")
|
||||||
|
endif
|
||||||
|
|
||||||
|
define check_test_log
|
||||||
|
@cat $1 |grep -q 'test suite PASSED'
|
||||||
|
endef
|
||||||
|
|
||||||
|
../artifacts:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
test-kernel-config-initrd.img: $(MOBY) cases/test-kernel-config.yml
|
||||||
|
$(MOBY) build --pull cases/test-kernel-config.yml
|
||||||
|
|
||||||
|
# uses qemu
|
||||||
|
.PHONY: kernel-config
|
||||||
|
kernel-config: $(LINUXKIT) test-kernel-config-initrd.img test-kernel-config-kernel test-kernel-config-cmdline
|
||||||
|
$(LINUXKIT) run qemu test-kernel-config 2>&1 | tee test.log
|
||||||
|
$(call check_test_log, test.log)
|
||||||
|
|
||||||
|
# qemu only at this time
|
||||||
|
.PHONY: qemu-efi
|
||||||
|
efi: $(LINUXKIT) test-kernel-config-efi.iso
|
||||||
|
$(LINUXKIT) run qemu -uefi test-kernel-config | tee test-efi.log
|
||||||
|
$(call check_test_log, test-efi.log)
|
||||||
|
|
||||||
|
# For GCP tests
|
||||||
|
../artifacts/test.img.tar.gz: test-kernel-config.img.tar.gz | ../artifacts
|
||||||
|
mv test-kernel-config.img.tar.gz ../artifacts/test.img.tar.gz
|
||||||
|
|
||||||
|
.PHONY: gcp
|
||||||
|
gcp: export CLOUDSDK_IMAGE_NAME?=test-kernel-config
|
||||||
|
gcp: $(LINUXKIT) ../test.img.tar.gz
|
||||||
|
$(LINUXKIT) push gcp ../artifacts/test.img.tar.gz
|
||||||
|
$(LINUXKIT) run gcp $(CLOUDSDK_IMAGE_NAME) | tee test-gcp.log
|
||||||
|
$(call check_test_log, test-gcp.log)
|
||||||
|
|
||||||
|
# For LTP tests
|
||||||
|
test-ltp.img.tar.gz: $(MOBY) cases/test-ltp.yml
|
||||||
|
$(MOBY) build --pull cases/test-ltp.yml
|
||||||
|
|
||||||
|
../artifacts/test-ltp.img.tar.gz: test-ltp.img.tar.gz | ../artifacts
|
||||||
|
mv test-ltp.img.tar.gz ../artifacts
|
||||||
|
|
||||||
|
.PHONY: ltp
|
||||||
|
ltp: export CLOUDSDK_IMAGE_NAME?=test-ltp
|
||||||
|
ltp: $(LINUXKIT) test-ltp.img.tar.gz
|
||||||
|
$(LINUXKIT) push gcp ../artifacts/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)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf bin *.log *-kernel *-cmdline *.img *.iso *.tar.gz *.qcow2 *.vhd *.vmx *.vmdk
|
@ -18,9 +18,14 @@ onboot:
|
|||||||
- CAP_NET_RAW
|
- CAP_NET_RAW
|
||||||
net: host
|
net: host
|
||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
- name: check
|
- name: check-kernel-config
|
||||||
image: "linuxkit/check:43c4147dda4e02d066ef158cd81718dbff8c8bd0"
|
image: "linuxkit/test-kernel-config:ecff41279ccbc408079a3996a956432651c6eb9c"
|
||||||
|
readonly: true
|
||||||
|
services:
|
||||||
|
- name: poweroff
|
||||||
|
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
|
||||||
pid: host
|
pid: host
|
||||||
|
command: ["/bin/sh", "/poweroff.sh", "3"]
|
||||||
capabilities:
|
capabilities:
|
||||||
- CAP_SYS_BOOT
|
- CAP_SYS_BOOT
|
||||||
readonly: true
|
readonly: true
|
@ -1,7 +1,7 @@
|
|||||||
.PHONY: tag push
|
.PHONY: tag push
|
||||||
|
|
||||||
BASE=alpine:3.5
|
BASE=alpine:3.5
|
||||||
IMAGE=check
|
IMAGE=test-kernel-config
|
||||||
|
|
||||||
default: push
|
default: push
|
||||||
|
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
function failed {
|
function failed {
|
||||||
printf "Kernel config test suite FAILED\n"
|
printf "Kernel config test suite FAILED\n"
|
||||||
/sbin/poweroff -f
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/check-kernel-config.sh || failed
|
/check-kernel-config.sh || failed
|
||||||
@ -11,5 +10,3 @@ bash /check-config.sh || failed
|
|||||||
printf "Kernel config test suite PASSED\n"
|
printf "Kernel config test suite PASSED\n"
|
||||||
|
|
||||||
cat /etc/linuxkit
|
cat /etc/linuxkit
|
||||||
|
|
||||||
/sbin/poweroff -f
|
|
@ -1,11 +1,11 @@
|
|||||||
This directory contains the files to build and run a container containing the
|
This directory contains the files to build and run a container containing the
|
||||||
virtio and Hyper-V socket stress tests. `test-virtsock-server.yml` builds images which start the server inside the VM.
|
virtio and Hyper-V socket stress tests. `../../cases/test-virtsock-server.yml` builds images which start the server inside the VM.
|
||||||
|
|
||||||
The client, to be run on the host as per this [README](https://github.com/rneugeba/virtsock/blob/master/examples/README.md), can be obtained compiled from [here](https://github.com/rneugeba/virtsock).
|
The client, to be run on the host as per this [README](https://github.com/rneugeba/virtsock/blob/master/examples/README.md), can be obtained compiled from [here](https://github.com/rneugeba/virtsock).
|
||||||
|
|
||||||
## How to use (on Windows)
|
## How to use (on Windows)
|
||||||
|
|
||||||
- Build the images: `moby build test-virtsock-server`
|
- Build the images: `moby build tests/cases/test-virtsock-server.yml`
|
||||||
- Copy the `test-virtsock-server.iso` to a Windows system
|
- Copy the `test-virtsock-server.iso` to a Windows system
|
||||||
- Create a Type 1 Hyper-V VM (called `virtsock`).
|
- Create a Type 1 Hyper-V VM (called `virtsock`).
|
||||||
- No Disk or network required
|
- No Disk or network required
|
Loading…
Reference in New Issue
Block a user