Govindraj Raja | 4db3c00 | 2025-04-10 17:23:19 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright (c) 2025 Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | this_dir="$(readlink -f "$(dirname "$0")")" |
| 9 | . $this_dir/common.sh |
| 10 | |
| 11 | LOG_FILE=$(mktemp -t cpu_workaround_order_check_log.XXXX) |
| 12 | |
| 13 | if [[ "$2" == "patch" ]]; then |
| 14 | TEST_CASE="Checking ascending order of CPU ERRATUM and CVE in the patch series" |
| 15 | echo "# $TEST_CASE" |
| 16 | "$CI_ROOT/script/static-checks/static-checks-cpu-erratum-order.py" --tree "$1" \ |
| 17 | --patch --from-ref $(get_merge_base) &> "$LOG_FILE" |
| 18 | else |
| 19 | TEST_CASE="Checking ascending order of CPU ERRATUM and CVE in the entire source tree" |
| 20 | echo "# $TEST_CASE" |
| 21 | "$CI_ROOT/script/static-checks/static-checks-cpu-erratum-order.py" --tree "$1" &> "$LOG_FILE" |
| 22 | fi |
| 23 | |
| 24 | EXIT_VALUE=$? |
| 25 | |
| 26 | echo >> "$LOG_TEST_FILENAME" |
| 27 | echo "****** $TEST_CASE ******" >> "$LOG_TEST_FILENAME" |
| 28 | echo >> "$LOG_TEST_FILENAME" |
| 29 | cat "$LOG_FILE" >> "$LOG_TEST_FILENAME" |
| 30 | echo >> "$LOG_TEST_FILENAME" |
| 31 | if [[ "$EXIT_VALUE" == 0 ]]; then |
| 32 | echo "Result : SUCCESS" >> "$LOG_TEST_FILENAME" |
| 33 | else |
| 34 | echo "Result : FAILURE" >> "$LOG_TEST_FILENAME" |
| 35 | fi |
| 36 | |
| 37 | rm -f "$LOG_FILE" |
| 38 | |
| 39 | exit "$EXIT_VALUE" |