api: af_packet - Mark old message versions as deprecated
[vpp.git] / extras / hs-test / script / build.sh
1 #!/usr/bin/env bash
2
3 if [ $(lsb_release -is) != Ubuntu ]; then
4         echo "Host stack test framework is supported only on Ubuntu"
5         exit 1
6 fi
7
8 if [ -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
12 fi
13
14 if [ -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
18 fi
19
20 export VPP_WS=../..
21
22 if [ "$1" == "debug" ]; then
23         VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp_debug-native/vpp
24 else
25         VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp-native/vpp
26 fi
27 echo "Taking build objects from ${VPP_BUILD_ROOT}"
28
29 if [ -z "$UBUNTU_VERSION" ] ; then
30         export UBUNTU_VERSION=$(lsb_release -rs)
31 fi
32 echo "Ubuntu version is set to ${UBUNTU_VERSION}"
33
34 export HST_LDPRELOAD=${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/libvcl_ldpreload.so
35 echo "HST_LDPRELOAD is set to ${HST_LDPRELOAD}"
36
37 export PATH=${VPP_BUILD_ROOT}/bin:$PATH
38
39 bin=vpp-data/bin
40 lib=vpp-data/lib
41
42 mkdir -p ${bin} ${lib} || true
43 rm -rf vpp-data/bin/* || true
44 rm -rf vpp-data/lib/* || true
45
46 cp ${VPP_BUILD_ROOT}/bin/* ${bin}
47 res+=$?
48 cp -r ${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/* ${lib}
49 res+=$?
50 if [ $res -ne 0 ]; then
51         echo "Failed to copy VPP files. Is VPP built? Try running 'make build' in VPP directory."
52         exit 1
53 fi
54
55 docker_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
62 docker_build hs-test/vpp vpp
63 docker_build hs-test/nginx-ldp nginx
64 docker_build hs-test/nginx-server nginx-server
65
66 # cleanup detached images
67 images=$(docker images --filter "dangling=true" -q --no-trunc)
68 if [ "$images" != "" ]; then
69     docker rmi $images
70 fi