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