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