From 6606b2708c4f85d5b6d26531060b4f907977dd18 Mon Sep 17 00:00:00 2001
From: Nils Christian Ehmke <nie@informatik.uni-kiel.de>
Date: Tue, 29 Jul 2014 15:07:07 +0200
Subject: [PATCH] CI

---
 continuous-integration/README                 | 13 +++++++
 .../executeRemoteMicroBenchmark.sh            | 35 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 continuous-integration/README
 create mode 100644 continuous-integration/executeRemoteMicroBenchmark.sh

diff --git a/continuous-integration/README b/continuous-integration/README
new file mode 100644
index 0000000..c8a38b2
--- /dev/null
+++ b/continuous-integration/README
@@ -0,0 +1,13 @@
+MooBench  http://kieker-monitoring.net/MooBench
+
+-----------------------------------------------
+
+This folder contains an example script showing how to include MooBench into continuous integration.
+
+The script copies a pre-compiled version of MooBench and the jar file to be benchmarked to a given remote server. It executes MooBench and retrieves the results. These results can, for instance, be visualized in the web application of the continuous integration server.
+
+-----------------------------------------------
+
+The remote server should be provided with Java (>= 1.6) and R (> 3.0). We recommend to use SSH keys for the access.
+
+The client server should contain a prepared folder with a pre-compiled version of MooBench, as created by the build script.
\ No newline at end of file
diff --git a/continuous-integration/executeRemoteMicroBenchmark.sh b/continuous-integration/executeRemoteMicroBenchmark.sh
new file mode 100644
index 0000000..c819b08
--- /dev/null
+++ b/continuous-integration/executeRemoteMicroBenchmark.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# The following constant specifies user name and address of the remote node executing the benchmark.
+# We recommend to use SSH keys for the access and to install Java (>= 1.6) and R (> 3.0) on the remote node.
+REMOTE_NODE=jenkins@blade1
+
+# The following constant specifies location and name of the benchmarked jar file relative to the workspace. 
+BENCHMARKED_JAR=dist/kieker-1.10-SNAPSHOT_aspectj.jar 
+
+# The following constants specify location and name of the MooBench folder
+MOOBENCH_FOLDER=examples/OverheadEvaluationMicrobenchmark/MooBench
+
+# The following constant specifies the name of the folder containing the results from MooBench
+RESULTS_FOLDER_NAME=results-kieker
+
+# This constant specifies the target file for the results
+RESULTS_TARGET_FILE=plot.csv
+
+
+# Copy the benchmarked file and MooBench to the remote node
+scp -r ${MOOBENCH_FOLDER} ${REMOTE_NODE}:MooBench
+scp ${BENCHMARKED_JAR} ${REMOTE_NODE}:MooBench/lib
+
+# Execute MooBench
+ssh ${REMOTE_NODE} 'cd MooBench; chmod +x benchmark.sh; ./benchmark.sh; exit'
+
+# Copy results to workspace
+scp ${REMOTE_NODE}:MooBench/tmp/${RESULTS_FOLDER_NAME}/results-text.csv ${RESULTS_TARGET_FILE}
+
+# Save up to 100 results from previous benchmarks on the remote node and clean up
+ssh ${REMOTE_NODE} "cp MooBench/tmp/${RESULTS_FOLDER_NAME}/results.zip old-results --backup=t; exit"
+ssh ${REMOTE_NODE} "cd old-results; ls -A1t | sed -e '1,100d' | xargs -d '\n' rm; exit"
+ssh ${REMOTE_NODE} 'mv old-results /tmp/; exit'
+ssh ${REMOTE_NODE} 'rm -rf MooBench; exit'
+ssh ${REMOTE_NODE} 'mv /tmp/old-results .; exit'
\ No newline at end of file
-- 
GitLab