tests: cleanup test directory

- add a `pkg` directory for packages
- add a `cases` directory for yml files

Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Dave Tucker
2017-04-12 11:20:11 +01:00
parent edb909567c
commit 05767273f3
25 changed files with 5 additions and 5 deletions

2
test/pkg/ltp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/hash
/opt

View 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

View File

@@ -0,0 +1,4 @@
FROM debian:jessie-slim@sha256:fb22c1cef74071a6cd0145c1f91ca85ba9bd3f8b4d6db8560fe69eb36a175ca3
ADD . /
WORKDIR /opt/ltp
ENTRYPOINT ["/bin/sh", "/check.sh"]

42
test/pkg/ltp/Makefile Normal file
View 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 check.sh $(DEPS)
tar xf ltp.tar
tar cf - Dockerfile.pkg opt check.sh | docker build --no-cache -t $(IMAGE):build -f Dockerfile.pkg -
cat Dockerfile.pkg check.sh $(DEPS) | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@
push: hash
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \
docker push linuxkit/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build linuxkit/$(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
test/pkg/ltp/README.md Normal file
View File

@@ -0,0 +1 @@
This directory creates a container which runs the Linux Test Project test code

15
test/pkg/ltp/check.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
sh runltplite.sh -p -l /ltp.log
cat /ltp.log
baseline="$(cat /etc/ltp/baseline)"
failures="$( grep "Total Failures" /ltp.log | awk '{print $3}')"
if [ $((failures <= baseline)) -ne 0 ]
then
printf "LTP test suite PASSED\n"
else
printf "LTP test suite FAILED\n"
exit 1
fi