aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-08-09 14:18:05 +0200
committerMauro Sardara <msardara@cisco.com>2022-08-09 15:14:10 +0200
commit24a4dec7f91e9b6f0a8279f6eaeebbb35ba49c4f (patch)
tree37c5c4da37dac456c96b33da6ac80667a79705da
parent8d27045832427a0ea345f48bfb2c42f46a357af1 (diff)
ci: add functional tests to verification/merge jobs
Ref: ICN-732 Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: Iabfce26c446c502dc1d8f50da0d607791ce392e9
-rw-r--r--scripts/build-packages.sh22
-rw-r--r--scripts/functions.sh2
-rw-r--r--scripts/install-vpp.sh3
-rw-r--r--tests/1-node.yml2
-rw-r--r--tests/2-nodes-hicn-light.yml6
-rw-r--r--tests/2-nodes-vpp-bridge.yml4
-rw-r--r--tests/2-nodes-vpp-memif-replication.yml8
-rw-r--r--tests/2-nodes-vpp-memif.yml4
-rw-r--r--tests/2-nodes.yml5
-rw-r--r--tests/Dockerfile.ci41
-rw-r--r--tests/Makefile4
-rwxr-xr-xtests/channel.sh2
-rwxr-xr-xtests/config.sh5
13 files changed, 76 insertions, 32 deletions
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index d7684e400..a17e180f7 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2019 Cisco and/or its affiliates.
+# Copyright (c) 2017-2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -28,9 +28,9 @@ function build_package() {
echo "*******************************************************************"
# Make the package
- make -C ${SCRIPT_PATH}/.. INSTALL_PREFIX=/usr test package-release
+ make -C "${SCRIPT_PATH}/.." BUILD_PATH="${SCRIPT_PATH}/../packages" INSTALL_PREFIX=/usr test package-release
- pushd ${SCRIPT_PATH}/../build-release-${ID}
+ pushd ${SCRIPT_PATH}/../packages
find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
rm *Unspecified* *Development* *development* || true
popd
@@ -40,6 +40,21 @@ function build_package() {
echo "*******************************************************************"
}
+function functional_test() {
+ echo "*******************************************************************"
+ echo "********************* STARTING FUNCTIONAL TESTS *******************"
+ echo "*******************************************************************"
+
+ # Run functional tests
+ pushd ${SCRIPT_PATH}/..
+ BUILD_SOFTWARE=0 DOCKERFILE="tests/Dockerfile.ci" bash ./tests/run-functional.sh
+ popd
+
+ echo "*******************************************************************"
+ echo "********** FUNCTIONAL TESTS COMPLETED SUCCESSFULLY ***************"
+ echo "*******************************************************************"
+}
+
build_sphinx() {
setup
@@ -69,6 +84,7 @@ case "${1}" in
;;
packages)
build_package
+ functional_test
;;
*)
usage
diff --git a/scripts/functions.sh b/scripts/functions.sh
index e416ee274..147f6669c 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -56,6 +56,8 @@ function call_once() {
# Install dependencies
function install_deps() {
+ curl -fsSL https://get.docker.com -o get-docker.sh
+ sudo sh get-docker.sh
make -C ${SCRIPT_PATH}/.. deps
}
diff --git a/scripts/install-vpp.sh b/scripts/install-vpp.sh
index 855587a2e..3c2d2104b 100644
--- a/scripts/install-vpp.sh
+++ b/scripts/install-vpp.sh
@@ -31,6 +31,9 @@ fi
# Prevent vpp to set sysctl
export VPP_INSTALL_SKIP_SYSCTL=1
+apt-get update
+apt-get install -y curl
+
curl -s https://packagecloud.io/install/repositories/fdio/${VPP_VERSION}/script.deb.sh | bash
curl -L https://packagecloud.io/fdio/${VPP_VERSION}/gpgkey | apt-key add -
sed -E -i 's/(deb.*)(\[.*\])(.*)/\1\3/g' /etc/apt/sources.list.d/fdio_"${VPP_VERSION}".list
diff --git a/tests/1-node.yml b/tests/1-node.yml
index a543e70f1..be693c792 100644
--- a/tests/1-node.yml
+++ b/tests/1-node.yml
@@ -4,8 +4,6 @@ services:
build:
context: ..
dockerfile: ${DOCKERFILE}
- args:
- BASE_IMAGE: ${BASE_IMAGE}
image: hicn-base
privileged: true
container_name: forwarder
diff --git a/tests/2-nodes-hicn-light.yml b/tests/2-nodes-hicn-light.yml
index 0aee8cf5e..674df3ea4 100644
--- a/tests/2-nodes-hicn-light.yml
+++ b/tests/2-nodes-hicn-light.yml
@@ -58,8 +58,8 @@ services:
sleep 4
- hiperf -q -z hicnlightng_module -S -R -B 4000kbps ${RTC_PRODUCER} -P 2 &
- hiperf -q -z hicnlightng_module -S ${RAAQM_PRODUCER}/128 &
- hicn-ping-server -q -z hicnlightng_module -s 0 -n ${PING_PRODUCER}/128 &
+ hiperf -q -z hicnlight_module -S -R -B 4000kbps ${RTC_PRODUCER} -P 2 &
+ hiperf -q -z hicnlight_module -S ${RAAQM_PRODUCER}/128 &
+ hicn-ping-server -q -z hicnlight_module -s 0 -n ${PING_PRODUCER}/128 &
tail -f /dev/null
diff --git a/tests/2-nodes-vpp-bridge.yml b/tests/2-nodes-vpp-bridge.yml
index db1fa6fdc..5a61874ac 100644
--- a/tests/2-nodes-vpp-bridge.yml
+++ b/tests/2-nodes-vpp-bridge.yml
@@ -18,7 +18,7 @@ services:
sudo tee /etc/vpp/startup.conf <<EOF
cpu { main-core 1 }
plugins {
- path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+ path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
plugin default { disable }
plugin acl_plugin.so { enable }
plugin nat_plugin.so { enable }
@@ -70,7 +70,7 @@ services:
sudo tee /etc/vpp/startup.conf <<EOF
cpu { main-core 2 }
plugins {
- path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+ path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
plugin default { disable }
plugin acl_plugin.so { enable }
plugin nat_plugin.so { enable }
diff --git a/tests/2-nodes-vpp-memif-replication.yml b/tests/2-nodes-vpp-memif-replication.yml
index 45de82400..c5b0d3865 100644
--- a/tests/2-nodes-vpp-memif-replication.yml
+++ b/tests/2-nodes-vpp-memif-replication.yml
@@ -4,8 +4,6 @@ services:
build:
context: ..
dockerfile: ${DOCKERFILE}
- args:
- BASE_IMAGE: ${BASE_IMAGE}
stdin_open: true
tty: true
working_dir: /workspace
@@ -26,7 +24,7 @@ services:
cpu { main-core 1 }
buffers { buffers-per-numa 600000 }
plugins {
- path /hicn-root/lib/vpp_plugins:/usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+ path /hicn-root/lib/vpp_plugins:/usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
plugin default { disable }
plugin acl_plugin.so { enable }
plugin nat_plugin.so { enable }
@@ -75,8 +73,6 @@ services:
build:
context: ..
dockerfile: ${DOCKERFILE}
- args:
- BASE_IMAGE: ${BASE_IMAGE}
stdin_open: true
tty: true
working_dir: /workspace
@@ -98,7 +94,7 @@ services:
buffers { buffers-per-numa 600000 }
plugins {
- path /hicn-root/lib/vpp_plugins:/usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+ path /hicn-root/lib/vpp_plugins:/usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
plugin default { disable }
plugin acl_plugin.so { enable }
plugin nat_plugin.so { enable }
diff --git a/tests/2-nodes-vpp-memif.yml b/tests/2-nodes-vpp-memif.yml
index 48b4a1c1d..e02c947a6 100644
--- a/tests/2-nodes-vpp-memif.yml
+++ b/tests/2-nodes-vpp-memif.yml
@@ -17,7 +17,7 @@ services:
cpu { main-core 1 }
buffers { buffers-per-numa 600000 }
plugins {
- path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+ path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
plugin default { disable }
plugin acl_plugin.so { enable }
plugin nat_plugin.so { enable }
@@ -75,7 +75,7 @@ services:
buffers { buffers-per-numa 600000 }
plugins {
- path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+ path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
plugin default { disable }
plugin acl_plugin.so { enable }
plugin nat_plugin.so { enable }
diff --git a/tests/2-nodes.yml b/tests/2-nodes.yml
index 72dcc2298..e1740dbf7 100644
--- a/tests/2-nodes.yml
+++ b/tests/2-nodes.yml
@@ -4,9 +4,6 @@ services:
build:
context: ..
dockerfile: ${DOCKERFILE}
- args:
- BASE_IMAGE: ${BASE_IMAGE}
- image: hicn-base
privileged: true
stdin_open: true
hostname: client
@@ -24,8 +21,6 @@ services:
build:
context: ..
dockerfile: ${DOCKERFILE}
- args:
- BASE_IMAGE: ${BASE_IMAGE}
privileged: true
stdin_open: true
hostname: server
diff --git a/tests/Dockerfile.ci b/tests/Dockerfile.ci
index 29f2e9dac..b4c03f7e3 100644
--- a/tests/Dockerfile.ci
+++ b/tests/Dockerfile.ci
@@ -1,5 +1,40 @@
-ARG BASE_IMAGE
+FROM ubuntu:focal
-FROM ${BASE_IMAGE}
+ARG DEBIAN_FRONTEND=noninteractive
+ARG DEB_FOLDER="./packages"
-RUN sudo sed -i 's,secure_path="\(.*\)",secure_path="/hicn-root/bin:\1",' /etc/sudoers
+WORKDIR /hicn-release
+
+################################################################
+# Copy DEB files
+################################################################
+COPY ${DEB_FOLDER} deb
+
+################################################################
+# Install VPP and hicn debs
+################################################################
+ARG VERSION_PATH=/tmp/versions.cmake
+COPY versions.cmake ${VERSION_PATH}
+ARG INSTALL_VPP_SCRIPT=/tmp/install-vpp.sh
+COPY scripts/install-vpp.sh ${INSTALL_VPP_SCRIPT}
+
+RUN bash -x ${INSTALL_VPP_SCRIPT} \
+ && cd deb \
+ && apt-get install -y \
+ iproute2 sudo \
+ ./libhicn_*.deb \
+ ./hicn-light_*.deb \
+ ./hicn-plugin_*.deb \
+ ./libhicnctrl_*.deb \
+ ./libhicnctrl-modules_*.deb \
+ ./libhicntransport-io-modules_*.deb \
+ ./libhicntransport_*.deb \
+ ./facemgr_*.deb \
+ ./hicn-apps_*.deb \
+ && rm ${VERSION_PATH} \
+ && rm -rf deb \
+ && rm -rf /var/lib/apt/lists/* \
+ && apt-get autoremove -y \
+ && apt-get clean
+
+WORKDIR /
diff --git a/tests/Makefile b/tests/Makefile
index 0f30d6a42..f9c166b8d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,12 +1,12 @@
# Use when building for the fist time,
# then `make test` forces a rebuild if local changes
build:
- BASE_IMAGE=hicn DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
+ DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
docker-compose -f build.yml up --force-recreate --remove-orphans
# Rebuild from scratch (to avoid cmake cache)
rebuild:
- BASE_IMAGE=hicn DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
+ DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
REBUILD=1 \
docker-compose -f build.yml up --force-recreate --remove-orphans
diff --git a/tests/channel.sh b/tests/channel.sh
index 28a187e72..59335da65 100755
--- a/tests/channel.sh
+++ b/tests/channel.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/tests/config.sh b/tests/config.sh
index 654bad518..9d8e80d62 100755
--- a/tests/config.sh
+++ b/tests/config.sh
@@ -12,11 +12,10 @@ source ${SCRIPT_PATH}/.env
set -a
DOCKERFILE=${DOCKERFILE:-Dockerfile.dev}
-BASE_IMAGE=${BASE_IMAGE:-hicn}
BUILD_SOFTWARE=${BUILD_SOFTWARE:-1}
set +a
-HIPERF_CMD_RTC="hiperf -q -n 50 -C -H -R ${RTC_PRODUCER} -P 2"
+HIPERF_CMD_RTC="/usr/bin/hiperf -q -n 50 -C -H -R ${RTC_PRODUCER} -P 2"
HIPERF_CMD_MEMIF_RTC="${HIPERF_CMD_RTC} -z memif_module"
POSTPROCESS_COMMAND_RAAQM_RTC='tail -n +3 | \
tr -s " " | \
@@ -34,7 +33,7 @@ POSTPROCESS_COMMAND_RAAQM_RTC='tail -n +3 | \
print int(a[0]), int(a[n-1]), int(s/n) \
}"'
-HIPERF_CMD_RAAQM="hiperf -q -n 50 -i 200 -C -H ${RAAQM_PRODUCER}"
+HIPERF_CMD_RAAQM="/usr/bin/hiperf -q -n 50 -i 200 -C -H ${RAAQM_PRODUCER}"
HIPERF_CMD_CBR="${HIPERF_CMD_RAAQM} -W 350 -M 0"
HIPERF_CMD_MEMIF_RAAQM="${HIPERF_CMD_RAAQM} -z memif_module"
HIPERF_CMD_MEMIF_CBR="${HIPERF_CMD_CBR} -z memif_module"