From b91f595f7a082e9ecd16aa14de87b0d7990b33a8 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Sat, 21 Dec 2024 17:04:16 +0100 Subject: 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 --- extras/hs-test/README.rst | 4 ++-- extras/hs-test/script/build_hst.sh | 5 +++-- 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 `_, 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 -- cgit 1.2.3-korg