Neels Hofmeyr | f77740b | 2018-04-11 15:23:46 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Harald Welte | 0cdf071 | 2019-06-19 18:15:38 +0200 | [diff] [blame] | 3 | # 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 Hofmeyr | f77740b | 2018-04-11 15:23:46 +0200 | [diff] [blame] | 18 | # 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 | |
| 26 | not_found="" |
| 27 | |
| 28 | if [ -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 |
| 32 | fi |
| 33 | |
| 34 | for 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 |
| 57 | done |
| 58 | |
| 59 | ./mask_expected_results.sh |
| 60 | |
| 61 | echo " |
| 62 | |
| 63 | MAKE SURE THE RESULTING CHANGES ARE SANE BEFORE COMMITTING! |
| 64 | |
| 65 | " |
| 66 | if [ -n "$not_found" ]; then |
| 67 | echo "Could not update: $not_found" |
| 68 | fi |