Skip to content

Commit

Permalink
Add Makefile to run unit tests locally
Browse files Browse the repository at this point in the history
Use a container to isolate from other ovsdb instances

Signed-off-by: Adrian Moreno <[email protected]>
  • Loading branch information
amorenoz committed Jan 14, 2021
1 parent 982cf4e commit c3834eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from golang:1.12

RUN apt-get update && apt-get install --no-install-recommends -y \
bc \
gcc-multilib \
libssl-dev \
llvm-dev \
libjemalloc-dev \
libnuma-dev \
python-sphinx \
libelf-dev \
selinux-policy-dev \
libunbound-dev \
autoconf \
automake \
libtool

ADD .travis /src/travis
WORKDIR /src/travis

ENV OVN_SRCDIR=/src/
RUN sh ./test_prepare.sh
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
.PHONY: clean build-image
.PHONY: clean check_prep check

# clean: clean up all build artifacts.
# build-image: build docker image for selected projects.
DOCKER ?= $(shell which docker)
IMAGE_NAME="goovn:test"

# Remove all build artifacts.
#
# Example:
# make clean
.PHONY=check
check: check_prep
$(DOCKER) run -e "OVN_SRCDIR=/src/" -v $$PWD:/root/workspace -w /root/workspace -it $(IMAGE_NAME) .travis/test_run.sh

.PHONY=check_prep
check_prep:
@$(DOCKER) inspect $(IMAGE_NAME) 2>&1 >/dev/null || \
$(DOCKER) build -t $(IMAGE_NAME) . ;

.PHONY=clean
clean:
build/clean.sh
@docker rmi -f $(IMAGE_NAME)

0 comments on commit c3834eb

Please sign in to comment.