hs-test: arm support

CPU arch dependencies cleanup. Everything works fine apart from
redis-benchmark test.

Type: test

Change-Id: I4a1e7d3bce994f6ea0681e06955ef9c621468642
Signed-off-by: Matus Fabian <matfabia@cisco.com>
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index 7d1242e..54ab922 100644
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -175,7 +175,7 @@
 	@rm -f .deps.ok
 	@apt-get update \
 		&& apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
-		apache2-utils wrk bridge-utils gpg
+		bridge-utils gpg
 	@if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
 		curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
 		echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
diff --git a/extras/hs-test/docker/Dockerfile.ab b/extras/hs-test/docker/Dockerfile.ab
new file mode 100644
index 0000000..3ed1528
--- /dev/null
+++ b/extras/hs-test/docker/Dockerfile.ab
@@ -0,0 +1,9 @@
+ARG UBUNTU_VERSION=22.04
+
+FROM ubuntu:${UBUNTU_VERSION}
+
+RUN apt-get update \
+ && apt-get install -y apache2-utils \
+ && rm -rf /var/lib/apt/lists/*
+
+ENTRYPOINT ["ab"]
diff --git a/extras/hs-test/docker/Dockerfile.curl b/extras/hs-test/docker/Dockerfile.curl
index 0722068..8e9b579 100644
--- a/extras/hs-test/docker/Dockerfile.curl
+++ b/extras/hs-test/docker/Dockerfile.curl
@@ -1,7 +1,9 @@
-ARG UBUNTU_VERSION
+ARG UBUNTU_VERSION=22.04
 
 FROM ubuntu:${UBUNTU_VERSION}
 
+ARG TARGETARCH
+
 RUN apt-get update \
  && apt-get install -y xz-utils wget \
  && rm -rf /var/lib/apt/lists/*
diff --git a/extras/hs-test/docker/Dockerfile.nginx b/extras/hs-test/docker/Dockerfile.nginx
index 78a75d4..c2a3e98 100644
--- a/extras/hs-test/docker/Dockerfile.nginx
+++ b/extras/hs-test/docker/Dockerfile.nginx
@@ -1,4 +1,4 @@
-ARG UBUNTU_VERSION
+ARG UBUNTU_VERSION=22.04
 
 FROM ubuntu:${UBUNTU_VERSION}
 
diff --git a/extras/hs-test/docker/Dockerfile.nginx-http3 b/extras/hs-test/docker/Dockerfile.nginx-http3
index fc90537..d52aff8 100644
--- a/extras/hs-test/docker/Dockerfile.nginx-http3
+++ b/extras/hs-test/docker/Dockerfile.nginx-http3
@@ -1,4 +1,4 @@
-ARG UBUNTU_VERSION
+ARG UBUNTU_VERSION=22.04
 
 FROM ubuntu:${UBUNTU_VERSION}
 
diff --git a/extras/hs-test/docker/Dockerfile.nginx-server b/extras/hs-test/docker/Dockerfile.nginx-server
index ecb8f59..b245b41 100644
--- a/extras/hs-test/docker/Dockerfile.nginx-server
+++ b/extras/hs-test/docker/Dockerfile.nginx-server
@@ -1,4 +1,4 @@
-ARG UBUNTU_VERSION
+ARG UBUNTU_VERSION=22.04
 
 FROM ubuntu:${UBUNTU_VERSION}
 
diff --git a/extras/hs-test/docker/Dockerfile.vpp b/extras/hs-test/docker/Dockerfile.vpp
index 5f5d41c..69fe561 100644
--- a/extras/hs-test/docker/Dockerfile.vpp
+++ b/extras/hs-test/docker/Dockerfile.vpp
@@ -1,4 +1,4 @@
-ARG UBUNTU_VERSION
+ARG UBUNTU_VERSION=22.04
 
 FROM ubuntu:${UBUNTU_VERSION}
 
@@ -8,6 +8,9 @@
     vim gdb libunwind-dev redis redis-tools iperf3 \
  && rm -rf /var/lib/apt/lists/*
 
+ARG OS_ARCH
+RUN echo "I'm building for $OS_ARCH"
+
 ENV DIR=vpp-data/lib/vpp_plugins
 COPY \
    $DIR/af_packet_plugin.so \
@@ -22,7 +25,7 @@
    $DIR/prom_plugin.so \
    $DIR/tlsopenssl_plugin.so \
    $DIR/mactime_plugin.so \
-   /usr/lib/x86_64-linux-gnu/vpp_plugins/
+   /usr/lib/$OS_ARCH-linux-gnu/vpp_plugins/
 
 COPY vpp-data/bin/vpp /usr/bin/
 COPY vpp-data/bin/vppctl /usr/bin/
diff --git a/extras/hs-test/docker/Dockerfile.wrk b/extras/hs-test/docker/Dockerfile.wrk
new file mode 100644
index 0000000..b410873
--- /dev/null
+++ b/extras/hs-test/docker/Dockerfile.wrk
@@ -0,0 +1,9 @@
+ARG UBUNTU_VERSION=22.04
+
+FROM ubuntu:${UBUNTU_VERSION}
+
+RUN apt-get update \
+ && apt-get install -y wrk \
+ && rm -rf /var/lib/apt/lists/*
+
+ENTRYPOINT ["wrk"]
diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go
index 9a3a3c9..0cedfc6 100644
--- a/extras/hs-test/infra/hst_suite.go
+++ b/extras/hs-test/infra/hst_suite.go
@@ -439,6 +439,12 @@
 	}
 }
 
+func (s *HstSuite) SkipIfArm() {
+	if runtime.GOARCH == "arm64" {
+		s.Skip("test case not supported on arm")
+	}
+}
+
 func (s *HstSuite) WaitForCoreDump() bool {
 	var filename string
 	dir, err := os.Open(s.getLogDirPath())
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index 76bc366..585f498 100644
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -78,6 +78,7 @@
 
 func RedisBenchmarkTest(s *LdpSuite) {
 	s.SkipIfMultiWorker()
+	s.SkipIfArm()
 
 	serverContainer := s.GetContainerByName("server-vpp")
 	clientContainer := s.GetContainerByName("client-vpp")
diff --git a/extras/hs-test/script/build_curl.sh b/extras/hs-test/script/build_curl.sh
index e425894..1a61b9f 100755
--- a/extras/hs-test/script/build_curl.sh
+++ b/extras/hs-test/script/build_curl.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
 
-wget https://github.com/stunnel/static-curl/releases/download/8.5.0/curl-static-amd64-8.5.0.tar.xz
-tar -xvf ./curl-static-amd64-8.5.0.tar.xz
+wget https://github.com/stunnel/static-curl/releases/download/8.5.0/curl-static-"$TARGETARCH"-8.5.0.tar.xz
+tar -xvf ./curl-static-"$TARGETARCH"-8.5.0.tar.xz
 cp curl /usr/bin/curl
\ No newline at end of file
diff --git a/extras/hs-test/script/build_hst.sh b/extras/hs-test/script/build_hst.sh
index a072abd..b7580f5 100755
--- a/extras/hs-test/script/build_hst.sh
+++ b/extras/hs-test/script/build_hst.sh
@@ -5,18 +5,6 @@
 	exit 1
 fi
 
-if [ -z "$(which ab)" ]; then
-	echo "Host stack test framework requires apache2-utils to be installed"
-	echo "It is recommended to run 'sudo make install-dep'"
-	exit 1
-fi
-
-if [ -z "$(which wrk)" ]; then
-	echo "Host stack test framework requires wrk to be installed"
-	echo "It is recommended to run 'sudo make install-dep'"
-	exit 1
-fi
-
 export VPP_WS=../..
 OS_ARCH="$(uname -m)"
 DOCKER_BUILD_DIR="/scratch/docker-build"
@@ -73,6 +61,7 @@
     # shellcheck disable=2086
     docker buildx build ${DOCKER_CACHE_ARGS}  \
       --build-arg UBUNTU_VERSION              \
+      --build-arg OS_ARCH="$OS_ARCH"          \
       --build-arg http_proxy="$HTTP_PROXY"    \
       --build-arg https_proxy="$HTTP_PROXY"   \
       --build-arg HTTP_PROXY="$HTTP_PROXY"    \
@@ -87,6 +76,8 @@
 docker_build hs-test/curl curl
 docker_build hs-test/envoy envoy
 docker_build hs-test/nginx-http3 nginx-http3
+docker_build hs-test/ab ab
+docker_build hs-test/wrk wrk
 
 # cleanup detached images
 images=$(docker images --filter "dangling=true" -q --no-trunc)
diff --git a/extras/hs-test/topo-containers/single.yaml b/extras/hs-test/topo-containers/single.yaml
index b6970c5..b4449dc 100644
--- a/extras/hs-test/topo-containers/single.yaml
+++ b/extras/hs-test/topo-containers/single.yaml
@@ -29,12 +29,12 @@
     is-optional: true
 
   - name: "ab"
-    image: "jordi/ab"
+    image: "hs-test/ab"
     is-optional: true
     run-detached: false
 
   - name: "wrk"
-    image: "skandyla/wrk"
+    image: "hs-test/wrk"
     is-optional: true
     run-detached: false