blob: 8c24385c7016762d83d85c958ab3d2ea7e9b12e1 [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
Neels Hofmeyrc59e0792017-05-14 01:57:25 +02005# remove older trial dirs and *-run.tgz, if any
6trial_dir_prefix="trial-"
7rm -rf "$trial_dir_prefix"* || true
Neels Hofmeyrd46ea132017-04-08 15:56:31 +02008
Neels Hofmeyrc59e0792017-05-14 01:57:25 +02009# Expecting *.tgz artifacts to be copied to this workspace from the various
10# jenkins-*.sh runs, via jenkins job configuration. Compose a trial dir:
11trial_dir="${trial_dir_prefix}$BUILD_NUMBER"
12mkdir -p "$trial_dir"
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020013
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020014mv *.tgz "$trial_dir"
15cat *.md5 >> "$trial_dir/checksums.md5"
16rm *.md5
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020017
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020018# OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging preferences from the
19# jenkins build job.
Neels Hofmeyrbcd43322017-05-14 15:21:48 +020020# On failure, first clean up below and then return the exit code.
21exit_code="1"
22if python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS ; then
23 exit_code="0"
24fi
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020025
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020026# no need to keep extracted binaries
27rm -rf "$trial_dir/inst" || true
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020028
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020029# tar up all results for archiving (optional)
Neels Hofmeyr640c7762017-06-18 02:04:49 +020030cd "$trial_dir"
31tar czf "$base/${trial_dir}-run.tgz" "$(readlink last_run)"
32tar czf "$base/${trial_dir}-bin.tgz" *.md5 *.tgz
Neels Hofmeyrbcd43322017-05-14 15:21:48 +020033
34exit $exit_code