Change featuresBoot sed to be multi-line
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-controller-verify.sh
index d7b57d004a749e3df0ff05d06a913ccb23079bf7..64633893f58fba95a7a678c806daf1a2ccba741b 100644 (file)
@@ -8,14 +8,14 @@ echo "Clean workspace"
 rm -rf *
 
 echo "Downloading the distribution..."
-wget --no-verbose  ${ACTUALBUNDLEURL}
+wget --progress=dot:mega  ${ACTUALBUNDLEURL}
 
 echo "Extracting the new controller..."
 unzip -q ${BUNDLE}
 
 echo "Configuring the startup features..."
 FEATURESCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
-sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" ${FEATURESCONF}
+sed -ie "s/\(featuresBoot=\|featuresBoot =\)/featuresBoot = ${ACTUALFEATURES},/g" \${FEATURESCONF}
 sed -ie "s%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features,mvn:org.opendaylight.integration/features-integration-test/${BUNDLEVERSION}/xml/features%g" ${FEATURESCONF}
 cat ${FEATURESCONF}
 
@@ -30,14 +30,26 @@ sed -ie "s/2048m/${CONTROLLERMEM}/g" ${MEMCONF}
 cat ${MEMCONF}
 
 echo "Listing all open ports on controller system"
-netstat -natu
-
-echo "redirected karaf console output to karaf_console.log"
-export KARAF_REDIRECT=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log
-
-echo "JDK Version ..."
+netstat -pnatu
+
+if [ ${JDKVERSION} == 'openjdk8' ]; then
+    echo "Setting the JRE Version to 8"
+    # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
+    # sudo /usr/sbin/alternatives --set java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.60-2.b27.el7_1.x86_64/jre/bin/java
+    export JAVA_HOME=/usr/lib/jvm/java-1.8.0
+elif [ ${JDKVERSION} == 'openjdk7' ]; then
+    echo "Setting the JRE Version to 7"
+    # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
+    # sudo /usr/sbin/alternatives --set java /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85-2.6.1.2.el7_1.x86_64/jre/bin/java
+    export JAVA_HOME=/usr/lib/jvm/java-1.7.0
+fi
+readlink -e "${JAVA_HOME}/bin/java"
+echo "Default JDK Version, JAVA_HOME should override"
 java -version
 
+echo "Redirecting karaf console output to karaf_console.log"
+export KARAF_REDIRECT="${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log"
+
 echo "Starting controller..."
 ${WORKSPACE}/${BUNDLEFOLDER}/bin/start
 
@@ -54,7 +66,7 @@ while true; do
         echo "Dumping Karaf log..."
         cat ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
         echo "Listing all open ports on controller system"
-        netstat -natu
+        netstat -pnatu
         exit 1
     else
         COUNT=$(( ${COUNT} + 5 ))
@@ -67,10 +79,11 @@ echo "loading many features at once.  Need to allow time for problems to show up
 sleep 300
 
 echo "Checking OSGi bundles..."
-sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
+# sshpass seems to fail with new karaf version
+# sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
 
 echo "Listing all open ports on controller system"
-netstat -natu
+netstat -pnatu
 
 function exit_on_log_file_message {
     echo "looking for \"$1\" in karaf.log file"
@@ -102,11 +115,23 @@ exit_on_log_file_message 'BindException: Address already in use'
 exit_on_log_file_message 'server is unhealthy'
 
 echo "Fetching Karaf logs"
+# TODO: Move instead of copy? Gzip?
 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log .
 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log .
 
 echo "Kill controller"
 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
 
-# vim: ts=4 sw=4 sts=4 et ft=sh :
+echo "Detecting misplaced config files"
+pushd "${WORKSPACE}/${BUNDLEFOLDER}"
+XMLS_FOUND=`echo *.xml`
+popd
+if [ "$XMLS_FOUND" != "*.xml" ]; then
+    echo "Bug 4628 confirmed."
+    ## TODO: Uncomment the following when ODL is fixed, to guard against regression.
+    # exit 1
+else
+    echo "Bug 4628 not detected."
+fi
 
+# vim: ts=4 sw=4 sts=4 et ft=sh :