riscv-utils/test/true.sh

30 lines
368 B
Bash
Executable File

#!/bin/bash
set -eu
set -o pipefail
: ${BIN:-..}
: ${EMU:=qemu-riscv64}
cmd=$BIN/true
name=true
fail=0
err() {
echo "FAIL $name: $*"
fail=1
}
out=$($EMU $cmd)
stat=$?
if [ -n "$out" ]; then
err "expected no output"
fi
if [ "$stat" -ne 0 ]; then
err "exited with status code $stat, expected 0"
fi
if [ "$fail" -eq 0 ]; then
echo PASS $name
fi