Commit 70e9b3ef authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'develop-ci' into 'develop'

CI: stability improvement

See merge request oai/openairinterface5g!337
parents e63ff571 c3d1aac9
...@@ -45,6 +45,12 @@ pipeline { ...@@ -45,6 +45,12 @@ pipeline {
} }
} }
} }
post {
failure {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
addGitLabMRComment comment: message
}
}
} }
stage ("Start VM -- cppcheck") { stage ("Start VM -- cppcheck") {
...@@ -176,6 +182,7 @@ pipeline { ...@@ -176,6 +182,7 @@ pipeline {
if(fileExists('archives/vm_tests_logs.zip')) { if(fileExists('archives/vm_tests_logs.zip')) {
archiveArtifacts artifacts: 'archives/vm_tests_logs.zip' archiveArtifacts artifacts: 'archives/vm_tests_logs.zip'
archiveArtifacts artifacts: 'archives/*/test/results_autotests*.xml' archiveArtifacts artifacts: 'archives/*/test/results_autotests*.xml'
archiveArtifacts artifacts: 'archives/*/test/*.xsl'
} }
} }
} }
......
...@@ -104,6 +104,10 @@ git checkout -f $SOURCE_COMMIT_ID ...@@ -104,6 +104,10 @@ git checkout -f $SOURCE_COMMIT_ID
git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI" git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI"
exit 0 STATUS=`git status | egrep -c "You have unmerged paths.|fix conflicts"`
if [ $STATUS -ne 0 ]
then
echo "There are merge conflicts.. Cannot perform further build tasks"
STATUS=-1
fi
exit $STATUS
...@@ -231,7 +231,12 @@ else ...@@ -231,7 +231,12 @@ else
then then
FUNCTION=`echo $VM_NAME | sed -e "s@$VM_TEMPLATE@@"` FUNCTION=`echo $VM_NAME | sed -e "s@$VM_TEMPLATE@@"`
NEW_NAME=`echo "results_autotests.xml" | sed -e "s@results_autotests@results_autotests-$FUNCTION@"` NEW_NAME=`echo "results_autotests.xml" | sed -e "s@results_autotests@results_autotests-$FUNCTION@"`
mv results_autotests.xml $NEW_NAME echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $NEW_NAME
echo "<?xml-stylesheet type=\"text/xsl\" href=\"$FUNCTION.xsl\" ?>" >> $NEW_NAME
cat results_autotests.xml >> $NEW_NAME
sed -e "s@TEMPLATE@$FUNCTION@" $JENKINS_WKSP/ci-scripts/template.xsl > $FUNCTION.xsl
#mv results_autotests.xml $NEW_NAME
rm results_autotests.xml
fi fi
popd popd
......
...@@ -175,10 +175,10 @@ function test_compile() { ...@@ -175,10 +175,10 @@ function test_compile() {
fi fi
if [ "$result" == "1" ]; then if [ "$result" == "1" ]; then
echo_success "$test_case_name.${tags} PASSED" echo_success "$test_case_name.${tags} PASSED"
xUnit_success "compilation" "$test_case_name.$tags" "PASS" "$result_string" "$xmlfile_testcase" xUnit_success "compilation" "$test_case_name.$tags" "PASS" "$result_string" "$xmlfile_testcase" ""
else else
echo_error "$test_case_name.${tags} FAILED" echo_error "$test_case_name.${tags} FAILED"
xUnit_fail "compilation" "$test_case_name.$tags" "FAIL" "$result_string" "$xmlfile_testcase" xUnit_fail "compilation" "$test_case_name.$tags" "FAIL" "$result_string" "$xmlfile_testcase" ""
fi fi
} }
...@@ -201,6 +201,7 @@ function test_compile() { ...@@ -201,6 +201,7 @@ function test_compile() {
#\param $15 => password for the user to run certain commands as sudo #\param $15 => password for the user to run certain commands as sudo
#\param $16 => test config file params to be modified #\param $16 => test config file params to be modified
#\param $17 => bypass flag if main_exec if available #\param $17 => bypass flag if main_exec if available
#\param $18 -> desc to help identify the test case for readability in output xml file
function test_compile_and_run() { function test_compile_and_run() {
xUnit_start xUnit_start
...@@ -223,6 +224,7 @@ function test_compile_and_run() { ...@@ -223,6 +224,7 @@ function test_compile_and_run() {
mypassword=${15} mypassword=${15}
test_config_file=${16} test_config_file=${16}
bypass_compile=${17} bypass_compile=${17}
desc=${18}
build_dir=$tdir/$1/build build_dir=$tdir/$1/build
#exec_file=$build_dir/$6 #exec_file=$build_dir/$6
...@@ -243,6 +245,7 @@ function test_compile_and_run() { ...@@ -243,6 +245,7 @@ function test_compile_and_run() {
#echo "pre_exec_file = $pre_exec_file" #echo "pre_exec_file = $pre_exec_file"
#echo "nruns = $nruns" #echo "nruns = $nruns"
echo "class = $class" echo "class = $class"
echo "desc = $desc"
#compile_prog_array=() #compile_prog_array=()
#read -a compile_prog_array <<<"$compile_prog" #read -a compile_prog_array <<<"$compile_prog"
...@@ -253,6 +256,8 @@ function test_compile_and_run() { ...@@ -253,6 +256,8 @@ function test_compile_and_run() {
tags_array=() tags_array=()
read -a tags_array <<<"$tags" read -a tags_array <<<"$tags"
desc_array=()
readarray -t desc_array <<<"$desc"
main_exec_args_array=() main_exec_args_array=()
readarray -t main_exec_args_array <<< "$exec_args" readarray -t main_exec_args_array <<< "$exec_args"
...@@ -298,6 +303,7 @@ function test_compile_and_run() { ...@@ -298,6 +303,7 @@ function test_compile_and_run() {
do do
global_result=1 global_result=1
result_string="" result_string=""
PROPER_DESC=`echo ${desc_array[$tags_array_index]} | sed -e "s@^.*lsim.*est case.*(Test@Test@" -e "s@^ *(@@" -e "s/),$//"`
for (( run_index=1; run_index <= $nruns; run_index++ )) for (( run_index=1; run_index <= $nruns; run_index++ ))
do do
...@@ -366,16 +372,16 @@ function test_compile_and_run() { ...@@ -366,16 +372,16 @@ function test_compile_and_run() {
if [ "$result_string" == "" ]; then if [ "$result_string" == "" ]; then
echo_error "execution $test_case_name.$compile_prog.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL" echo_error "execution $test_case_name.$compile_prog.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL"
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
else else
if [ "$global_result" == "0" ]; then if [ "$global_result" == "0" ]; then
echo_error "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL" echo_error "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL"
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
fi fi
if [ "$global_result" == "1" ]; then if [ "$global_result" == "1" ]; then
echo_success "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = PASS " echo_success "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = PASS "
xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase" xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
fi fi
fi fi
...@@ -573,10 +579,10 @@ for search_expr in "${test_case_array[@]}" ...@@ -573,10 +579,10 @@ for search_expr in "${test_case_array[@]}"
#echo "arg1 = ${search_array_true[0]}" #echo "arg1 = ${search_array_true[0]}"
#echo " arg2 = ${search_array_true[1]}" #echo " arg2 = ${search_array_true[1]}"
if [ "$class" == "compilation" ]; then if [ "$class" == "compilation" ]; then
test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$desc"
elif [ "$class" == "execution" ]; then elif [ "$class" == "execution" ]; then
echo \'passwd\' | $SUDO killall -q oaisim_nos1 echo \'passwd\' | $SUDO killall -q oaisim_nos1
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file" "$BYPASS_COMPILE" test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file" "$BYPASS_COMPILE" "$desc"
else else
echo "Unexpected class of test case...Skipping the test case $name ...." echo "Unexpected class of test case...Skipping the test case $name ...."
fi fi
......
...@@ -970,7 +970,7 @@ ...@@ -970,7 +970,7 @@
-m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O70 -m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O70
-m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O70 -m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O70
-m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O70</main_exec_args> -m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O70</main_exec_args>
<tags>dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.TM2_test1 dlsim.TM2_test1b</tags> <tags>dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.test11b dlsim.TM2_test1 dlsim.TM2_test1b dlsim.TM2_test1c</tags>
<search_expr_true>"passed"</search_expr_true> <search_expr_true>"passed"</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
<nruns>3</nruns> <nruns>3</nruns>
......
...@@ -271,8 +271,23 @@ check_install_usrp_uhd_driver(){ ...@@ -271,8 +271,23 @@ check_install_usrp_uhd_driver(){
$SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y || true $SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y || true
v=$(lsb_release -cs) v=$(lsb_release -cs)
$SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main" $SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
#The new USRP repository # The new USRP repository
$SUDO add-apt-repository ppa:ettusresearch/uhd -y # Raphael Defosseux: Adding a loop on adding PPA because in CI the gpg key retrieve may
# timeout due to proxy / network latencies in Eurecom on VM
echo_info "\nAdding PPA repository ettusresearch/uhd\n"
x=0
while [ $x -le 5 ]
do
if $SUDO add-apt-repository ppa:ettusresearch/uhd -y
then
echo_info "add-apt-repository successful\n"
break
else
echo_info "add-apt-repository failed, retrying...\n"
sleep 30
fi
x=$((x + 1))
done
$SUDO apt-get update $SUDO apt-get update
$SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev $SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host $SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host
......
...@@ -26,15 +26,17 @@ xUnit_start() { ...@@ -26,15 +26,17 @@ xUnit_start() {
# \param $3 testcase result # \param $3 testcase result
# \param $4 run result # \param $4 run result
# \param $5 XML file local to test case for storing its own results # \param $5 XML file local to test case for storing its own results
# \param $6 proper description
xUnit_fail() { xUnit_fail() {
class=$1 class=$1
test_case=$2 test_case=$2
result=$3 result=$3
run_result=$4 run_result=$4
xmlfile_testcase=$5 xmlfile_testcase=$5
desc=$6
currtime=$(date +%s.%N) currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l) time=$(echo "$currtime - $XUNIT_START" | bc -l)
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>" xml="<testcase classname='$class' name='$test_case' description='$desc' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
echo -e "$xml" >> "$xmlfile_testcase" echo -e "$xml" >> "$xmlfile_testcase"
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml" XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_FAILED=$((XUNIT_FAILED+1)) XUNIT_FAILED=$((XUNIT_FAILED+1))
...@@ -48,15 +50,17 @@ xUnit_fail() { ...@@ -48,15 +50,17 @@ xUnit_fail() {
# \param $3 testcase result # \param $3 testcase result
# \param $4 run result # \param $4 run result
# \param $5 XML file local to test case for storing its own results # \param $5 XML file local to test case for storing its own results
# \param $6 proper description
xUnit_success() { xUnit_success() {
class=$1 class=$1
test_case=$2 test_case=$2
result=$3 result=$3
run_result=$4 run_result=$4
xmlfile_testcase=$5 xmlfile_testcase=$5
desc=$6
currtime=$(date +%s.%N) currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l) time=$(echo "$currtime - $XUNIT_START" | bc -l)
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>" xml="<testcase classname='$class' name='$test_case' description='$desc' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
echo -e $xml >> $xmlfile_testcase echo -e $xml >> $xmlfile_testcase
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml" XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_SUCCESS=$((XUNIT_SUCCESS+1)) XUNIT_SUCCESS=$((XUNIT_SUCCESS+1))
......
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