summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2024-12-21 17:04:16 +0100
committerFlorin Coras <florin.coras@gmail.com>2024-12-21 22:35:06 +0000
commitb91f595f7a082e9ecd16aa14de87b0d7990b33a8 (patch)
tree7470f856406a178772f779e6e4b43f81d0557cd9
parent75b66fd129d6c5f07bef74e2fde321764cc33ed3 (diff)
hs-test: rebuild images when switching build type
Rebuild hst docker images when the previous test run had different vpp build type, e.g. 1) make test 2) make tes-debug Type: test Change-Id: If3a6f11f4f50bbfa88ef3808f98dcba3ab61d348 Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rw-r--r--extras/hs-test/README.rst4
-rwxr-xr-xextras/hs-test/script/build_hst.sh5
2 files changed, 5 insertions, 4 deletions
diff --git a/extras/hs-test/README.rst b/extras/hs-test/README.rst
index 4b6fbd3de8f..8deebe39832 100644
--- a/extras/hs-test/README.rst
+++ b/extras/hs-test/README.rst
@@ -20,9 +20,9 @@ Anatomy of a test case
**Prerequisites**:
* Install hs-test dependencies with ``make install-deps``
-* Tests use *hs-test*'s own docker image, so building it before starting tests is a prerequisite. Run ``make build[-debug]`` to do so
-* Docker has to be installed and Go has to be in path of both the running user and root
+* `Install Go <https://go.dev/doc/install>`_, it has to be in path of both the running user (follow instructions on Go installation page) and root (run ``sudo visudo`` and edit ``secure_path`` line, run ``sudo go version`` to verify)
* Root privileges are required to run tests as it uses Linux ``ip`` command for configuring topology
+* Tests use *hs-test*'s own docker image, they are rebuild automatically when needed, you can run ``make build[-debug]`` to do so or use ``FORCE_BUILD=true`` make parameter
**Action flow when running a test case**:
diff --git a/extras/hs-test/script/build_hst.sh b/extras/hs-test/script/build_hst.sh
index 523398c3f7a..04983b08da7 100755
--- a/extras/hs-test/script/build_hst.sh
+++ b/extras/hs-test/script/build_hst.sh
@@ -12,7 +12,7 @@ LAST_STATE_FILE=".last_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
+current_state_hash=$current_state_hash$UBUNTU_VERSION$1
if [ -f "$LAST_STATE_FILE" ]; then
last_state_hash=$(cat "$LAST_STATE_FILE")
@@ -64,11 +64,12 @@ mkdir -p ${bin} ${lib} || true
rm -rf vpp-data/bin/* || true
rm -rf vpp-data/lib/* || true
+declare -i res=0
cp ${VPP_BUILD_ROOT}/bin/* ${bin}
res+=$?
cp -r ${VPP_BUILD_ROOT}/lib/"${OS_ARCH}"-linux-gnu/* ${lib}
res+=$?
-if [ $res -ne 0 ]; then
+if [ "$res" -ne 0 ]; then
echo "Failed to copy VPP files. Is VPP built? Try running 'make build' in VPP directory."
exit 1
fi