Skip to content

Commit

Permalink
ci: add ci scripts for enabling CI
Browse files Browse the repository at this point in the history
Added ci scripts that ->
 * builds deps and VPP.
 * performs klocwork check.

Type: feature

Signed-off-by: Nawal Kishor <nkishor@marvell.com>
Change-Id: I2753c0cf4f8263e042248d64c66e24303069977a
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/toolkits/vpp/+/143624
Tested-by: sa_ip-sw-jenkins <sa_ip-sw-jenkins@marvell.com>
Tested-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
Reviewed-by: Ashwin Sekhar T K <asekhar@marvell.com>
Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
(cherry picked from commit 950439cc4759e5e1813187a4339888d28671c0a9)
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/toolkits/vpp/+/144354
Reviewed-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
  • Loading branch information
Nawal Kishor authored and kmonendra committed Feb 20, 2025
1 parent 47c5000 commit 3379eaf
Show file tree
Hide file tree
Showing 5 changed files with 236 additions and 0 deletions.
5 changes: 5 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,11 @@ M: Filip Tehlar <ftehlar@cisco.com>
M: Maros Ondrejicka <maros.ondrejicka@pantheon.tech>
F: extras/hs-test

CI - Enable VPP dev-ci
I: ci
M: Nawal Kishor <nkishor@marvell.com>
F: ci/

THE REST
I: misc
M: vpp-dev Mailing List <vpp-dev@fd.io>
Expand Down
45 changes: 45 additions & 0 deletions ci/build/build-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
# Marvell CONFIDENTIAL AND PROPRIETARY NOTE
#
# This software contains information confidential and proprietary to
# Marvell. It shall not be reproduced in whole or in
# part, or transferred to other documents, or disclosed to third
# parties, or used for any purpose other than that for which it was
# obtained, without the prior written consent of Marvell.
#
# Copyright (c) 2025 Marvell. If you received this file from Marvell
# and you have entered into a commercial license agreement (a "Commercial License")
# with Marvell, the file is licensed to you under the terms of the applicable Commercial
# License. In the absence of such license agreement the following file is subject to
# Marvell’s standard Limited Use License Agreement.

# Script syntax:
# build-deps.sh <deps-dir>
#
# Script will:
# 1. Create <deps-dir>
# 2. Fetch and build dependencies.

set -euo pipefail
shopt -s extglob

CROSS_COMPILE=${CROSS_COMPILE:-aarch64-marvell-linux-gnu}
BUILD_ROOT=$(realpath $1)
LIBUUID_DIR=${BUILD_ROOT}/libuuid
DEPS_DIR=${BUILD_ROOT}/deps-prefix

function build_libuuid {
rm -rf ${LIBUUID_DIR}
mkdir -p ${LIBUUID_DIR}
cd ${LIBUUID_DIR}
wget https://github.com/util-linux/util-linux/archive/refs/tags/v2.38.tar.gz
tar -xvf v2.38.tar.gz
cd util-linux-2.38
./autogen.sh
./configure --target=${CROSS_COMPILE} --host=${CROSS_COMPILE} \
--build=x86_64-pc-linux-gnu --disable-all-programs --enable-libuuid \
--prefix ${DEPS_DIR}
make install
}

build_libuuid
86 changes: 86 additions & 0 deletions ci/build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
# Marvell CONFIDENTIAL AND PROPRIETARY NOTE
#
# This software contains information confidential and proprietary to
# Marvell. It shall not be reproduced in whole or in
# part, or transferred to other documents, or disclosed to third
# parties, or used for any purpose other than that for which it was
# obtained, without the prior written consent of Marvell.
#
# Copyright (c) 2025 Marvell. If you received this file from Marvell
# and you have entered into a commercial license agreement (a "Commercial License")
# with Marvell, the file is licensed to you under the terms of the applicable Commercial
# License. In the absence of such license agreement the following file is subject to
# Marvell’s standard Limited Use License Agreement.

set -euo pipefail

function help() {
echo "Builds VPP libraries and applications."
echo ""
echo "Usage:"
echo "$SCRIPT_NAME [ARGUMENTS]..."
echo ""
echo "Mandatory Arguments"
echo "==================="
echo "--build-type | -b : Build type; release/debug"
echo "--deps_dir | -d : Deps dir"
echo ""
echo "Optional Arguments"
echo "==================="
echo "--octeon_version | -o : Version(cn10k, cn9k)"
echo "--help | -h : Print this help and exit"
}

SCRIPT_NAME="$(basename "$0")"
if ! OPTS=$(getopt \
-o "b:d:oh" \
-l "build-type:,deps-dir:,octeon_version,help" \
-n "$SCRIPT_NAME" \
-- "$@"); then
help
exit 1
fi

DEPS_DIR=
BUILD=
export CROSS="aarch64-marvell-linux-gnu-"
export OCTEON_VERSION="cn10k"
export PLATFORM="cnxk"

