aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-12-13 09:12:07 +0100
committerAdrian Villin <avillin@cisco.com>2024-12-13 12:53:10 +0100
commitf5b832e7293c0087bc4800940cecb7efeeeb4f39 (patch)
treea9ed13ac0c39c61ebeef4e665c91c79821712e43 /extras/hs-test
parentea360b570bc9377c218e922e1438610468545a0e (diff)
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>
Diffstat (limited to 'extras/hs-test')
-rw-r--r--extras/hs-test/Makefile13
-rwxr-xr-xextras/hs-test/script/build_hst.sh13
2 files changed, 16 insertions, 10 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index 8d7d6416c8c..ccccf4fb895 100644
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -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:
diff --git a/extras/hs-test/script/build_hst.sh b/extras/hs-test/script/build_hst.sh
index 96a7214d705..523398c3f7a 100755
--- a/extras/hs-test/script/build_hst.sh
+++ b/extras/hs-test/script/build_hst.sh
@@ -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}"