blob: d30e640571dbfc38e6c72471bc41110afd97521b [file] [log] [blame]
Neels Hofmeyrf77740b2018-04-11 15:23:46 +02001#!/bin/sh
2
Harald Welte0cdf0712019-06-19 18:15:38 +02003# Copyright 2018 sysmocom - s.f.m.c. GmbH
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17
Neels Hofmeyrf77740b2018-04-11 15:23:46 +020018# Download the latest junit xml results from the jenkins.osmocom.org workspaces.
19# Usage:
20# - have a clean git clone of osmo-ttcn3-hacks
21# - have internet access to jenkins.osmocom.org
22# - ./update_expected_results_from_jenkins.sh
23# - git diff, make sure that you understand and approve of each and every change
24# - git commit -a -m "update expected results"
25
26not_found=""
27
28if [ -n "$(git status | grep 'modified:')" ]; then
29 echo "Your git clone contains modifications! This is not recommended."
30 echo "Hit enter to continue anyway."
31 read enter_to_continue
32fi
33
34for target in */expected-results.xml; do
35 project="$(basename "$(dirname "$target")")"
36
37 # shims for naming exceptions
38 ws_path="ttcn3-${project}-test/ws/logs/${project}-tester"
39 if [ "x$project" = "xggsn_tests" ]; then
40 project="ggsn"
41 elif [ "x$project" = "xsysinfo" ]; then
42 ws_path="ttcn3-nitb-sysinfo/ws/logs/ttcn3-nitb-sysinfo"
43 fi
44
45 # find out the junit-NN.xml name
46 dir_url="https://jenkins.osmocom.org/jenkins/job/$ws_path/"
47 junit_file="$(wget -q -O - "$dir_url" | grep 'junit-xml-[0-9]*\.log' | tail -n 1 | sed 's/.*\(junit-xml-[0-9]*\.log\).*/\1/')"
48
49 # update
50 target_new="$target.new"
51 if ! wget -O "$target_new" "${dir_url}$junit_file"; then
52 not_found="$not_found $project"
53 rm -f "$target_new"
54 else
55 mv "$target_new" "$target"
56 fi
57done
58
59./mask_expected_results.sh
60
61echo "
62
63 MAKE SURE THE RESULTING CHANGES ARE SANE BEFORE COMMITTING!
64
65"
66if [ -n "$not_found" ]; then
67 echo "Could not update: $not_found"
68fi