blob: 89d44683bbde39ae78d277e9e9e5922835e284fc [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval579c7372020-10-23 15:23:32 -05003# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
Paul Sokolovsky5a2b7462021-12-20 16:39:58 +03008set -ex
Fathi Boudra422bf772019-12-02 11:10:16 +02009
Paul Sokolovskybfa80ed2023-06-02 08:58:28 +030010# Jenkins Parameterized Trigger Plugin mangles job names as passed via
11# environment variables, replacing most non-alphanumeric chars with
12# underscore. The mangling is generally non-reversible, but we apply
13# "heuristics" based on our naming conventions.
14function unmangle_job_name() {
15 # Two numbers seperated by undescore was likely a version number originally,
16 # e.g. lts2.8 -> lts2_8.
17 s=$(python3 -c 'import sys, re; print(re.sub(r"(\d+)_(\d+)", r"\1.\2", sys.argv[1]))' "$1")
18 # Otherwise, we use hyphens as seperators.
19 s=$(echo $s | tr "_" "-")
20 echo $s
21}
22
Fathi Boudra422bf772019-12-02 11:10:16 +020023# Generate test report
24if [ "$CI_ROOT" ]; then
25 # Gather Coverity scan summary if it was performed as part of this job
26 if [ "$(find -maxdepth 1 -name '*coverity*.test' -type f | wc -l)" != 0 ]; then
27 if ! "$CI_ROOT/script/coverity_summary.py" "$BUILD_URL" > coverity.data; then
28 rm -f coverity.data
29 fi
30 fi
31
Leonardo Sandoval55d5c8c2021-01-20 10:51:18 -060032 # set proper jobs names for test generation report script
Gary Morrison999a9d72022-03-14 18:29:06 -050033 if echo "$JENKINS_URL" | grep -q "oss.arm.com"; then
Leonardo Sandoval55d5c8c2021-01-20 10:51:18 -060034 worker_job="${worker_job:-tf-worker}"
35 lava_job="${lava_job:-tf-build-for-lava}"
36 else
Paul Sokolovskybfa80ed2023-06-02 08:58:28 +030037 triggered_job=$(unmangle_job_name "${TRIGGERED_JOB_NAMES}")
Paul Sokolovsky71d78cc2021-12-20 17:44:10 +030038 worker_job="${worker_job:-${triggered_job}}"
39 lava_job="${lava_job:-${triggered_job}}"
Harrison Mutai4126dc72021-11-23 11:34:41 +000040 fi
41
42 # Generate UI for test results, only if this is a visualization job.
43 while getopts ":t" option; do
44 case $option in
45 t)
46 target_job="$(dirname $TARGET_BUILD)"
47 target=${target_job:-tf-a-main}
48 "$CI_ROOT/script/gen_results_report.py" \
49 --png "${target}-result.png" \
50 --csv "${WORKSPACE}/${target}-result.csv" \
51 -o "${WORKSPACE}/report.html" || true
52 exit;;
53 esac
54 done
Leonardo Sandoval55d5c8c2021-01-20 10:51:18 -060055
Fathi Boudra422bf772019-12-02 11:10:16 +020056 "$CI_ROOT/script/gen_test_report.py" \
Leonardo Sandoval55d5c8c2021-01-20 10:51:18 -060057 --job "${worker_job}" \
58 --build-job "${lava_job}" \
Fathi Boudra422bf772019-12-02 11:10:16 +020059 --meta-data clone.data \
60 --meta-data override.data \
61 --meta-data inject.data \
62 --meta-data html:coverity.data \
63 || true
Leonardo Sandoval5d9d2762021-02-02 10:06:33 -060064
Saul Romero568f5d72023-11-29 11:58:34 +000065 # Only call to merge reports if the test groups are for code coverage
Saul Romero95e8d4e2023-12-11 10:03:55 +000066 if [[ $TEST_GROUPS == *"code-coverage"* ]] ||
67 [[ $TEST_GROUPS == "scp-boot-tests-coverage" ]]; then
Saul Romero568f5d72023-11-29 11:58:34 +000068 source $CI_ROOT/script/gen_merge_report.sh "${WORKSPACE}/report.json" \
69 "${WORKSPACE}/report.html"
70 fi
Fathi Boudra422bf772019-12-02 11:10:16 +020071fi