blob: 3b4bc28e275d362b6ad82f7b02d0fb15401834ed [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001#!/usr/bin/env bash
2
Maros Ondrejickaf643b6f2023-01-17 10:52:20 +01003if [ $(lsb_release -is) != Ubuntu ]; then
4 echo "Host stack test framework is supported only on Ubuntu"
5 exit 1
6fi
7
Maros Ondrejicka2ddb2fd2023-02-15 17:44:46 +01008if [ -z $(which ab) ]; then
9 echo "Host stack test framework requires apache2-utils to be installed"
10 echo "It is recommended to run 'sudo make install-dep'"
11 exit 1
12fi
13
14if [ -z $(which wrk) ]; then
15 echo "Host stack test framework requires wrk to be installed"
16 echo "It is recommended to run 'sudo make install-dep'"
17 exit 1
18fi
19
Filip Tehlar671cf512023-01-31 10:34:18 +010020export VPP_WS=../..
21
22if [ "$1" == "debug" ]; then
23 VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp_debug-native/vpp
adrianvillin85121452024-01-11 11:59:47 +010024elif [ "$1" == "gcov" ]; then
25 VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp_gcov-native/vpp
Filip Tehlar671cf512023-01-31 10:34:18 +010026else
27 VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp-native/vpp
28fi
29echo "Taking build objects from ${VPP_BUILD_ROOT}"
30
31if [ -z "$UBUNTU_VERSION" ] ; then
32 export UBUNTU_VERSION=$(lsb_release -rs)
33fi
34echo "Ubuntu version is set to ${UBUNTU_VERSION}"
35
36export HST_LDPRELOAD=${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/libvcl_ldpreload.so
37echo "HST_LDPRELOAD is set to ${HST_LDPRELOAD}"
38
39export PATH=${VPP_BUILD_ROOT}/bin:$PATH
Filip Tehlar229f5fc2022-08-09 14:44:47 +000040
41bin=vpp-data/bin
42lib=vpp-data/lib
43
44mkdir -p ${bin} ${lib} || true
Filip Tehlar671cf512023-01-31 10:34:18 +010045rm -rf vpp-data/bin/* || true
46rm -rf vpp-data/lib/* || true
Filip Tehlar229f5fc2022-08-09 14:44:47 +000047
Filip Tehlar671cf512023-01-31 10:34:18 +010048cp ${VPP_BUILD_ROOT}/bin/* ${bin}
Maros Ondrejickaf643b6f2023-01-17 10:52:20 +010049res+=$?
Filip Tehlar671cf512023-01-31 10:34:18 +010050cp -r ${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/* ${lib}
Maros Ondrejickaf643b6f2023-01-17 10:52:20 +010051res+=$?
52if [ $res -ne 0 ]; then
53 echo "Failed to copy VPP files. Is VPP built? Try running 'make build' in VPP directory."
54 exit 1
55fi
Filip Tehlar229f5fc2022-08-09 14:44:47 +000056
Filip Tehlar671cf512023-01-31 10:34:18 +010057docker_build () {
58 tag=$1
59 dockername=$2
Florin Coras98d24a52023-12-22 19:58:26 -050060 docker build --build-arg UBUNTU_VERSION \
61 --build-arg http_proxy=$HTTP_PROXY \
62 --build-arg https_proxy=$HTTP_PROXY \
63 --build-arg HTTP_PROXY=$HTTP_PROXY \
64 --build-arg HTTPS_PROXY=$HTTP_PROXY \
65 -t $tag -f docker/Dockerfile.$dockername .
Filip Tehlar671cf512023-01-31 10:34:18 +010066}
67
68docker_build hs-test/vpp vpp
69docker_build hs-test/nginx-ldp nginx
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010070docker_build hs-test/nginx-server nginx-server
Filip Tehlar31eaea92023-06-15 10:06:57 +020071docker_build hs-test/build build
72if [ "$HST_EXTENDED_TESTS" = true ] ; then
73 docker_build hs-test/nginx-http3 nginx-http3
Matus Fabianb7a9ed72024-05-10 16:20:40 +020074 docker_build hs-test/curl curl
Filip Tehlar31eaea92023-06-15 10:06:57 +020075fi
Filip Tehlare08fdf32023-04-26 18:03:35 +020076
77# cleanup detached images
78images=$(docker images --filter "dangling=true" -q --no-trunc)
79if [ "$images" != "" ]; then
80 docker rmi $images
81fi