Skip to content

Commit 4ad7bbc

Browse files
committed
Merge pull request #783 from cyphar/test-all-the-things
Use full test suite on make test
2 parents ec77200 + dd4a897 commit 4ad7bbc

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

Makefile

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
.PHONY: dbuild man
1+
.PHONY: dbuild man \
2+
localtest localunittest localintegration \
3+
test unittest integration
24

35
RUNC_IMAGE := runc_dev
46
RUNC_TEST_IMAGE := runc_test
@@ -25,6 +27,12 @@ static: $(RUNC_LINK)
2527
$(RUNC_LINK):
2628
ln -sfn $(CURDIR) $(RUNC_LINK)
2729

30+
dbuild: runctestimage
31+
docker build -t $(RUNC_IMAGE) .
32+
docker create --name=$(RUNC_INSTANCE) $(RUNC_IMAGE)
33+
docker cp $(RUNC_INSTANCE):$(RUNC_BUILD_PATH) .
34+
docker rm $(RUNC_INSTANCE)
35+
2836
lint:
2937
go vet ./...
3038
go fmt ./...
@@ -35,24 +43,24 @@ man:
3543
runctestimage:
3644
docker build -t $(RUNC_TEST_IMAGE) -f $(TEST_DOCKERFILE) .
3745

38-
test: runctestimage
39-
docker run -e TESTFLAGS -ti --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localtest
46+
test:
47+
make unittest integration
4048

41-
localtest: all
42-
go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v ./...
49+
localtest:
50+
make localunittest localintegration
4351

44-
dbuild: runctestimage
45-
docker build -t $(RUNC_IMAGE) .
46-
docker create --name=$(RUNC_INSTANCE) $(RUNC_IMAGE)
47-
docker cp $(RUNC_INSTANCE):$(RUNC_BUILD_PATH) .
48-
docker rm $(RUNC_INSTANCE)
52+
unittest: runctestimage
53+
docker run -e TESTFLAGS -ti --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localunittest
54+
55+
localunittest: all
56+
go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v ./...
4957

5058
integration: runctestimage
5159
docker run -e TESTFLAGS -t --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localintegration
5260

53-
localintegration:
54-
bats tests/integration${TESTFLAGS}
55-
61+
localintegration: all
62+
bats -t tests/integration${TESTFLAGS}
63+
5664
install:
5765
install -D -m0755 runc /usr/local/sbin/runc
5866

script/test_Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y \
1818
python-minimal \
1919
--no-install-recommends
2020

21-
# install bats
21+
# install bats
2222
RUN cd /tmp \
2323
&& git clone https://github.com/sstephenson/bats.git \
2424
&& cd bats \
@@ -33,10 +33,9 @@ RUN mkdir -p /usr/src/criu \
3333
&& make install-criu
3434

3535
# setup a playground for us to spawn containers in
36-
RUN mkdir /busybox \
37-
&& mkdir /testdata \
38-
&& curl -o /testdata/busybox.tar -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' \
39-
&& tar -C /busybox -xf /testdata/busybox.tar
36+
ENV ROOTFS /busybox
37+
RUN mkdir -p ${ROOTFS} \
38+
&& curl -o- -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' | tar -C ${ROOTFS} -xf -
4039

4140
COPY script/tmpmount /
4241
WORKDIR /go/src/github.com/opencontainers/runc

0 commit comments

Comments
 (0)