blob: 67089b5e895678c377d8557789c0aa33b4facc07 [file] [log] [blame]
Leonardo Sandoval314eed82020-08-05 13:32:04 -05001#!/bin/bash
2#
Xinyu Zhange8015942021-02-22 16:06:00 +08003# Copyright (c) 2019-2021, Arm Limited. All rights reserved.
Leonardo Sandoval314eed82020-08-05 13:32:04 -05004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# unittest-include-order.sh <path-to-root-folder> [patch]
9
10LOG_FILE=$(mktemp -t include-order-check.XXXX)
11
12if [[ "$2" == "patch" ]]; then
13 echo "# Check order of includes on the last patch"
14 TEST_CASE="Order of includes on the last patch(es)"
15 "$CI_ROOT/script/static-checks/check-include-order.py" --tree "$1" \
16 --patch --from-ref origin/master \
Xinyu Zhange8015942021-02-22 16:06:00 +080017 | tee "$LOG_FILE"
Leonardo Sandoval314eed82020-08-05 13:32:04 -050018else
19 echo "# Check order of includes of the entire source tree"
20 TEST_CASE="Order of includes of the entire source tree"
21 "$CI_ROOT/script/static-checks/check-include-order.py" --tree "$1" \
Xinyu Zhange8015942021-02-22 16:06:00 +080022 | tee "$LOG_FILE"
Leonardo Sandoval314eed82020-08-05 13:32:04 -050023fi
24
25EXIT_VALUE=$?
26
27echo >> "$LOG_TEST_FILENAME"
28echo "****** $TEST_CASE ******" >> "$LOG_TEST_FILENAME"
29echo >> "$LOG_TEST_FILENAME"
30if [[ "$EXIT_VALUE" == 0 ]]; then
31 echo "Result : SUCCESS" >> "$LOG_TEST_FILENAME"
32else
33 echo "Result : FAILURE" >> "$LOG_TEST_FILENAME"
34 echo >> "$LOG_TEST_FILENAME"
35 cat "$LOG_FILE" >> "$LOG_TEST_FILENAME"
36fi
37echo >> "$LOG_TEST_FILENAME"
38
39rm -f "$LOG_FILE"
40
41exit "$EXIT_VALUE"