hs-test: always build when running 'make build'
- running 'make build' will now always build docker images, 'make test' will try to skip building them unless FORCE_BUILD=true - now also checking ubuntu version Type: make Change-Id: Ie16e8dc4712963de19e2450e058b867c1cede7ee Signed-off-by: Adrian Villin <avillin@cisco.com>
This commit is contained in:
parent
ea360b570b
commit
f5b832e729
@ -57,6 +57,8 @@ ifeq ($(ARCH),)
|
||||
ARCH=$(shell dpkg --print-architecture)
|
||||
endif
|
||||
|
||||
FORCE_BUILD?=true
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Make targets:"
|
||||
@ -74,6 +76,7 @@ help:
|
||||
@echo
|
||||
@echo "'make build' and 'make test' arguments:"
|
||||
@echo " UBUNTU_VERSION - ubuntu version for docker image"
|
||||
@echo " FORCE_BUILD=[true|false] - force docker image building"
|
||||
@echo
|
||||
@echo "'make test' specific arguments:"
|
||||
@echo " PERSIST=[true|false] - whether clean up topology and dockers after test"
|
||||
@ -115,6 +118,7 @@ build-vpp-gcov:
|
||||
@touch .build.ok
|
||||
|
||||
.PHONY: test
|
||||
test: FORCE_BUILD=false
|
||||
test: .deps.ok .build.ok
|
||||
@bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
|
||||
@ -122,8 +126,8 @@ test: .deps.ok .build.ok
|
||||
--dryrun=$(DRYRUN); \
|
||||
./script/compress.sh $$?
|
||||
|
||||
|
||||
.PHONY: test-debug
|
||||
test-debug: FORCE_BUILD=false
|
||||
test-debug: .deps.ok .build_debug.ok
|
||||
@bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
|
||||
@ -132,6 +136,7 @@ test-debug: .deps.ok .build_debug.ok
|
||||
./script/compress.sh $$?
|
||||
|
||||
.PHONY: test-cov
|
||||
test-leak: FORCE_BUILD=false
|
||||
test-cov: .deps.ok .build.cov.ok
|
||||
@bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \
|
||||
@ -149,19 +154,19 @@ build-go:
|
||||
.PHONY: build
|
||||
build: .deps.ok build-vpp-release build-go
|
||||
@rm -f .build.ok
|
||||
bash ./script/build_hst.sh release
|
||||
bash ./script/build_hst.sh release $(FORCE_BUILD)
|
||||
@touch .build.ok
|
||||
|
||||
.PHONY: build-cov
|
||||
build-cov: .deps.ok build-vpp-gcov build-go
|
||||
@rm -f .build.cov.ok
|
||||
bash ./script/build_hst.sh gcov
|
||||
bash ./script/build_hst.sh gcov $(FORCE_BUILD)
|
||||
@touch .build.cov.ok
|
||||
|
||||
.PHONY: build-debug
|
||||
build-debug: .deps.ok build-vpp-debug build-go
|
||||
@rm -f .build.ok
|
||||
bash ./script/build_hst.sh debug
|
||||
bash ./script/build_hst.sh debug $(FORCE_BUILD)
|
||||
@touch .build.ok
|
||||
|
||||
.deps.ok:
|
||||
|
@ -5,10 +5,14 @@ if [ "$(lsb_release -is)" != Ubuntu ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export UBUNTU_VERSION=${UBUNTU_VERSION:-"$(lsb_release -rs)"}
|
||||
echo "Ubuntu version is set to ${UBUNTU_VERSION}"
|
||||
|
||||
LAST_STATE_FILE=".last_state_hash"
|
||||
|
||||
# get current state hash
|
||||
# get current state hash and ubuntu version
|
||||
current_state_hash=$(git status --porcelain | grep -vE '(/\.|/10|\.go$|\.sum$|\.mod$|\.txt$|\.test$)' | sha1sum | awk '{print $1}')
|
||||
current_state_hash=$current_state_hash$UBUNTU_VERSION
|
||||
|
||||
if [ -f "$LAST_STATE_FILE" ]; then
|
||||
last_state_hash=$(cat "$LAST_STATE_FILE")
|
||||
@ -16,8 +20,8 @@ else
|
||||
last_state_hash=""
|
||||
fi
|
||||
|
||||
# compare current state with last state
|
||||
if [ "$current_state_hash" = "$last_state_hash" ]; then
|
||||
# compare current state with last state and check FORCE_BUILD
|
||||
if [ "$current_state_hash" = "$last_state_hash" ] && [ "$2" = "false" ]; then
|
||||
echo "*** Skipping docker build - no new changes \
|
||||
(excluding .go, .txt, .sum, .mod, dotfiles, IP address files) ***"
|
||||
exit 0
|
||||
@ -48,9 +52,6 @@ else
|
||||
fi
|
||||
echo "Taking build objects from ${VPP_BUILD_ROOT}"
|
||||
|
||||
export UBUNTU_VERSION=${UBUNTU_VERSION:-"$(lsb_release -rs)"}
|
||||
echo "Ubuntu version is set to ${UBUNTU_VERSION}"
|
||||
|
||||
export HST_LDPRELOAD=${VPP_BUILD_ROOT}/lib/${OS_ARCH}-linux-gnu/libvcl_ldpreload.so
|
||||
echo "HST_LDPRELOAD is set to ${HST_LDPRELOAD}"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user