blob: 97278eb4919c79d147718cf5663e8ab75f681152 [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
58 docker build --build-arg UBUNTU_VERSION --build-arg http_proxy=$HTTP_PROXY \
59 -t $tag -f docker/Dockerfile.$dockername .
60}
61
62docker_build hs-test/vpp vpp
63docker_build hs-test/nginx-ldp nginx
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010064docker_build hs-test/nginx-server nginx-server