From 857f53cdff9dde76679833b0632fd3dfcdc6e0e5 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Wed, 25 May 2022 08:09:15 -1000 Subject: [PATCH 1/2] test pkg/dummy Signed-off-by: Avi Deitcher --- pkg/dummy/Dockerfile | 9 +++++++++ pkg/dummy/build.yml | 1 + pkg/dummy/infile | 1 + test/cases/040_packages/001_dummy/test.sh | 23 ++++++++++++++++++++++ test/cases/040_packages/001_dummy/test.yml | 12 +++++++++++ 5 files changed, 46 insertions(+) create mode 100644 pkg/dummy/Dockerfile create mode 100644 pkg/dummy/build.yml create mode 100644 pkg/dummy/infile create mode 100644 test/cases/040_packages/001_dummy/test.sh create mode 100644 test/cases/040_packages/001_dummy/test.yml diff --git a/pkg/dummy/Dockerfile b/pkg/dummy/Dockerfile new file mode 100644 index 000000000..9d790b65d --- /dev/null +++ b/pkg/dummy/Dockerfile @@ -0,0 +1,9 @@ +FROM linuxkit/alpine:5d89cd05a567f9bfbe4502be1027a422d46f4a75 AS build +RUN apk add --no-cache --initdb make + +FROM scratch +ENTRYPOINT [] +CMD [] +WORKDIR / +COPY --from=build /usr/bin/make /usr/bin/ +COPY infile infile diff --git a/pkg/dummy/build.yml b/pkg/dummy/build.yml new file mode 100644 index 000000000..33e76aa3a --- /dev/null +++ b/pkg/dummy/build.yml @@ -0,0 +1 @@ +image: dummy diff --git a/pkg/dummy/infile b/pkg/dummy/infile new file mode 100644 index 000000000..3a8c3291d --- /dev/null +++ b/pkg/dummy/infile @@ -0,0 +1 @@ +This is a silly input file for testing. \ No newline at end of file diff --git a/test/cases/040_packages/001_dummy/test.sh b/test/cases/040_packages/001_dummy/test.sh new file mode 100644 index 000000000..5396f9475 --- /dev/null +++ b/test/cases/040_packages/001_dummy/test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# SUMMARY: Check that the dummy pkg exists +# LABELS: +# REPEAT: + +set -e + +# Source libraries. Uncomment if needed/defined +#. "${RT_LIB}" +. "${RT_PROJECT_ROOT}/_lib/lib.sh" +NAME=dummy + +clean_up() { + rm -rf ${NAME}-* +} +trap clean_up EXIT + +# Test code goes here +linuxkit build -format kernel+initrd -name "${NAME}" test.yml +# all we are checking is that we can build using the dummy package, which +# was not pushed out + +exit 0 diff --git a/test/cases/040_packages/001_dummy/test.yml b/test/cases/040_packages/001_dummy/test.yml new file mode 100644 index 000000000..1c3c23dbb --- /dev/null +++ b/test/cases/040_packages/001_dummy/test.yml @@ -0,0 +1,12 @@ +kernel: + image: linuxkit/kernel:5.10.104 + cmdline: "console=ttyS0 console=ttyAMA0" +init: + - linuxkit/init:8f1e6a0747acbbb4d7e24dc98f97faa8d1c6cec7 + - linuxkit/runc:f01b88c7033180d50ae43562d72707c6881904e4 +onboot: + - name: dummy + image: linuxkit/dummy:611bf5a6f37a3f508c3b8c7be5fb57fd70132c3e + - name: poweroff + image: linuxkit/poweroff:39d99e5909b6f8faccedc78d6d2646cdb6c9ed9c + command: ["/bin/sh", "/poweroff.sh", "10"] From 58486bbe88d23d1e6e5df3d8cf4afafb173d1e7e Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Tue, 7 Jun 2022 18:53:42 +0300 Subject: [PATCH 2/2] remove silent from Makefile so we can see what command it is doing; sort dirs for consistency Signed-off-by: Avi Deitcher --- pkg/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/Makefile b/pkg/Makefile index 93a59c0c4..efcb0fbf0 100644 --- a/pkg/Makefile +++ b/pkg/Makefile @@ -1,4 +1,4 @@ -DIRS = $(dir $(shell find . -maxdepth 2 -mindepth 2 -type f -name build.yml)) +DIRS = $(dir $(shell find . -maxdepth 2 -mindepth 2 -type f -name build.yml | sort)) .PHONY: push force-push build forcebuild show-tag clean OPTIONS ?= @@ -10,18 +10,18 @@ PUSHOPTIONS += -release $(LK_RELEASE) endif push: - @linuxkit pkg push $(OPTIONS) $(PUSHOPTIONS) $(DIRS) + linuxkit pkg push $(OPTIONS) $(PUSHOPTIONS) $(DIRS) forcepush: - @linuxkit pkg push $(OPTIONS) $(PUSHOPTIONS) --force $(DIRS) + linuxkit pkg push $(OPTIONS) $(PUSHOPTIONS) --force $(DIRS) build: - @linuxkit pkg build $(OPTIONS) $(DIRS) + linuxkit pkg build $(OPTIONS) $(DIRS) forcebuild: - @linuxkit pkg build $(OPTIONS) --force $(DIRS) + linuxkit pkg build $(OPTIONS) --force $(DIRS) show-tag: - @linuxkit pkg show-tag $(OPTIONS) $(DIRS) + linuxkit pkg show-tag $(OPTIONS) $(DIRS) clean: