mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
tools: Add initial Linux Test Project container
LTP is compiled in on debian container and the binaries then copied into another container, which is pushed to hub. LTP does not compile on Alpine as it uses glibc specific pthread extensions. I tried to link LTP statically to not require a glibc based base image but that failed too. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
d6e9a1c2b7
commit
7362202478
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
|
Loading…
Reference in New Issue
Block a user