From adca460e47e51fae27cd4758aed439cfd9a18e68 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Fri, 22 Jun 2018 14:14:52 +0200 Subject: [PATCH] CI: import of scripts into develop-nr Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/Jenkinsfile-gitlab | 143 ++++++ ci-scripts/astyle-options.txt | 20 + ci-scripts/buildLocally.sh | 153 +++++++ ci-scripts/buildOnVM.sh | 336 ++++++++++++++ ci-scripts/checkCodingFormattingRules.sh | 121 +++++ ci-scripts/doGitLabMerge.sh | 109 +++++ ci-scripts/reportBuildLocally.sh | 558 +++++++++++++++++++++++ ci-scripts/template-host.xml | 27 ++ 8 files changed, 1467 insertions(+) create mode 100644 ci-scripts/Jenkinsfile-gitlab create mode 100644 ci-scripts/astyle-options.txt create mode 100755 ci-scripts/buildLocally.sh create mode 100755 ci-scripts/buildOnVM.sh create mode 100755 ci-scripts/checkCodingFormattingRules.sh create mode 100755 ci-scripts/doGitLabMerge.sh create mode 100755 ci-scripts/reportBuildLocally.sh create mode 100644 ci-scripts/template-host.xml diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab new file mode 100644 index 00000000000..a5bbc2418ed --- /dev/null +++ b/ci-scripts/Jenkinsfile-gitlab @@ -0,0 +1,143 @@ +// Comments + +pipeline { + agent { + label 'bellatrix' + } + options { + disableConcurrentBuilds() + timestamps() + gitLabConnection('OAI GitLab') + gitlabBuilds(builds: ["Build eNb-USRP", "Build gNb-usrp", "Build nr-UE-usrp", "Build phy-sim", "Analysis with cppcheck"]) + } + + stages { + stage ("Verify Guidelines") { + steps { + echo "Git URL is ${GIT_URL}" + echo "GitLab Act is ${env.gitlabActionType}" + script { + if ("MERGE".equals(env.gitlabActionType)) { + // GitLab-Jenkins plugin integration is lacking to perform the merge by itself + // Doing it manually --> it may have merge conflicts + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" + sh "zip -r -qq localZip.zip ." + + // Running astyle options on the list of modified files by the merge request + // For the moment, there is no fail criteria. Just a notification of number of files that do not follow + sh "./ci-scripts/checkCodingFormattingRules.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}" + def res=readFile('./oai_rules_result.txt').trim(); + if ("0".equals(res)) { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): All Changed files in Merge Request follow OAI Formatting Rules" + addGitLabMRComment comment: message + } else { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some Changed files in Merge Request DO NOT follow OAI Formatting Rules" + addGitLabMRComment comment: message + } + } else { + echo "Git Branch is ${GIT_BRANCH}" + echo "Git Commit is ${GIT_COMMIT}" + + sh "zip -r -qq localZip.zip ." + // Running astyle options on all C/H files in the repository + // For the moment, there is no fail criteria. Just a notification of number of files that do not follow + sh "./ci-scripts/checkCodingFormattingRules.sh" + } + } + } + } + + stage ("Variant Builds") { + parallel { + stage ("Analysis with cppcheck") { + steps { + gitlabCommitStatus(name: "Analysis with cppcheck") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck" + } + } + } + stage ("Build eNb-USRP") { + steps { + gitlabCommitStatus(name: "Build eNb-USRP") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp" + } + } + } + stage ("Build 5G gNB-USRP") { + steps { + gitlabCommitStatus(name: "Build gNb-usrp") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant gnb-usrp" + } + } + } + stage ("Build 5G NR-UE-USRP") { + steps { + gitlabCommitStatus(name: "Build nr-UE-usrp") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant nu-ue-usrp" + } + } + } + stage ("Build physical simulators") { + steps { + gitlabCommitStatus(name: "Build phy-sim") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim" + } + } + } + } + post { + always { + script { + dir ('archives') { + sh "zip -r vm_build_logs.zip enb_usrp phy_sim cppcheck gnb_usrp nrue_usrp" + } + if(fileExists('archives/vm_build_logs.zip')) { + archiveArtifacts artifacts: 'archives/vm_build_logs.zip' + } + if ("MERGE".equals(env.gitlabActionType)) { + sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" + } else { + sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}" + } + if(fileExists('build_results.html')) { + archiveArtifacts artifacts: 'build_results.html' + } + } + } + } + } + } + post { + always { + script { + echo "End of script" + } + } + success { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")" + if ("MERGE".equals(env.gitlabActionType)) { + echo "This is a MERGE event" + addGitLabMRComment comment: message + def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")" + slackSend channel: 'ci-enb', color: 'good', message: message2 + } else { + slackSend channel: 'ci-enb', color: 'good', message: message + } + } + } + failure { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")" + if ("MERGE".equals(env.gitlabActionType)) { + echo "This is a MERGE event" + addGitLabMRComment comment: message + def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")" + slackSend channel: 'ci-enb', color: 'danger', message: message2 + } else { + slackSend channel: 'ci-enb', color: 'danger', message: message + } + } + } + } +} diff --git a/ci-scripts/astyle-options.txt b/ci-scripts/astyle-options.txt new file mode 100644 index 00000000000..7f28bbb1f01 --- /dev/null +++ b/ci-scripts/astyle-options.txt @@ -0,0 +1,20 @@ +# OAI is using a style that is similar to the Google style +--style=google +# long options can be written without the preceding '--' +# Convert tabs to spaces +convert-tabs +# Indentation is 2 spaces +indent=spaces=2 +# Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block. +indent-switches +# Indent C++ comments beginning in column one. +indent-col1-comments +# Pad empty lines around header blocks +break-blocks +delete-empty-lines +# Attach a pointer or reference operator (*, &, or ^) to the variable name (right) +align-pointer=name +# The code line length is 200 characters/columns +max-code-length=200 +break-after-logical +lineend=linux diff --git a/ci-scripts/buildLocally.sh b/ci-scripts/buildLocally.sh new file mode 100755 index 00000000000..67019508327 --- /dev/null +++ b/ci-scripts/buildLocally.sh @@ -0,0 +1,153 @@ +#!/bin/bash + +function usage { + echo "OAI Local Build Check script" + echo " Original Author: Raphael Defosseux" + echo "" + echo "Usage:" + echo "------" + echo " buildLocally.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --workspace #### OR -ws ####" + echo " Specify the workspace" + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +if [ $# -ne 2 ] && [ $# -ne 1 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -ws|--workspace) + JENKINS_WKSP="$2" + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac +done + +cd $JENKINS_WKSP +STATUS=0 + +############################################################ +# Creating a tmp folder to store results and artifacts +############################################################ +if [ ! -d $JENKINS_WKSP/archives ] +then + mkdir $JENKINS_WKSP/archives +fi + +source oaienv +cd $JENKINS_WKSP/cmake_targets + +############################################################ +# Building eNb with USRP option +############################################################ +ARCHIVES_LOC=$JENKINS_WKSP/archives/enb_usrp +if [ ! -d $ARCHIVES_LOC ] +then + mkdir $ARCHIVES_LOC +fi +./build_oai --eNB -w USRP -c + +# Generated log files: +if [ -f $JENKINS_WKSP/cmake_targets/log/lte-softmodem.Rel14.txt ] +then + LOCAL_STAT=`egrep -c "Built target lte-softmodem" $JENKINS_WKSP/cmake_targets/log/lte-softmodem.Rel14.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/lte-softmodem.Rel14.txt $ARCHIVES_LOC +else + STATUS=-1 +fi +if [ -f $JENKINS_WKSP/cmake_targets/log/params_libconfig.Rel14.txt ] +then + LOCAL_STAT=`egrep -c "Built target params_libconfig" $JENKINS_WKSP/cmake_targets/log/params_libconfig.Rel14.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/params_libconfig.Rel14.txt $ARCHIVES_LOC +else + STATUS=-1 +fi +if [ -f $JENKINS_WKSP/cmake_targets/log/coding.Rel14.txt ] +then + LOCAL_STAT=`egrep -c "Built target coding" $JENKINS_WKSP/cmake_targets/log/coding.Rel14.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/coding.Rel14.txt $ARCHIVES_LOC +else + STATUS=-1 +fi +if [ -f $JENKINS_WKSP/cmake_targets/log/oai_usrpdevif.Rel14.txt ] +then + LOCAL_STAT=`egrep -c "Built target oai_usrpdevif" $JENKINS_WKSP/cmake_targets/log/oai_usrpdevif.Rel14.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/oai_usrpdevif.Rel14.txt $ARCHIVES_LOC +else + STATUS=-1 +fi + +############################################################ +# Building basic simulator +############################################################ +ARCHIVES_LOC=$JENKINS_WKSP/archives/basic_sim +if [ ! -d $ARCHIVES_LOC ] +then + mkdir $ARCHIVES_LOC +fi +cd $JENKINS_WKSP/cmake_targets +./build_oai --basic-simulator -c + +# Generated log files: +if [ -f $JENKINS_WKSP/cmake_targets/log/basic_simulator_enb.txt ] +then + LOCAL_STAT=`egrep -c "Built target lte-softmodem" $JENKINS_WKSP/cmake_targets/log/basic_simulator_enb.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/basic_simulator_enb.txt $ARCHIVES_LOC +else + STATUS=-1 +fi +if [ -f $JENKINS_WKSP/cmake_targets/log/basic_simulator_ue.txt ] +then + LOCAL_STAT=`egrep -c "Built target lte-uesoftmodem" $JENKINS_WKSP/cmake_targets/log/basic_simulator_ue.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/basic_simulator_ue.txt $ARCHIVES_LOC +else + STATUS=-1 +fi +if [ -f $JENKINS_WKSP/cmake_targets/log/conf2uedata.Rel14.txt ] +then + LOCAL_STAT=`egrep -c "Built target conf2uedata" $JENKINS_WKSP/cmake_targets/log/conf2uedata.Rel14.txt` + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + cp $JENKINS_WKSP/cmake_targets/log/conf2uedata.Rel14.txt $ARCHIVES_LOC +else + STATUS=-1 +fi + +############################################################ +# Creating a zip for Jenkins archiving +############################################################ +cd $JENKINS_WKSP/archives/ +zip -r local_build_logs.zip basic_sim enb_usrp + +exit $STATUS diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh new file mode 100755 index 00000000000..533fc396304 --- /dev/null +++ b/ci-scripts/buildOnVM.sh @@ -0,0 +1,336 @@ +#!/bin/bash + +function usage { + echo "OAI VM Build Check script" + echo " Original Author: Raphael Defosseux" + echo " Requirements:" + echo " -- uvtool uvtool-libvirt apt-cacher" + echo " -- xenial image already synced" + echo " Default:" + echo " -- eNB with USRP" + echo "" + echo "Usage:" + echo "------" + echo " buildOnVM.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --workspace #### OR -ws ####" + echo " Specify the workspace." + echo "" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant gnb-usrp OR -v5" + echo " --variant nu-ue-usrp OR -v6" + echo " Specify the variant to build." + echo "" + echo " --keep-vm-alive OR -k" + echo " Keep the VM alive after the build." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +function variant_usage { + echo "OAI VM Build Check script" + echo " Original Author: Raphael Defosseux" + echo "" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant gnb-usrp OR -v5" + echo " --variant nu-ue-usrp OR -v6" + echo "" +} + +if [ $# -lt 1 ] || [ $# -gt 5 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +VM_NAME=ci-enb-usrp +ARCHIVES_LOC=enb_usrp +LOG_PATTERN=.Rel14.txt +NB_PATTERN_FILES=4 +BUILD_OPTIONS="--eNB -w USRP" +KEEP_VM_ALIVE=0 + +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -ws|--workspace) + JENKINS_WKSP="$2" + shift + shift + ;; + -k|--keep-vm-alive) + KEEP_VM_ALIVE=1 + shift + ;; + -v1) + VM_NAME=ci-enb-usrp + ARCHIVES_LOC=enb_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -w USRP" + shift + ;; + -v2) + VM_NAME=ci-basic-sim + ARCHIVES_LOC=basic_sim + LOG_PATTERN=basic_simulator + NB_PATTERN_FILES=2 + BUILD_OPTIONS="--basic-simulator" + shift + ;; + -v3) + VM_NAME=ci-phy-sim + ARCHIVES_LOC=phy_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=3 + BUILD_OPTIONS="--phy_simulators" + shift + ;; + -v4) + VM_NAME=ci-cppcheck + ARCHIVES_LOC=cppcheck + LOG_PATTERN=cppcheck.xml + NB_PATTERN_FILES=1 + BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" + shift + ;; + -v5) + VM_NAME=ci-gnb-usrp + ARCHIVES_LOC=gnb_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--gNB -w USRP" + shift + ;; + -v6) + VM_NAME=ci-ue-nr-usrp + ARCHIVES_LOC=nrue_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--nrUE -w USRP" + shift + ;; + --variant) + variant="$2" + case $variant in + enb-usrp) + VM_NAME=ci-enb-usrp + ARCHIVES_LOC=enb_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -w USRP" + ;; + basic-sim) + VM_NAME=ci-basic-sim + ARCHIVES_LOC=basic_sim + LOG_PATTERN=basic_simulator + NB_PATTERN_FILES=2 + BUILD_OPTIONS="--basic-simulator" + ;; + phy-sim) + VM_NAME=ci-phy-sim + ARCHIVES_LOC=phy_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=3 + BUILD_OPTIONS="--phy_simulators" + ;; + cppcheck) + VM_NAME=ci-cppcheck + ARCHIVES_LOC=cppcheck + LOG_PATTERN=cppcheck.xml + NB_PATTERN_FILES=1 + BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" + ;; + gnb-usrp) + VM_NAME=ci-gnb-usrp + ARCHIVES_LOC=gnb_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--gNB -w USRP" + ;; + nu-ue-usrp) + VM_NAME=ci-ue-nr-usrp + ARCHIVES_LOC=nrue_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--nrUE -w USRP" + ;; + *) + echo "" + echo "Syntax Error: Invalid Variant option -> $variant" + echo "" + variant_usage + exit 1 + esac + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac +done + +if [ ! -f $JENKINS_WKSP/localZip.zip ] +then + echo "Missing localZip.zip file!" + exit 1 +fi +if [ ! -f /etc/apt/apt.conf.d/01proxy ] +then + echo "Missing /etc/apt/apt.conf.d/01proxy file!" + echo "Is apt-cacher installed and configured?" + exit 1 +fi + +VM_CMDS=${VM_NAME}_cmds.txt +ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} + +echo "VM_NAME = $VM_NAME" +echo "VM_CMD_FILE = $VM_CMDS" +echo "JENKINS_WKSP = $JENKINS_WKSP" +echo "ARCHIVES_LOC = $ARCHIVES_LOC" +echo "BUILD_OPTIONS = $BUILD_OPTIONS" + +echo "############################################################" +echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" +echo "############################################################" +uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml +echo "Waiting for VM to be started" +uvt-kvm wait $VM_NAME --insecure + +VM_IP_ADDR=`uvt-kvm ip $VM_NAME` +echo "$VM_NAME has for IP addr = $VM_IP_ADDR" + +echo "############################################################" +echo "Copying GIT repo into VM ($VM_NAME)" +echo "############################################################" +scp -o StrictHostKeyChecking=no localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu +scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu + +echo "############################################################" +echo "Running install and build script on VM ($VM_NAME)" +echo "############################################################" +echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS +if [ "$VM_NAME" == "ci-cppcheck" ] +then + echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS +else + echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS + echo "sudo apt-get --yes install zip subversion libboost-dev > zip-install.txt 2>&1" >> $VM_CMDS +fi +echo "mkdir tmp" >> $VM_CMDS +echo "cd tmp" >> $VM_CMDS +echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS +echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS +if [ "$VM_NAME" == "ci-cppcheck" ] +then + echo "mkdir cmake_targets/log" >> $VM_CMDS + echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS + echo "echo \"cppcheck $BUILD_OPTIONS . \"" >> $VM_CMDS + echo "cppcheck $BUILD_OPTIONS . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt" >> $VM_CMDS +else + echo "echo \"source oaienv\"" >> $VM_CMDS + echo "source oaienv" >> $VM_CMDS + echo "cd cmake_targets/" >> $VM_CMDS + echo "mkdir log" >> $VM_CMDS + echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS + echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS + echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS +fi +ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + +echo "############################################################" +echo "Creating a tmp folder to store results and artifacts" +echo "############################################################" +if [ ! -d $JENKINS_WKSP/archives ] +then + mkdir $JENKINS_WKSP/archives +fi + +if [ ! -d $ARCHIVES_LOC ] +then + mkdir $ARCHIVES_LOC +fi + +scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC +if [ "$VM_NAME" == "ci-cppcheck" ] +then + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC +fi + +if [ $KEEP_VM_ALIVE -eq 0 ] +then + echo "############################################################" + echo "Destroying VM" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR +fi +rm -f $VM_CMDS + +echo "############################################################" +echo "Checking build status" +echo "############################################################" + +LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml` +STATUS=0 +NB_FOUND_FILES=0 + +for FULLFILE in $LOG_FILES +do + if [[ $FULLFILE == *"$LOG_PATTERN"* ]] + then + filename=$(basename -- "$FULLFILE") + if [ "$LOG_PATTERN" == ".Rel14.txt" ] + then + PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"` + fi + if [ "$LOG_PATTERN" == "basic_simulator" ] + then + PASS_PATTERN="lte-" + fi + if [ "$LOG_PATTERN" == "cppcheck.xml" ] + then + PASS_PATTERN="results version" + LOCAL_STAT=`egrep -c "$PASS_PATTERN" $FULLFILE` + else + LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE` + fi + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) + fi +done + +if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi + +if [ $STATUS -eq 0 ] +then + echo "STATUS seems OK" +else + echo "STATUS failed?" +fi +exit $STATUS diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh new file mode 100755 index 00000000000..20657b7fd0a --- /dev/null +++ b/ci-scripts/checkCodingFormattingRules.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +function usage { + echo "OAI Coding / Formatting Guideline Check script" + echo " Original Author: Raphael Defosseux" + echo "" + echo " Requirement: astyle shall be installed" + echo "" + echo " By default (no options) the complete repository will be checked" + echo " In case of merge request, provided source and target branch," + echo " the script will check only the modified files" + echo "" + echo "Usage:" + echo "------" + echo " checkCodingFormattingRules.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --src-branch #### OR -sb ####" + echo " Specify the source branch of the merge request." + echo "" + echo " --target-branch #### OR -tb ####" + echo " Specify the target branch of the merge request (usually develop)." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +if [ $# -ne 4 ] && [ $# -ne 1 ] && [ $# -ne 0 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +if [ $# -eq 0 ] +then + echo " ---- Checking the whole repository ----" + echo "" + NB_FILES_TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt --recursive *.c *.h | grep -c Formatted ` + echo "Nb Files that do NOT follow OAI rules: $NB_FILES_TO_FORMAT" + echo $NB_FILES_TO_FORMAT > ./oai_rules_result.txt + exit 0 +fi + +checker=0 +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -sb|--src-branch) + SOURCE_BRANCH="$2" + let "checker|=0x1" + shift + shift + ;; + -tb|--target-branch) + TARGET_BRANCH="$2" + let "checker|=0x2" + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac + +done + + +if [ $checker -ne 3 ] +then + echo "Source Branch is : $SOURCE_BRANCH" + echo "Target Branch is : $TARGET_BRANCH" + echo "" + echo "Syntax Error: missing option" + echo "" + usage + exit 1 +fi + +# Merge request scenario + +MERGE_COMMMIT=`git log -n1 | grep commit | sed -e "s@commit @@"` +TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH` + +echo " ---- Checking the modified files by the merge request ----" +echo "" +echo "Source Branch is : $SOURCE_BRANCH" +echo "Target Branch is : $TARGET_BRANCH" +echo "Merged Commit is : $MERGE_COMMMIT" +echo "Target Init is : $TARGET_INIT_COMMIT" + +# Retrieve the list of modified files since the latest develop commit +MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq` +NB_TO_FORMAT=0 +for FULLFILE in $MODIFIED_FILES +do + echo $FULLFILE + filename=$(basename -- "$FULLFILE") + EXT="${filename##*.}" + if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ] + then + TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted ` + NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT)) + fi +done +echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT" +echo $NB_TO_FORMAT > ./oai_rules_result.txt + +exit 0 diff --git a/ci-scripts/doGitLabMerge.sh b/ci-scripts/doGitLabMerge.sh new file mode 100755 index 00000000000..cc6f38c8106 --- /dev/null +++ b/ci-scripts/doGitLabMerge.sh @@ -0,0 +1,109 @@ +#!/bin/bash + +function usage { + echo "OAI GitLab merge request applying script" + echo " Original Author: Raphael Defosseux" + echo "" + echo "Usage:" + echo "------" + echo "" + echo " doGitLabMerge.sh [OPTIONS] [MANDATORY_OPTIONS]" + echo "" + echo "Mandatory Options:" + echo "------------------" + echo "" + echo " --src-branch #### OR -sb ####" + echo " Specify the source branch of the merge request." + echo "" + echo " --src-commit #### OR -sc ####" + echo " Specify the source commit ID (SHA-1) of the merge request." + echo "" + echo " --target-branch #### OR -tb ####" + echo " Specify the target branch of the merge request (usually develop)." + echo "" + echo " --target-commit #### OR -tc ####" + echo " Specify the target commit ID (SHA-1) of the merge request." + echo "" + echo "Options:" + echo "--------" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +if [ $# -ne 8 ] && [ $# -ne 1 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +checker=0 +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -sb|--src-branch) + SOURCE_BRANCH="$2" + let "checker|=0x1" + shift + shift + ;; + -sc|--src-commit) + SOURCE_COMMIT_ID="$2" + let "checker|=0x2" + shift + shift + ;; + -tb|--target-branch) + TARGET_BRANCH="$2" + let "checker|=0x4" + shift + shift + ;; + -tc|--target-commit) + TARGET_COMMIT_ID="$2" + let "checker|=0x8" + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac + +done + +echo "Source Branch is : $SOURCE_BRANCH" +echo "Source Commit ID is : $SOURCE_COMMIT_ID" +echo "Target Branch is : $TARGET_BRANCH" +echo "Target Commit ID is : $TARGET_COMMIT_ID" + +if [ $checker -ne 15 ] +then + echo "" + echo "Syntax Error: missing option" + echo "" + usage + exit 1 +fi + +git config user.email "jenkins@openairinterface.org" +git config user.name "OAI Jenkins" + +git checkout -f $SOURCE_COMMIT_ID + +git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI" + +exit 0 + + diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh new file mode 100755 index 00000000000..7fa57f9a6a9 --- /dev/null +++ b/ci-scripts/reportBuildLocally.sh @@ -0,0 +1,558 @@ +#!/bin/bash + +function usage { + echo "OAI Local Build Report script" + echo " Original Author: Raphael Defosseux" + echo "" + echo "Usage:" + echo "------" + echo "" + echo " reportBuildLocally.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" + echo "Job Options:" + echo "------------" + echo "" + echo " --git-url #### OR -gu ####" + echo " Specify the URL of the GIT Repository." + echo "" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" + echo " --trigger merge-request OR -mr" + echo " --trigger push OR -pu" + echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event." + echo "" + echo "Merge-Request Options:" + echo "----------------------" + echo "" + echo " --src-branch #### OR -sb ####" + echo " Specify the source branch of the merge request." + echo "" + echo " --src-commit #### OR -sc ####" + echo " Specify the source commit ID (SHA-1) of the merge request." + echo "" + echo " --target-branch #### OR -tb ####" + echo " Specify the target branch of the merge request (usually develop)." + echo "" + echo " --target-commit #### OR -tc ####" + echo " Specify the target commit ID (SHA-1) of the merge request." + echo "" + echo "Push Options:" + echo "----------------------" + echo "" + echo " --branch #### OR -br ####" + echo " Specify the branch of the push event." + echo "" + echo " --commit #### OR -co ####" + echo " Specify the commit ID (SHA-1) of the push event." + echo "" + echo "" +} + +function trigger_usage { + echo "OAI Local Build Report script" + echo " Original Author: Raphael Defosseux" + echo "" + echo " --trigger merge-request OR -mr" + echo " --trigger push OR -pu" + echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event." + echo "" +} + +function details_table { + echo " <h4>$1</h4>" >> $3 + + echo " <table border = \"1\">" >> $3 + echo " <tr bgcolor = \"#33CCFF\" >" >> $3 + echo " <th>File</th>" >> $3 + echo " <th>Line Number</th>" >> $3 + echo " <th>Status</th>" >> $3 + echo " <th>Message</th>" >> $3 + echo " </tr>" >> $3 + + LIST_MESSAGES=`egrep "error:|warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto"` + COMPLETE_MESSAGE="start" + for MESSAGE in $LIST_MESSAGES + do + if [[ $MESSAGE == *"/home/ubuntu/tmp"* ]] + then + FILENAME=`echo $MESSAGE | sed -e "s#^/home/ubuntu/tmp/##" | awk -F ":" '{print $1}'` + LINENB=`echo $MESSAGE | awk -F ":" '{print $2}'` + if [ "$COMPLETE_MESSAGE" != "start" ] + then + COMPLETE_MESSAGE=`echo $COMPLETE_MESSAGE | sed -e "s#‘#'#g" -e "s#’#'#g"` + echo " <td>$COMPLETE_MESSAGE</td>" >> $3 + echo " </tr>" >> $3 + fi + echo " <tr>" >> $3 + echo " <td>$FILENAME</td>" >> $3 + echo " <td>$LINENB</td>" >> $3 + else + if [[ $MESSAGE == *"warning:"* ]] || [[ $MESSAGE == *"error:"* ]] + then + MSGTYPE=`echo $MESSAGE | sed -e "s#:##g"` + echo " <td>$MSGTYPE</td>" >> $3 + COMPLETE_MESSAGE="" + else + COMPLETE_MESSAGE=$COMPLETE_MESSAGE" "$MESSAGE + fi + fi + done + + if [ "$COMPLETE_MESSAGE" != "start" ] + then + COMPLETE_MESSAGE=`echo $COMPLETE_MESSAGE | sed -e "s#‘#'#g" -e "s#’#'#g"` + echo " <td>$COMPLETE_MESSAGE</td>" >> $3 + echo " </tr>" >> $3 + fi + echo " </table>" >> $3 +} + +function summary_table_header { + echo " <h3>$1</h3>" >> ./build_results.html + echo " <table border = \"1\">" >> ./build_results.html + echo " <tr bgcolor = \"#33CCFF\" >" >> ./build_results.html + echo " <th>Element</th>" >> ./build_results.html + echo " <th>Status</th>" >> ./build_results.html + echo " <th>Nb Errors</th>" >> ./build_results.html + echo " <th>Nb Warnings</th>" >> ./build_results.html + echo " </tr>" >> ./build_results.html +} + +function summary_table_row { + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >$1</th>" >> ./build_results.html + if [ -f $2 ] + then + STATUS=`egrep -c "$3" $2` + if [ $STATUS -eq 1 ] + then + echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html + else + echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html + fi + NB_ERRORS=`egrep -c "error:" $2` + if [ $NB_ERRORS -eq 0 ] + then + echo " <td bgcolor = \"green\" >$NB_ERRORS</th>" >> ./build_results.html + else + echo " <td bgcolor = \"red\" >$NB_ERRORS</th>" >> ./build_results.html + fi + NB_WARNINGS=`egrep "warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto" | egrep -c "warning:"` + if [ $NB_WARNINGS -eq 0 ] + then + echo " <td bgcolor = \"green\" >$NB_WARNINGS</th>" >> ./build_results.html + else + if [ $NB_WARNINGS -gt 20 ] + then + echo " <td bgcolor = \"red\" >$NB_WARNINGS</th>" >> ./build_results.html + else + echo " <td bgcolor = \"orange\" >$NB_WARNINGS</th>" >> ./build_results.html + fi + fi + if [ $NB_ERRORS -ne 0 ] || [ $NB_WARNINGS -ne 0 ] + then + details_table "$1" $2 $4 + fi + else + echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html + echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html + echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html + fi + echo " </tr>" >> ./build_results.html +} + +function summary_table_footer { + echo " </table>" >> ./build_results.html +} + +function sca_summary_table_header { + echo " <h3>$1</h3>" >> ./build_results.html + echo " <table border = \"1\">" >> ./build_results.html + echo " <tr bgcolor = \"#33CCFF\" >" >> ./build_results.html + echo " <th>Error / Warning Type</th>" >> ./build_results.html + echo " <th>Nb Errors</th>" >> ./build_results.html + echo " <th>Nb Warnings</th>" >> ./build_results.html + echo " </tr>" >> ./build_results.html + echo "0" > ccp_error_cnt.txt +} + +function sca_summary_table_row { + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >$2</td>" >> ./build_results.html + if [ -f $1 ] + then + NB_ERRORS=`egrep "severity=\"error\"" $1 | egrep -c "id=\"$3\""` + echo " <td>$NB_ERRORS</td>" >> ./build_results.html + echo " <td>N/A</td>" >> ./build_results.html + if [ -f ccp_error_cnt.txt ] + then + TOTAL_ERRORS=`cat ccp_error_cnt.txt` + TOTAL_ERRORS=$((TOTAL_ERRORS + NB_ERRORS)) + echo $TOTAL_ERRORS > ccp_error_cnt.txt + fi + else + echo " <td>Unknown</td>" >> ./build_results.html + echo " <td>Unknown</td>" >> ./build_results.html + fi + echo " </tr>" >> ./build_results.html +} + +function sca_summary_table_footer { + if [ -f $1 ] + then + NB_ERRORS=`egrep -c "severity=\"error\"" $1` + NB_WARNINGS=`egrep -c "severity=\"warning\"" $1` + if [ -f ccp_error_cnt.txt ] + then + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Others</td>" >> ./build_results.html + TOTAL_ERRORS=`cat ccp_error_cnt.txt` + TOTAL_ERRORS=$((NB_ERRORS - TOTAL_ERRORS)) + echo " <td>$TOTAL_ERRORS</td>" >> ./build_results.html + echo " <td>$NB_WARNINGS</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html + rm -f ccp_error_cnt.txt + fi + echo " <tr bgcolor = \"#33CCFF\" >" >> ./build_results.html + echo " <th>Total</th>" >> ./build_results.html + echo " <th>$NB_ERRORS</th>" >> ./build_results.html + echo " <th>$NB_WARNINGS</th>" >> ./build_results.html + else + echo " <tr bgcolor = \"#33CCFF\" >" >> ./build_results.html + echo " <th>Total</th>" >> ./build_results.html + echo " <th>Unknown</th>" >> ./build_results.html + echo " <th>Unknown</th>" >> ./build_results.html + fi + echo " </tr>" >> ./build_results.html + echo " </table>" >> ./build_results.html + echo " <p>Full details in zipped artifact (cppcheck/cppcheck.xml) </p>" >> ./build_results.html + echo " <p>Graphical Interface tool : <code>cppcheck-gui -l cppcheck/cppcheck.xml</code> </p>" >> ./build_results.html +} + +jb_checker=0 +mr_checker=0 +pu_checker=0 +MR_TRIG=0 +PU_TRIG=0 +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -gu|--git-url) + GIT_URL="$2" + let "jb_checker|=0x1" + shift + shift + ;; + -jn|--job-name) + JOB_NAME="$2" + let "jb_checker|=0x2" + shift + shift + ;; + -id|--build-id) + BUILD_ID="$2" + let "jb_checker|=0x4" + shift + shift + ;; + --trigger) + TRIG="$2" + case $TRIG in + merge-request) + MR_TRIG=1 + ;; + push) + PU_TRIG=1 + ;; + *) + echo "" + echo "Syntax Error: Invalid Trigger option -> $TRIG" + echo "" + trigger_usage + exit + ;; + esac + let "jb_checker|=0x8" + shift + shift + ;; + -mr) + MR_TRIG=1 + let "jb_checker|=0x8" + shift + ;; + -pu) + PU_TRIG=1 + let "jb_checker|=0x8" + shift + ;; + -sb|--src-branch) + SOURCE_BRANCH="$2" + let "mr_checker|=0x1" + shift + shift + ;; + -sc|--src-commit) + SOURCE_COMMIT_ID="$2" + let "mr_checker|=0x2" + shift + shift + ;; + -tb|--target-branch) + TARGET_BRANCH="$2" + let "mr_checker|=0x4" + shift + shift + ;; + -tc|--target-commit) + TARGET_COMMIT_ID="$2" + let "mr_checker|=0x8" + shift + shift + ;; + -br|--branch) + SOURCE_BRANCH="$2" + let "pu_checker|=0x1" + shift + shift + ;; + -co|--commit) + SOURCE_COMMIT_ID="$2" + let "pu_checker|=0x2" + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 + ;; +esac + +done + +if [ $jb_checker -ne 15 ] +then + echo "" + echo "Syntax Error: missing job information." + # TODO : list missing info + echo "" + exit 1 +fi + +if [ $PU_TRIG -eq 1 ] && [ $MR_TRIG -eq 1 ] +then + echo "" + echo "Syntax Error: trigger action incoherent." + echo "" + trigger_usage + exit 1 +fi + +if [ $PU_TRIG -eq 1 ] +then + if [ $pu_checker -ne 3 ] + then + echo "" + echo "Syntax Error: missing push information." + # TODO : list missing info + echo "" + exit 1 + fi +fi + +if [ $MR_TRIG -eq 1 ] +then + if [ $mr_checker -ne 15 ] + then + echo "" + echo "Syntax Error: missing merge-request information." + # TODO : list missing info + echo "" + exit 1 + fi +fi + +echo "<!DOCTYPE html>" > ./build_results.html +echo "<html class=\"no-js\" lang=\"en-US\">" >> ./build_results.html +echo "<head>" >> ./build_results.html +echo " <title>Build Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./build_results.html +echo " <base href = \"http://www.openairinterface.org/\" />" >> ./build_results.html +echo "</head>" >> ./build_results.html +echo "<body>" >> ./build_results.html +echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html +echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html +echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html +echo " <a href=\"http://www.openairinterface.org/\">" >> ./build_results.html +echo " <img src=\"/wp-content/uploads/2016/03/cropped-oai_final_logo2.png\" alt=\"\" border=\"none\" height=50 width=150>" >> ./build_results.html +echo " </img>" >> ./build_results.html +echo " </a>" >> ./build_results.html +echo " </td>" >> ./build_results.html +echo " <td style=\"border-collapse: collapse; border: none; vertical-align: center;\">" >> ./build_results.html +echo " <b><font size = \"6\">Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</font></b>" >> ./build_results.html +echo " </td>" >> ./build_results.html +echo " </tr>" >> ./build_results.html +echo " </table>" >> ./build_results.html +echo " <br>" >> ./build_results.html +echo " <table border = \"1\">" >> ./build_results.html +echo " <tr>" >> ./build_results.html +echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./build_results.html +echo " <td>$GIT_URL</td>" >> ./build_results.html +echo " </tr>" >> ./build_results.html +echo " <tr>" >> ./build_results.html +echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./build_results.html +if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./build_results.html; fi +if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./build_results.html; fi +echo " </tr>" >> ./build_results.html +if [ $PU_TRIG -eq 1 ] +then + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./build_results.html + echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./build_results.html + echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html +fi +if [ $MR_TRIG -eq 1 ] +then + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./build_results.html + echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./build_results.html + echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./build_results.html + echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./build_results.html + echo " <td>$TARGET_COMMIT_ID</td>" >> ./build_results.html + echo " </tr>" >> ./build_results.html +fi +echo " </table>" >> ./build_results.html +echo " <h2>Build Summary</h2>" >> ./build_results.html + +if [ -f ./oai_rules_result.txt ] +then + echo " <h3>OAI Coding / Formatting Guidelines Check</h3>" >> ./build_results.html + echo " <table border = "1">" >> ./build_results.html + echo " <tr>" >> ./build_results.html + echo " <td bgcolor = \"lightcyan\" >Result:</td>" >> ./build_results.html + NB_FILES=`cat ./oai_rules_result.txt` + if [ $NB_FILES = "0" ] + then + if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi + if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi + else + if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi + if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi + fi + echo " </tr>" >> ./build_results.html + echo " </table>" >> ./build_results.html +fi + +sca_summary_table_header "OAI Static Code Analysis with CPPCHECK" +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds +sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder +sca_summary_table_footer ./archives/cppcheck/cppcheck.xml + +summary_table_header "OAI Build eNB -- USRP option" +summary_table_row "LTE SoftModem - Release 14" ./archives/enb_usrp/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_row1.html +summary_table_row "Coding - Release 14" ./archives/enb_usrp/coding.Rel14.txt "Built target coding" ./enb_usrp_row2.html +summary_table_row "OAI USRP device if - Release 14" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html +summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_row4.html +summary_table_footer + +if [ -f ./archives/basic_sim/basic_simulator_enb.txt ] +then + summary_table_header "OAI Build basic simulator option" + summary_table_row "Basic Simulator eNb - Release 14" ./archives/basic_sim/basic_simulator_enb.txt "Built target lte-softmodem" ./basic_sim_row1.html + summary_table_row "Basic Simulator UE - Release 14" ./archives/basic_sim/basic_simulator_ue.txt "Built target lte-uesoftmodem" ./basic_sim_row2.html + summary_table_row "Conf 2 UE data - Release 14" ./archives/basic_sim/conf2uedata.Rel14.txt "Built target conf2uedata" ./basic_sim_row3.html + summary_table_footer +fi + +summary_table_header "OAI Build Physical simulators option" +summary_table_row "DL Simulator - Release 14" ./archives/phy_sim/dlsim.Rel14.txt "Built target dlsim" ./phy_sim_row1.html +summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt "Built target ulsim" ./phy_sim_row2.html +summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html +summary_table_footer + +if [ -f archives/gnb_usrp/nr-softmodem.Rel14.txt ] +then + summary_table_header "OAI Build gNB -- USRP option" + summary_table_row "LTE SoftModem - Release 15" ./archives/gnb_usrp/nr-softmodem.Rel14.txt "Built target nr-softmodem" ./gnb_usrp_row1.html + summary_table_row "Coding - Release 14" ./archives/gnb_usrp/coding.Rel14.txt "Built target coding" ./gnb_usrp_row2.html + summary_table_row "OAI USRP device if - Release 14" ./archives/gnb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/gnb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./gnb_usrp_row4.html + summary_table_footer +fi + +if [ -f archives/nrue_usrp/nr-uesoftmodem.Rel14.txt ] +then + summary_table_header "OAI Build 5G NR UE -- USRP option" + summary_table_row "UE SoftModem - Release 15" ./archives/nrue_usrp/nr-uesoftmodem.Rel14.txt "Built target nr-uesoftmodem" ./nrue_usrp_row1.html + summary_table_row "Coding - Release 14" ./archives/nrue_usrp/coding.Rel14.txt "Built target coding" ./nrue_usrp_row2.html + summary_table_row "OAI USRP device if - Release 14" ./archives/nrue_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./nrue_usrp_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/nrue_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./nrue_usrp_row4.html + summary_table_footer +fi + +echo " <h3>Details</h3>" >> ./build_results.html + +for DETAILS_TABLE in `ls ./enb_usrp_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +for DETAILS_TABLE in `ls ./basic_sim_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +for DETAILS_TABLE in `ls ./phy_sim_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +for DETAILS_TABLE in `ls ./gnb_usrp_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +for DETAILS_TABLE in `ls ./nrue_usrp_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html ./gnb_usrp_row*.html ./nrue_usrp_row*.html + +echo "</body>" >> ./build_results.html +echo "</html>" >> ./build_results.html + +exit 0 diff --git a/ci-scripts/template-host.xml b/ci-scripts/template-host.xml new file mode 100644 index 00000000000..efd9912c7ad --- /dev/null +++ b/ci-scripts/template-host.xml @@ -0,0 +1,27 @@ +<domain type='kvm'> + <os> + <type>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='host-passthrough'> + </cpu> + <devices> + <interface type='network'> + <source network='default'/> + <model type='virtio'/> + </interface> + <serial type='pty'> + <source path='/dev/pts/3'/> + <target port='0'/> + </serial> + <graphics type='vnc' autoport='yes' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1'/> + </graphics> + <video/> + </devices> +</domain> -- GitLab