eval set -- "$OPTS"
unset OPTS
while [[ $# -gt 1 ]]; do
case $1 in
-b|--build-type) shift; BUILD=$1;;
-d|--deps-dir) shift; DEPS_DIR=$(realpath $1);;
-o|--octeon-version) shift; OCTEON_VERSION=$1;;
-h|--help) help; exit 0;;
*) help; exit 1;;
esac
shift
done

if [[ -z $BUILD || -z $DEPS_DIR ]]; then
echo "Build_type and Deps directory should be passed as argument !!"
help
exit 1
fi

if [[ $BUILD == "debug" ]]; then
BUILD_TYPE=build
elif [[ $BUILD == "release" ]]; then
BUILD_TYPE=build-release
else
echo "Pass build-type (release/debug)"
help
exit 1
fi

DEPS_PREFIX=${DEPS_DIR}/deps-prefix
export cnxk_c_flags="-I/${DEPS_PREFIX}/include/ -L/${DEPS_PREFIX}/lib"
export UNATTENDED=y
export DEBIAN_FRONTEND=noninteractive
# FIXME: Remove install-dep command when these deps are installed in docker container.
make install-dep
make $BUILD_TYPE
5 changes: 5 additions & 0 deletions ci/checkpatch/run_sanity_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2025 Marvell.

# Add when required.
95 changes: 95 additions & 0 deletions ci/klocwork/klocwork.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/bin/bash
# Marvell CONFIDENTIAL AND PROPRIETARY NOTE
#
# This software contains information confidential and proprietary to
# Marvell. It shall not be reproduced in whole or in
# part, or transferred to other documents, or disclosed to third
# parties, or used for any purpose other than that for which it was
# obtained, without the prior written consent of Marvell.
#
# Copyright (c) 2025 Marvell. If you received this file from Marvell
# and you have entered into a commercial license agreement (a "Commercial License")
# with Marvell, the file is licensed to you under the terms of the applicable Commercial
# License. In the absence of such license agreement the following file is subject to
# Marvell’s standard Limited Use License Agreement.

set -euo pipefail

function help() {
echo "Builds VPP libraries and applications with klocwork"
echo ""
echo "Usage:"
echo "$SCRIPT_NAME [ARGUMENTS]..."
echo ""
echo "Mandatory Arguments"
echo "==================="
echo "--build-root | -r : Build root directory"
echo "--deps_dir | -d : Deps dir"
echo "--cnxk_sdk_sysroot | -s : CNXK_SDK_SYSROOT path"
echo ""
echo "Optional Arguments"
echo "==================="
echo "--octeon_version | -o : Version(cn10k, cn9k)"
echo "--help | -h : Print this help and exit"
}

SCRIPT_NAME="$(basename "$0")"
if ! OPTS=$(getopt \
-o "r:d:s:oh" \
-l "build-root:,deps-dir:,cnxk_sdk_sysroot:,octeon_version,help" \
-n "$SCRIPT_NAME" \
-- "$@"); then
help
exit 1
fi

BUILD_ROOT=
DEPS_DIR=
CNXK_SYSROOT=
export CROSS="aarch64-marvell-linux-gnu-"
export OCTEON_VERSION="cn10k"
export PLATFORM="cnxk"

eval set -- "$OPTS"
unset OPTS
while [[ $# -gt 1 ]]; do
case $1 in
-r|--build_root) shift; BUILD_ROOT=$(realpath $1);;
-d|--deps-dir) shift; DEPS_DIR=$(realpath $1);;
-s|--cnxk_sdk_sysroot) shift; CNXK_SYSROOT=$1;;
-o|--octeon-version) shift; OCTEON_VERSION=$1;;
-h|--help) help; exit 0;;
*) help; exit 1;;
esac
shift
done

if [[ -z $DEPS_DIR || -z $BUILD_ROOT || -z $CNXK_SYSROOT ]]; then
echo "Deps directory, build root and cnxk_sdk_sysroot should be passed as argument !!"
help
exit 1
fi

DEPS_PREFIX=${DEPS_DIR}/deps-prefix
export CNXK_SDK_SYSROOT=$CNXK_SYSROOT
export cnxk_c_flags="-I/${DEPS_PREFIX}/include/ -L/${DEPS_PREFIX}/lib"
export UNATTENDED=y
export DEBIAN_FRONTEND=noninteractive
# FIXME: Remove install-dep command when these deps are installed in docker container.
make install-dep
rm -rf .kwlp .kwps
kwcheck create
kwcheck set license.host=llic5-01.marvell.com license.port=33138

# List of directories to ignore in klocwork checks
IGNORE_FILES=""

kwinject --ignore-files $IGNORE_FILES -w make build
kwcheck run -r -b kwinject.out -F detailed --report kwreport-detailed.txt
kwcheck list -F scriptable --report kwreport-scritpable.txt
CNXK_ISSUES=$(wc -l kwreport-scritpable.txt | awk '{print $1}')

echo "#########################################################################"
echo "Klocwork CNXK Issues: $CNXK_ISSUES"
echo "Klocwork Report : $PWD/kwreport-detailed.txt"
echo "#########################################################################"

0 comments on commit 3379eaf

Please sign in to comment.