Paul Sokolovsky | 8634f48 | 2021-11-10 17:20:59 +0300 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright (c) 2021, Linaro Limited |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | # Runner for scripts in expect-post/ directory. This script is intended |
| 8 | # to be run from Jenkins build, with $WORKSPACE set and per-UART test |
| 9 | # plans prepare in artefacts/debug/run/. See expect-post/README.md for |
| 10 | # more info about post-expect scripts. |
| 11 | |
| 12 | set -e |
| 13 | |
| 14 | if [ -z "$WORKSPACE" ]; then |
| 15 | echo "Error: WORKSPACE is not set. This script is intended to be run from Jenkins build. (Or suitably set up local env)." |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | total=0 |
| 20 | failed=0 |
| 21 | |
| 22 | for uartdir in $WORKSPACE/artefacts/debug/run/uart*; do |
Paul Sokolovsky | abea61d | 2021-12-01 20:26:12 +0300 | [diff] [blame] | 23 | # In case no dirs exist and the glob above isn't expanded at all. |
| 24 | if [ ! -d "$uartdir" ]; then |
| 25 | break |
| 26 | fi |
| 27 | |
Paul Sokolovsky | 8634f48 | 2021-11-10 17:20:59 +0300 | [diff] [blame] | 28 | uart=$(basename $uartdir) |
| 29 | if [ $uart == "uart0" ]; then |
| 30 | continue |
| 31 | fi |
| 32 | expscript=$(cat $uartdir/expect) |
| 33 | if [ ! -f $WORKSPACE/tf-a-ci-scripts/expect-post/$expscript ]; then |
| 34 | echo "expect-post/$expscript: MISS" |
| 35 | continue |
| 36 | fi |
| 37 | if ! $WORKSPACE/tf-a-ci-scripts/expect-post/$expscript $WORKSPACE/lava-$uart.log; then |
| 38 | echo "expect-post/$expscript($uart): FAIL" |
| 39 | failed=$((failed + 1)) |
| 40 | else |
| 41 | echo "expect-post/$expscript($uart): pass" |
| 42 | fi |
| 43 | total=$((total + 1)) |
| 44 | done |
| 45 | |
| 46 | echo "Post expect scripts: total=$total failed=$failed" |
| 47 | |
| 48 | if [ $failed -gt 0 ]; then |
| 49 | exit 1 |
| 50 | fi |