hs-test: rebuild images when switching build type 61/42061/2
authorMatus Fabian <[email protected]>
Sat, 21 Dec 2024 16:04:16 +0000 (17:04 +0100)
committerFlorin Coras <[email protected]>
Sat, 21 Dec 2024 22:35:06 +0000 (22:35 +0000)
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 <[email protected]>
extras/hs-test/README.rst
extras/hs-test/script/build_hst.sh

index 4b6fbd3..8deebe3 100644 (file)
@@ -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**:
 
index 523398c..04983b0 100755 (executable)
@@ -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