Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2015-01-12 10:00:25 +0000
committerPierre-Charles David2015-01-12 10:10:28 +0000
commit316caca4f5306acf52bdd8560062f094eecf1973 (patch)
treef23e10fd95a7ebfe5454b758b07bbb376442ec19 /releng/org.eclipse.sirius.releng
parent49bd903d35269da14242fbe793c67b4c9df6f05b (diff)
downloadorg.eclipse.sirius-316caca4f5306acf52bdd8560062f094eecf1973.tar.gz
org.eclipse.sirius-316caca4f5306acf52bdd8560062f094eecf1973.tar.xz
org.eclipse.sirius-316caca4f5306acf52bdd8560062f094eecf1973.zip
[454902] Add the script used for Gerrit verification
This is the script executed by the Gerrit verification job. It handles the various combinations of branches, target platform, and test suite to execute. The Gerrit job itself fetches the latest version of this from the master branch and then executes it, so the script on master must be able to handle all the branches. Bug: 454902 Change-Id: I57650c4611429e62f24b7347797432e50f430e37 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Diffstat (limited to 'releng/org.eclipse.sirius.releng')
-rw-r--r--releng/org.eclipse.sirius.releng/gerrit-verify.sh94
1 files changed, 94 insertions, 0 deletions
diff --git a/releng/org.eclipse.sirius.releng/gerrit-verify.sh b/releng/org.eclipse.sirius.releng/gerrit-verify.sh
new file mode 100644
index 0000000000..20f888470e
--- /dev/null
+++ b/releng/org.eclipse.sirius.releng/gerrit-verify.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+# ====================================================================
+# Copyright (c) 2015 Obeo
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Obeo - initial API and implementation
+# ====================================================================
+
+
+# Make sure the Xvnc server is completely started by looking for its output in the current job's console
+wait_for_xvnc() {
+ local readonly message="Listening for VNC connections on TCP port"
+ local readonly logFileURL="https://hudson.eclipse.org/sirius/job/sirius.gerrit/$BUILD_NUMBER/PLATFORM=$PLATFORM,SUITE=$SUITE/consoleText"
+
+ sleep 10
+
+ local attempt=1
+ while ! ( curl -s "$logFileURL" | grep -q " $message " ); do
+ sleep 5
+ if [ "$attempt" -gt "4" ]; then
+ echo "Xvnc not ready; abandonning."
+ exit 1
+ else
+ attempt=$(( attempt + 1 ))
+ fi
+ done
+}
+
+# Make sure we have a properly configured window manager for SWTbot tests
+start_window_manager() {
+ /usr/bin/metacity --display="$DISPLAY" --replace --sm-disable &
+ export WM_PID="$!"
+ sleep 1
+ /usr/bin/metacity-message disable-keybindings
+}
+
+kill_window_manager() {
+ if ps --pid "$WM_PID" -o pid,args | grep -q metacity ; then
+ kill "$WM_PID"
+ fi
+}
+
+# Create a well-formed but empty test report so that tests result
+# publication does not fail even in the matrix cells where we do not
+# actually run any tests.
+create_dummy_test_report() {
+ local readonly REPORT_DIR="$WORKSPACE/plugins/org.eclipse.sirius.tests.junit/target/surefire-reports"
+ local readonly REPORT='<?xml version="1.0" encoding="UTF-8"?><testrun name="Sirius Dummy Test Suite" project="org.eclipse.sirius.tests.unit" tests="1" started="0" failures="0" errors="0" ignored="1"><testsuite name="Sirius Dummy Tests" time="0.001"><testcase name="testNothingJustToMakeHudsonHappy" classname="org.eclipse.sirius.tests.unit.DummyTest" time="0.01"/></testsuite></testrun>'
+ mkdir -p "$REPORT_DIR"
+ echo "$REPORT" > "$REPORT_DIR/empty-test-results.xml"
+}
+
+# Adjust the target platform used to build/execute the tests to consume the local version of the core we just built
+adjust_tests_target_platform() {
+ if [ "$GERRIT_BRANCH" = "master" ]; then
+ export STREAM="latest"
+ else
+ export STREAM=$(echo "$GERRIT_BRANCH" | sed -e 's/v//')
+ fi
+ sed -i -e "s!http://download.eclipse.org/sirius/updates/nightly/$STREAM/$PLATFORM!file://$WORKSPACE/packaging/org.eclipse.sirius.update/target/repository!" "releng/org.eclipse.sirius.targets/sirius_tests_$PLATFORM.target"
+}
+
+invoke_maven() {
+ /shared/common/apache-maven-latest/bin/mvn -V -B -DBUILD_SIGN=false -Dmaven.repo.local="$WORKSPACE/.maven/repo" -DPLATFORM="$PLATFORM" -Dplatform-version-name="$PLATFORM" "$@"
+}
+
+readonly REFERENCE_PLATFORM="luna"
+if [ "$PLATFORM" = "$REFERENCE_PLATFORM" -o "$SUITE" = "gerrit-junit" ]; then
+ wait_for_xvnc
+ start_window_manager
+
+ # Build Sirius core
+ invoke_maven -f packaging/org.eclipse.sirius.parent/pom.xml clean package
+
+ # Build the tests, and run them on the reference platform
+ if [ "$GERRIT_BRANCH" = "master" -a "$PLATFORM" = "$REFERENCE_PLATFORM" ]; then
+ # Build and run Sirius tests
+ adjust_tests_target_platform
+ invoke_maven -f packaging/org.eclipse.sirius.tests.parent/pom.xml -P"$SUITE" clean integration-test
+ else
+ # Build Sirius tests but do not execute them
+ adjust_tests_target_platform
+ invoke_maven -f packaging/org.eclipse.sirius.tests.parent/pom.xml clean package
+ create_dummy_test_report
+ fi
+
+ kill_window_manager
+else
+ create_dummy_test_report
+fi

Back to the top