blob: ab22562beaa3fdb025919d06bd8c0fb8d941b0b0 [file] [log] [blame]
Paul Sokolovsky8634f482021-11-10 17:20:59 +03001#!/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
12set -e
13
14if [ -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
17fi
18
19total=0
20failed=0
21
22for uartdir in $WORKSPACE/artefacts/debug/run/uart*; do
Paul Sokolovskyabea61d2021-12-01 20:26:12 +030023 # 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 Sokolovsky8634f482021-11-10 17:20:59 +030028 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))
44done
45
46echo "Post expect scripts: total=$total failed=$failed"
47
48if [ $failed -gt 0 ]; then
49 exit 1
50fi