mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Merge pull request #1282 from rneugeba/ltp
Add initial support for a Linux Test Project container
This commit is contained in:
commit
1b31c5582d
2
tools/test-ltp/.gitignore
vendored
Normal file
2
tools/test-ltp/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/hash
|
||||
/opt
|
19
tools/test-ltp/Dockerfile.build
Normal file
19
tools/test-ltp/Dockerfile.build
Normal file
@ -0,0 +1,19 @@
|
||||
FROM debian:jessie
|
||||
|
||||
ARG LTP_VERSION
|
||||
|
||||
ENV LTP_SOURCE=https://github.com/linux-test-project/ltp/releases/download/${LTP_VERSION}/ltp-full-${LTP_VERSION}.tar.xz
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl xz-utils make gcc flex bison automake autoconf
|
||||
|
||||
RUN curl -fsSL -o ltp-full-${LTP_VERSION}.tar.xz ${LTP_SOURCE}
|
||||
|
||||
RUN cat ltp-full-${LTP_VERSION}.tar.xz | tar --absolute-names -xJ && mv /ltp-full-${LTP_VERSION} /ltp
|
||||
|
||||
RUN cd /ltp \
|
||||
&& make autotools \
|
||||
&& ./configure \
|
||||
&& make -j "$(getconf _NPROCESSORS_ONLN)" all \
|
||||
&& make install
|
4
tools/test-ltp/Dockerfile.pkg
Normal file
4
tools/test-ltp/Dockerfile.pkg
Normal file
@ -0,0 +1,4 @@
|
||||
FROM debian:jessie-slim@sha256:2a14128195ab26b1c56c5773dda9def9b909c2e01596ef9108e2295d418210a3
|
||||
ADD . /
|
||||
WORKDIR /opt/ltp
|
||||
ENTRYPOINT ["./runltplite.sh"]
|
42
tools/test-ltp/Makefile
Normal file
42
tools/test-ltp/Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
LTP_VERSION=20170116
|
||||
|
||||
all: ltp.tar push
|
||||
|
||||
# Build LTP and get the result as a tarball
|
||||
DEPS=Dockerfile.build Makefile
|
||||
ltp.tag: $(DEPS)
|
||||
BUILD=$$(docker build -f $< -q . --build-arg LTP_VERSION=$(LTP_VERSION)) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && echo "$$BUILD" > $@
|
||||
|
||||
ltp.tar: ltp.tag
|
||||
docker run --rm --net=none --log-driver=none $(shell cat ltp.tag) tar cf - opt/ltp > $@
|
||||
|
||||
SHASUM=alpine:3.5
|
||||
IMAGE=test-ltp-$(LTP_VERSION)
|
||||
|
||||
# Note: We do not compute the hash from all the dependencies here
|
||||
# because the ltp binaries will change everytime we build. Ideally, we
|
||||
# would calculate the hash from the source and the apt-get cache, but
|
||||
# it's not that critical.
|
||||
hash: Dockerfile.pkg ltp.tar $(DEPS)
|
||||
tar xf ltp.tar
|
||||
tar cf - Dockerfile.pkg opt | docker build --no-cache -t $(IMAGE):build -f Dockerfile.pkg -
|
||||
cat Dockerfile.pkg $(DEPS) | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@
|
||||
|
||||
push: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
|
||||
docker push mobylinux/$(IMAGE):$(shell cat hash))
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
tag: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
|
||||
docker rmi $(IMAGE):build
|
||||
rm -f hash
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf opt ltp.tar ltp.tag hash
|
||||
|
||||
.DELETE_ON_ERROR:
|
1
tools/test-ltp/README.md
Normal file
1
tools/test-ltp/README.md
Normal file
@ -0,0 +1 @@
|
||||
This directory creates a container which runs the Linux Test Project test code
|
17
tools/test-ltp/test-ltp.yaml
Normal file
17
tools/test-ltp/test-ltp.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
kernel:
|
||||
image: "mobylinux/kernel-4.9.x-moby:c752c32911815b1cbdd580f10553767e934dc0fa"
|
||||
cmdline: "console=ttyS0"
|
||||
init: "mobylinux/init:2f1b5c1be1157cb17e5b1e6dee171dccdebb5277"
|
||||
system:
|
||||
- name: ltp
|
||||
image: "mobylinux/test-ltp-20170116:fdca2d1bb019b1d51e722e6032c82c7933d4b870"
|
||||
network_mode: host
|
||||
pid: host
|
||||
capabilities:
|
||||
- CAP_SYS_ADMIN
|
||||
files:
|
||||
outputs:
|
||||
- format: kernel+initrd
|
||||
- format: iso-bios
|
||||
# The initrd is too large for a pre-allocated EFI ISO
|
||||
# - format: iso-efi
|
Loading…
Reference in New Issue
Block a user