blob: cc2d00b6cbd89f238908de15df85462862f35192 [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
24else
25 VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp-native/vpp
26fi
27echo "Taking build objects from ${VPP_BUILD_ROOT}"
28
29if [ -z "$UBUNTU_VERSION" ] ; then
30 export UBUNTU_VERSION=$(lsb_release -rs)
31fi
32echo "Ubuntu version is set to ${UBUNTU_VERSION}"
33
34export HST_LDPRELOAD=${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/libvcl_ldpreload.so
35echo "HST_LDPRELOAD is set to ${HST_LDPRELOAD}"
36
37export PATH=${VPP_BUILD_ROOT}/bin:$PATH
Filip Tehlar229f5fc2022-08-09 14:44:47 +000038
39bin=vpp-data/bin
40lib=vpp-data/lib
41
42mkdir -p ${bin} ${lib} || true
Filip Tehlar671cf512023-01-31 10:34:18 +010043rm -rf vpp-data/bin/* || true
44rm -rf vpp-data/lib/* || true
Filip Tehlar229f5fc2022-08-09 14:44:47 +000045
Filip Tehlar671cf512023-01-31 10:34:18 +010046cp ${VPP_BUILD_ROOT}/bin/* ${bin}
Maros Ondrejickaf643b6f2023-01-17 10:52:20 +010047res+=$?
Filip Tehlar671cf512023-01-31 10:34:18 +010048cp -r ${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/* ${lib}
Maros Ondrejickaf643b6f2023-01-17 10:52:20 +010049res+=$?
50if [ $res -ne 0 ]; then
51 echo "Failed to copy VPP files. Is VPP built? Try running 'make build' in VPP directory."
52 exit 1
53fi
Filip Tehlar229f5fc2022-08-09 14:44:47 +000054
Filip Tehlar671cf512023-01-31 10:34:18 +010055docker_build () {
56 tag=$1
57 dockername=$2
Florin Coras98d24a52023-12-22 19:58:26 -050058 docker build --build-arg UBUNTU_VERSION \
59 --build-arg http_proxy=$HTTP_PROXY \
60 --build-arg https_proxy=$HTTP_PROXY \
61 --build-arg HTTP_PROXY=$HTTP_PROXY \
62 --build-arg HTTPS_PROXY=$HTTP_PROXY \
63 -t $tag -f docker/Dockerfile.$dockername .
Filip Tehlar671cf512023-01-31 10:34:18 +010064}
65
66docker_build hs-test/vpp vpp
67docker_build hs-test/nginx-ldp nginx
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010068docker_build hs-test/nginx-server nginx-server
Filip Tehlar31eaea92023-06-15 10:06:57 +020069docker_build hs-test/build build
70if [ "$HST_EXTENDED_TESTS" = true ] ; then
71 docker_build hs-test/nginx-http3 nginx-http3
72 docker_build hs-test/curl curl
73fi
Filip Tehlare08fdf32023-04-26 18:03:35 +020074
75# cleanup detached images
76images=$(docker images --filter "dangling=true" -q --no-trunc)
77if [ "$images" != "" ]; then
78 docker rmi $images
79fi