From 5df3d10dd6c6c4d8092369170932c420aceb25ed Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Wed, 20 Jun 2018 10:47:28 +0200
Subject: [PATCH] CI: Fixes on the VM-based Jenkins scripts  -- quieter zip of
 the repository  -- remove clock skew and flexran.proto in the warning count 
 -- increase to 4 CPU on VM  -- created a new template to use host cpu
 properties (resolve AXV2 compilation issue)

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/Jenkinsfile-gitlab    |  4 ++--
 ci-scripts/buildOnVM.sh          |  2 +-
 ci-scripts/reportBuildLocally.sh | 14 +++++++-------
 ci-scripts/template-host.xml     | 27 +++++++++++++++++++++++++++
 4 files changed, 37 insertions(+), 10 deletions(-)
 create mode 100644 ci-scripts/template-host.xml

diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab
index 2205e46fe3..0c3fb6bcb9 100644
--- a/ci-scripts/Jenkinsfile-gitlab
+++ b/ci-scripts/Jenkinsfile-gitlab
@@ -21,7 +21,7 @@ pipeline {
                         // 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 localZip.zip ."
+                        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
@@ -38,7 +38,7 @@ pipeline {
                         echo "Git Branch      is ${GIT_BRANCH}"
                         echo "Git Commit      is ${GIT_COMMIT}"
 
-                        sh "zip -r localZip.zip ."
+                        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"
diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh
index 082ff11f81..ac8b274db9 100755
--- a/ci-scripts/buildOnVM.sh
+++ b/ci-scripts/buildOnVM.sh
@@ -146,7 +146,7 @@ echo "BUILD_EXTRA_OPTIONS = $BUILD_EXTRA_OPTIONS"
 echo "############################################################"
 echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
 echo "############################################################"
-uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 2
+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
 
diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh
index d3dd1f52a0..55e1754593 100755
--- a/ci-scripts/reportBuildLocally.sh
+++ b/ci-scripts/reportBuildLocally.sh
@@ -315,7 +315,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/enb_usrp/lte-softmodem.Rel14.txt`
+    STATUS=`egrep "warning:" ./archives/enb_usrp/lte-softmodem.Rel14.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
@@ -346,7 +346,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/enb_usrp/coding.Rel14.txt`
+    STATUS=`egrep "warning:" ./archives/enb_usrp/coding.Rel14.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
@@ -377,7 +377,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt`
+    STATUS=`egrep "warning:" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
@@ -408,7 +408,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/enb_usrp/params_libconfig.Rel14.txt`
+    STATUS=`egrep "warning:" ./archives/enb_usrp/params_libconfig.Rel14.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
@@ -452,7 +452,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/basic_sim/basic_simulator_enb.txt`
+    STATUS=`egrep "warning:" ./archives/basic_sim/basic_simulator_enb.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
@@ -483,7 +483,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/basic_sim/basic_simulator_ue.txt`
+    STATUS=`egrep "warning:" ./archives/basic_sim/basic_simulator_ue.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
@@ -514,7 +514,7 @@ then
     else
         echo "        <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
     fi
-    STATUS=`egrep -c "warning:" ./archives/basic_sim/conf2uedata.Rel14.txt`
+    STATUS=`egrep "warning:" ./archives/basic_sim/conf2uedata.Rel14.txt | egrep -v "Clock skew detected.|flexran.proto" | egrep -c "warning:"`
     if [ $STATUS -eq 0 ]
     then
         echo "        <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
diff --git a/ci-scripts/template-host.xml b/ci-scripts/template-host.xml
new file mode 100644
index 0000000000..efd9912c7a
--- /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