blob: c7446065663c7e50a2a00c7b8685e4ffe198ef0c [file] [log] [blame]
Pau Espin Pedrolbc1ed882018-05-17 16:59:58 +02001#!/bin/sh
2set -e -x
3base="$PWD"
4
5time_start="$(date '+%F %T')"
6
7prepare_docker() {
8 OLDPWD=$PWD
9
10 # update docker-playground and update the BSC and bsc-test containers (if needed)
11 DIR=~/jenkins/docker-playground
12 if [ ! -d "$DIR" ]; then
13 mkdir -p ~/jenkins/ && cd ~/jenkins
14 git clone git://git.osmocom.org/docker-playground
15 fi
16 cd $DIR
17 git remote prune origin; git fetch; git checkout -f -B master origin/master
18 cd $DIR/debian-stretch-titan && make
19 docker pull laforge/debian-stretch-titan:latest # HACK
20 cd $DIR/ttcn3-bts-test && make
21 # execute the script to start containers, read results, ...
22 #cd $DIR/ttcn3-bts-test && sh -x ./jenkins.sh
23 PWD=$OLDPWD
24}
25
26docker pull registry.sysmocom.de/ttcn3-bts-test
27
28# remove older trial dirs and *-run.tgz, if any
29trial_dir_prefix="trial-"
30rm -rf "$trial_dir_prefix"* || true
31
32# Expecting *.tgz artifacts to be copied to this workspace from the various
33# jenkins-*.sh runs, via jenkins job configuration. Compose a trial dir:
34trial_dir="${trial_dir_prefix}$BUILD_NUMBER"
35mkdir -p "$trial_dir"
36
37mv *.tgz "$trial_dir"
38cat *.md5 >> "$trial_dir/checksums.md5"
39rm *.md5
40
41# OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging preferences from the
42# jenkins build job.
43# On failure, first clean up below and then return the exit code.
44exit_code="1"
45if python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS ; then
46 exit_code="0"
47fi
48
49# no need to keep extracted binaries
50rm -rf "$trial_dir/inst" || true
51
52# tar up all results for archiving (optional)
53cd "$trial_dir"
54journalctl -u ofono -o short-precise --since "${time_start}" > "$(readlink last_run)/ofono.log"
55tar czf "$base/${trial_dir}-run.tgz" "$(readlink last_run)"
56tar czf "$base/${trial_dir}-bin.tgz" *.md5 *.tgz
57
58exit $exit_code