Add makefile targets for basic lint and testing
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
85e264d0b9
commit
a87bc12f86
23
Makefile
23
Makefile
|
@ -1,10 +1,27 @@
|
|||
RUNC_TEST_IMAGE=runc_test
|
||||
PROJECT=github.com/opencontainers/runc
|
||||
TEST_DOCKERFILE=test_Dockerfile
|
||||
export GOPATH:=$(GOPATH):$(CURDIR)/Godeps/_workspace
|
||||
|
||||
all:
|
||||
go get github.com/tools/godep
|
||||
godep go build -o runc .
|
||||
go build -o runc .
|
||||
|
||||
lint:
|
||||
go get golang.org/x/tools/cmd/vet
|
||||
go vet ./...
|
||||
go fmt ./...
|
||||
|
||||
runctestimage:
|
||||
docker build -t $(RUNC_TEST_IMAGE) -f $(TEST_DOCKERFILE) .
|
||||
|
||||
test: runctestimage
|
||||
docker run --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localtest
|
||||
|
||||
localtest:
|
||||
go test -v ./...
|
||||
|
||||
install:
|
||||
cp runc /usr/local/bin/runc
|
||||
rm runc
|
||||
|
||||
clean:
|
||||
rm runc
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
all:
|
||||
docker build -t dockercore/libcontainer .
|
||||
|
||||
test:
|
||||
# we need NET_ADMIN for the netlink tests and SYS_ADMIN for mounting
|
||||
docker run --rm -it --privileged dockercore/libcontainer
|
||||
|
||||
sh:
|
||||
docker run --rm -it --privileged -w /busybox dockercore/libcontainer nsinit exec sh
|
||||
|
||||
GO_PACKAGES = $(shell find . -not \( -wholename ./vendor -prune -o -wholename ./.git -prune \) -name '*.go' -print0 | xargs -0n1 dirname | sort -u)
|
||||
|
||||
direct-test:
|
||||
go test $(TEST_TAGS) -cover -v $(GO_PACKAGES)
|
||||
|
||||
direct-test-short:
|
||||
go test $(TEST_TAGS) -cover -test.short -v $(GO_PACKAGES)
|
||||
|
||||
direct-build:
|
||||
go build -v $(GO_PACKAGES)
|
||||
|
||||
direct-install:
|
||||
go install -v $(GO_PACKAGES)
|
||||
|
||||
local:
|
||||
go test -v
|
||||
|
||||
validate:
|
||||
hack/validate.sh
|
||||
|
||||
binary: all
|
||||
docker run --rm --privileged -v $(CURDIR)/bundles:/go/bin dockercore/libcontainer make direct-install
|
|
@ -0,0 +1,15 @@
|
|||
FROM golang:1.4
|
||||
|
||||
RUN echo "deb http://ftp.us.debian.org/debian testing main contrib" >> /etc/apt/sources.list
|
||||
RUN apt-get update && apt-get install -y iptables criu=1.5.2-1 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# setup a playground for us to spawn containers in
|
||||
RUN mkdir /busybox && \
|
||||
curl -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' | tar -xC /busybox
|
||||
|
||||
RUN curl -sSL https://raw.githubusercontent.com/docker/docker/master/hack/dind -o /dind && \
|
||||
chmod +x /dind
|
||||
|
||||
WORKDIR /go/src/github.com/opencontainers/runc
|
||||
COPY libcontainer/sample_configs/minimal.json /busybox/container.json
|
||||
ENTRYPOINT ["/dind"]
|
Loading…
Reference in New Issue