Commit 519708b6 authored by Raphael Defosseux's avatar Raphael Defosseux

CI: optimization to build incrementally in time

    --- cherry-picked from develop-nr (d354eded)
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent cf1db866
...@@ -115,10 +115,10 @@ pipeline { ...@@ -115,10 +115,10 @@ pipeline {
} }
} }
stage ("Start VM -- cppcheck") { stage ("Start VM -- basic-sim") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
...@@ -126,39 +126,39 @@ pipeline { ...@@ -126,39 +126,39 @@ pipeline {
stage ("Start VM -- enb-usrp") { stage ("Start VM -- enb-usrp") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- basic-sim") { stage ("Start VM -- enb-ethernet") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- phy-sim") { stage ("Start VM -- ue-ethernet") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- enb-ethernet") { stage ("Start VM -- phy-sim") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- ue-ethernet") { stage ("Start VM -- cppcheck") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
...@@ -169,7 +169,7 @@ pipeline { ...@@ -169,7 +169,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Analysis with cppcheck") { gitlabCommitStatus(name: "Analysis with cppcheck") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -178,7 +178,7 @@ pipeline { ...@@ -178,7 +178,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build eNb-USRP") { gitlabCommitStatus(name: "Build eNb-USRP") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -187,7 +187,7 @@ pipeline { ...@@ -187,7 +187,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build basic-sim") { gitlabCommitStatus(name: "Build basic-sim") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
...@@ -196,7 +196,7 @@ pipeline { ...@@ -196,7 +196,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build phy-sim") { gitlabCommitStatus(name: "Build phy-sim") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
...@@ -205,7 +205,7 @@ pipeline { ...@@ -205,7 +205,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build eNb-ethernet") { gitlabCommitStatus(name: "Build eNb-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
...@@ -214,7 +214,7 @@ pipeline { ...@@ -214,7 +214,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build UE-ethernet") { gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
......
...@@ -55,6 +55,9 @@ function usage { ...@@ -55,6 +55,9 @@ function usage {
echo " --keep-vm-alive OR -k" echo " --keep-vm-alive OR -k"
echo " Keep the VM alive after the build." echo " Keep the VM alive after the build."
echo "" echo ""
echo " --daemon OR -D"
echo " Run as daemon"
echo ""
echo " --help OR -h" echo " --help OR -h"
echo " Print this help message." echo " Print this help message."
echo "" echo ""
...@@ -92,6 +95,7 @@ LOG_PATTERN=.Rel14.txt ...@@ -92,6 +95,7 @@ LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4 NB_PATTERN_FILES=4
BUILD_OPTIONS="--eNB -w USRP" BUILD_OPTIONS="--eNB -w USRP"
KEEP_VM_ALIVE=0 KEEP_VM_ALIVE=0
DAEMON=0
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
do do
...@@ -122,6 +126,10 @@ case $key in ...@@ -122,6 +126,10 @@ case $key in
KEEP_VM_ALIVE=1 KEEP_VM_ALIVE=1
shift shift
;; ;;
-D|--daemon)
DAEMON=1
shift
;;
-v1) -v1)
VM_NAME=ci-enb-usrp VM_NAME=ci-enb-usrp
ARCHIVES_LOC=enb_usrp ARCHIVES_LOC=enb_usrp
...@@ -297,13 +305,27 @@ echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS ...@@ -297,13 +305,27 @@ echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS
echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS
if [[ "$VM_NAME" == *"-cppcheck"* ]] if [[ "$VM_NAME" == *"-cppcheck"* ]]
then then
echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS if [ $DAEMON -eq 0 ]
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS then
echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS 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 daemon cppcheck \"" >> $VM_CMDS
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
echo "sudo apt-get --yes install zip daemon cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS
fi
else else
echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS if [ $DAEMON -eq 0 ]
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS then
echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS
else
echo "echo \"sudo apt-get --yes --quiet install zip daemon subversion libboost-dev \"" >> $VM_CMDS
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
echo "sudo apt-get --yes install zip daemon subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS
fi
fi fi
echo "mkdir tmp" >> $VM_CMDS echo "mkdir tmp" >> $VM_CMDS
echo "cd tmp" >> $VM_CMDS echo "cd tmp" >> $VM_CMDS
...@@ -314,17 +336,38 @@ then ...@@ -314,17 +336,38 @@ then
echo "mkdir cmake_targets/log" >> $VM_CMDS echo "mkdir cmake_targets/log" >> $VM_CMDS
echo "cp /home/ubuntu/zip-install.txt 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 "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 if [ $DAEMON -eq 0 ]
then
echo "cppcheck $BUILD_OPTIONS . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt" >> $VM_CMDS
else
echo "echo \"cppcheck $BUILD_OPTIONS .\" > ./my-vm-build.sh" >> $VM_CMDS
echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS
echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp -O /home/ubuntu/tmp/cmake_targets/log/cppcheck_build.txt -E /home/ubuntu/tmp/cmake_targets/log/cppcheck.xml ./my-vm-build.sh" >> $VM_CMDS
fi
else else
echo "echo \"source oaienv\"" >> $VM_CMDS echo "echo \"source oaienv\"" >> $VM_CMDS
echo "source oaienv" >> $VM_CMDS echo "source oaienv" >> $VM_CMDS
echo "cd cmake_targets/" >> $VM_CMDS echo "cd cmake_targets/" >> $VM_CMDS
echo "mkdir log" >> $VM_CMDS echo "mkdir log" >> $VM_CMDS
echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS
echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS if [ $DAEMON -eq 0 ]
echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS then
echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS
echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS
else
echo "echo \"./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS
echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS
echo "echo \"sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh\"" >> $VM_CMDS
echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh" >> $VM_CMDS
fi
fi fi
ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
if [ $DAEMON -eq 1 ]
then
rm -f $VM_CMDS
echo "STATUS is OK"
exit 0
fi
echo "############################################################" echo "############################################################"
echo "Creating a tmp folder to store results and artifacts" echo "Creating a tmp folder to store results and artifacts"
......
#!/bin/bash
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
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 " waitBuildOnVM.sh [OPTIONS]"
echo ""
echo "Options:"
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 " --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 enb-ethernet OR -v7"
echo " --variant ue-ethernet OR -v8"
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 enb-ethernet OR -v7"
echo " --variant ue-ethernet OR -v8"
echo ""
}
if [ $# -lt 1 ] || [ $# -gt 9 ]
then
echo "Syntax Error: not the correct number of arguments"
echo ""
usage
exit 1
fi
VM_TEMPLATE=ci-
JOB_NAME=XX
BUILD_ID=XX
VM_NAME=ci-enb-usrp
VM_MEMORY=2048
VM_CPU=4
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
;;
-jn|--job-name)
JOB_NAME="$2"
shift
shift
;;
-id|--build-id)
BUILD_ID="$2"
shift
shift
;;
-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 --mu"
shift
;;
-v2)
VM_NAME=ci-basic-sim
ARCHIVES_LOC=basic_sim
LOG_PATTERN=basic_simulator
NB_PATTERN_FILES=2
BUILD_OPTIONS="--basic-simulator"
VM_MEMORY=8192
VM_CPU=4
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
VM_MEMORY=4096
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
shift
;;
-v7)
VM_NAME=ci-enb-ethernet
ARCHIVES_LOC=enb_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=6
BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
shift
;;
-v8)
VM_NAME=ci-ue-ethernet
ARCHIVES_LOC=ue_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=6
BUILD_OPTIONS="--UE -t ETHERNET --noS1"
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 --mu"
;;
basic-sim)
VM_NAME=ci-basic-sim
ARCHIVES_LOC=basic_sim
LOG_PATTERN=basic_simulator
NB_PATTERN_FILES=2
BUILD_OPTIONS="--basic-simulator"
VM_MEMORY=8192
VM_CPU=4
;;
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
VM_MEMORY=4096
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
;;
enb-ethernet)
VM_NAME=ci-enb-ethernet
ARCHIVES_LOC=enb_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=6
BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
;;
ue-ethernet)
VM_NAME=ci-ue-ethernet
ARCHIVES_LOC=ue_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=6
BUILD_OPTIONS="--UE -t ETHERNET --noS1"
;;
*)
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
if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ]
then
VM_TEMPLATE=ci-
else
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
fi
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
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"
IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME`
if [ $IS_VM_ALIVE -eq 0 ]
then
echo "############################################################"
echo "You should have created the VM before doing anything"
echo "############################################################"
exit 1
fi
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 "Waiting build process to end on VM ($VM_NAME)"
echo "############################################################"
if [[ "$VM_NAME" == *"-cppcheck"* ]]
then
echo "echo \"ps -aux | grep cppcheck \"" >> $VM_CMDS
echo "while [ \$(ps -aux | grep --color=never cppcheck | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $VM_CMDS
else
echo "echo \"ps -aux | grep build \"" >> $VM_CMDS
echo "while [ \$(ps -aux | grep --color=never build_oai | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $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" == *"-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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment