Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | set -e -x |
Neels Hofmeyr | 640c776 | 2017-06-18 02:04:49 +0200 | [diff] [blame] | 3 | base="$PWD" |
Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 4 | |
Neels Hofmeyr | c59e079 | 2017-05-14 01:57:25 +0200 | [diff] [blame] | 5 | # remove older trial dirs and *-run.tgz, if any |
| 6 | trial_dir_prefix="trial-" |
| 7 | rm -rf "$trial_dir_prefix"* || true |
Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 8 | |
Neels Hofmeyr | c59e079 | 2017-05-14 01:57:25 +0200 | [diff] [blame] | 9 | # Expecting *.tgz artifacts to be copied to this workspace from the various |
| 10 | # jenkins-*.sh runs, via jenkins job configuration. Compose a trial dir: |
| 11 | trial_dir="${trial_dir_prefix}$BUILD_NUMBER" |
| 12 | mkdir -p "$trial_dir" |
Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 13 | |
Neels Hofmeyr | c59e079 | 2017-05-14 01:57:25 +0200 | [diff] [blame] | 14 | mv *.tgz "$trial_dir" |
| 15 | cat *.md5 >> "$trial_dir/checksums.md5" |
| 16 | rm *.md5 |
Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 17 | |
Neels Hofmeyr | c59e079 | 2017-05-14 01:57:25 +0200 | [diff] [blame] | 18 | # OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging preferences from the |
| 19 | # jenkins build job. |
Neels Hofmeyr | bcd4332 | 2017-05-14 15:21:48 +0200 | [diff] [blame] | 20 | # On failure, first clean up below and then return the exit code. |
| 21 | exit_code="1" |
| 22 | if python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS ; then |
| 23 | exit_code="0" |
| 24 | fi |
Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 25 | |
Neels Hofmeyr | c59e079 | 2017-05-14 01:57:25 +0200 | [diff] [blame] | 26 | # no need to keep extracted binaries |
| 27 | rm -rf "$trial_dir/inst" || true |
Neels Hofmeyr | d46ea13 | 2017-04-08 15:56:31 +0200 | [diff] [blame] | 28 | |
Neels Hofmeyr | c59e079 | 2017-05-14 01:57:25 +0200 | [diff] [blame] | 29 | # tar up all results for archiving (optional) |
Neels Hofmeyr | 640c776 | 2017-06-18 02:04:49 +0200 | [diff] [blame] | 30 | cd "$trial_dir" |
| 31 | tar czf "$base/${trial_dir}-run.tgz" "$(readlink last_run)" |
| 32 | tar czf "$base/${trial_dir}-bin.tgz" *.md5 *.tgz |
Neels Hofmeyr | bcd4332 | 2017-05-14 15:21:48 +0200 | [diff] [blame] | 33 | |
| 34 | exit $exit_code |