blob: 7677cff0e444c3b2af4ba149bd733906897cffff [file] [log] [blame]
Neels Hofmeyrf77740b2018-04-11 15:23:46 +02001#!/bin/sh
2
3# Download the latest junit xml results from the jenkins.osmocom.org workspaces.
4# Usage:
5# - have a clean git clone of osmo-ttcn3-hacks
6# - have internet access to jenkins.osmocom.org
7# - ./update_expected_results_from_jenkins.sh
8# - git diff, make sure that you understand and approve of each and every change
9# - git commit -a -m "update expected results"
10
11not_found=""
12
13if [ -n "$(git status | grep 'modified:')" ]; then
14 echo "Your git clone contains modifications! This is not recommended."
15 echo "Hit enter to continue anyway."
16 read enter_to_continue
17fi
18
19for target in */expected-results.xml; do
20 project="$(basename "$(dirname "$target")")"
21
22 # shims for naming exceptions
23 ws_path="ttcn3-${project}-test/ws/logs/${project}-tester"
24 if [ "x$project" = "xggsn_tests" ]; then
25 project="ggsn"
26 elif [ "x$project" = "xsysinfo" ]; then
27 ws_path="ttcn3-nitb-sysinfo/ws/logs/ttcn3-nitb-sysinfo"
28 fi
29
30 # find out the junit-NN.xml name
31 dir_url="https://jenkins.osmocom.org/jenkins/job/$ws_path/"
32 junit_file="$(wget -q -O - "$dir_url" | grep 'junit-xml-[0-9]*\.log' | tail -n 1 | sed 's/.*\(junit-xml-[0-9]*\.log\).*/\1/')"
33
34 # update
35 target_new="$target.new"
36 if ! wget -O "$target_new" "${dir_url}$junit_file"; then
37 not_found="$not_found $project"
38 rm -f "$target_new"
39 else
40 mv "$target_new" "$target"
41 fi
42done
43
44./mask_expected_results.sh
45
46echo "
47
48 MAKE SURE THE RESULTING CHANGES ARE SANE BEFORE COMMITTING!
49
50"
51if [ -n "$not_found" ]; then
52 echo "Could not update: $not_found"
53fi