| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| # this script checks for test pass/fail signatures at the end of the test |
| usage="Error: usage: $0 [path-to-run-log] [path-to-pass-patterns] [path-to-fail-patterns]"; |
| # need exactly 1 args (path to the run.log) |
| if [[ $# -ne 3 || ! -f $1 || ! -f $2 || ! -f $3 ]]; then |
| # none of the fail patterns should be present |
| while ifs= read -r fail_pattern; do |
| grep_cmd="grep -c -m 1 -E '$fail_pattern' $1"; |
| fail_pattern_found=$(eval $grep_cmd); |
| if [[ $fail_pattern_found -ne 0 ]]; then |
| echo "Fail pattern '$fail_pattern' found" |
| # all pass patterns should be present |
| while ifs= read -r pass_pattern; do |
| grep_cmd="grep -c -m 1 -E '$pass_pattern' $1"; |
| pass_pattern_found=$(eval $grep_cmd); |
| if [[ $pass_pattern_found -eq 0 ]]; then |
| echo "Pass pattern '$pass_pattern' not found" |