blob: 716899e3cebacea32d5f1a7a75bcd67664e6e58c [file] [log] [blame]
Neels Hofmeyrd46ea132017-04-08 15:56:31 +02001#!/bin/sh
2set -e -x
Neels Hofmeyr640c7762017-06-18 02:04:49 +02003base="$PWD"
Neels Hofmeyrd46ea132017-04-08 15:56:31 +02004
Pau Espin Pedrol3469b992017-10-17 15:25:40 +02005time_start="$(date '+%F %T')"
6
Neels Hofmeyrc59e0792017-05-14 01:57:25 +02007# remove older trial dirs and *-run.tgz, if any
8trial_dir_prefix="trial-"
9rm -rf "$trial_dir_prefix"* || true
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020010
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020011# Expecting *.tgz artifacts to be copied to this workspace from the various
12# jenkins-*.sh runs, via jenkins job configuration. Compose a trial dir:
13trial_dir="${trial_dir_prefix}$BUILD_NUMBER"
14mkdir -p "$trial_dir"
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020015
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020016mv *.tgz "$trial_dir"
17cat *.md5 >> "$trial_dir/checksums.md5"
18rm *.md5
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020019
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020020# OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging preferences from the
21# jenkins build job.
Neels Hofmeyrbcd43322017-05-14 15:21:48 +020022# On failure, first clean up below and then return the exit code.
23exit_code="1"
24if python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS ; then
25 exit_code="0"
26fi
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020027
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020028# no need to keep extracted binaries
29rm -rf "$trial_dir/inst" || true
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020030
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020031# tar up all results for archiving (optional)
Neels Hofmeyr640c7762017-06-18 02:04:49 +020032cd "$trial_dir"
Pau Espin Pedrol3469b992017-10-17 15:25:40 +020033journalctl -u ofono -o short-precise --since "${time_start}" > "$(readlink last_run)/ofono.log"
Neels Hofmeyr640c7762017-06-18 02:04:49 +020034tar czf "$base/${trial_dir}-run.tgz" "$(readlink last_run)"
35tar czf "$base/${trial_dir}-bin.tgz" *.md5 *.tgz
Neels Hofmeyrbcd43322017-05-14 15:21:48 +020036
37exit $exit_code