diff options
Diffstat (limited to 'releng/org.eclipse.sirius.releng/gerrit-verify.sh')
-rw-r--r-- | releng/org.eclipse.sirius.releng/gerrit-verify.sh | 94 |
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 |