ibex/ci/run-cosim-test.sh
Harry Callahan db07ab174e Change '/bin/bash' shebangs to '/usr/bin/env bash'
This improves portability across different unix-like operating systems
by using bash from the PATH, instead of bash from a hardcoded location.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2025-06-23 10:48:34 +00:00

51 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Run an elf against simple system co-simulation and check the UART output for
# reported pass/fail reporting as appropriate for use in GitHub Actions
SKIP_PASS_CHECK=0
if [ $# -eq 3 ]; then
if [ $1 == "--skip-pass-check" ]; then
SKIP_PASS_CHECK=1
fi
TEST_NAME=$2
TEST_ELF=$3
elif [ $# -eq 2 ]; then
TEST_NAME=$1
TEST_ELF=$2
else
echo "Usage: $0 [--skip-pass-check] test_name test_elf"
exit 1
fi
echo "Running $TEST_NAME with co-simulation"
build/lowrisc_ibex_ibex_simple_system_cosim_0/sim-verilator/Vibex_simple_system --meminit=ram,$TEST_ELF
if [ $? != 0 ]; then
echo "::error::Running % failed co-simulation testing"
exit 1
fi
grep 'FAILURE' ibex_simple_system.log
if [ $? != 1 ]; then
echo "::error::Failure seen in $TEST_NAME log"
echo "Log contents:"
cat ibex_simple_system.log
exit 1
fi
if [ $SKIP_PASS_CHECK != 1 ]; then
grep 'PASS' ibex_simple_system.log
if [ $? != 0 ]; then
echo "::error::No pass seen in $TEST_NAME log"
echo "Log contents:"
cat ibex_simple_system.log
exit 1
fi
fi
echo "$TEST_NAME succeeded"