File:  [HATARI the Atari ST Emulator] / hatari / tests / buserror / run_test.sh
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 9 08:58:43 2019 UTC (7 years, 3 months ago) by root
Branches: hatari, MAIN
CVS tags: hatari02210, hatari02200, HEAD
hatari 2.2.0

#!/bin/sh

if [ $# -ne 3 -o "$1" = "-h" -o "$1" = "--help" ]; then
	echo "Usage: $0 <hatari> b|w <machine>"
	exit 1;
fi

hatari=$1
if [ ! -x "$hatari" ]; then
	echo "First parameter must point to valid hatari executable."
	exit 1;
fi;

width=$2
machine=$3
basedir=$(dirname $0)
testdir=$(mktemp -d)

case "$machine" in
 st)		reffile="st_$width.txt" ;;
 megast)	reffile="mst4_$width.txt" ;;
 ste)		reffile="ste_$width.txt" ;;
 megaste)	reffile="mste4_$width.txt" ;;
 tt)		reffile="tt_$width.txt" ;;
 falcon)	reffile="fal_n_$width.txt" ;;
 *)		echo "Unsupported machine type: $machine"; exit 1;;
esac

export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=dummy

cp "$basedir/buserr_$width.prg" "$testdir"
HOME="$testdir" $hatari --log-level fatal --fast-forward on --machine $machine \
	--sound off --run-vbls 500 --tos none  "$testdir/buserr_$width.prg" \
	2> $testdir/stderr.txt > $testdir/stdout.txt
exitstat=$?
if [ $exitstat -ne 0 ]; then
	echo "Running hatari failed. Status=${exitstat}, output in ${testdir}"
	exit 1
fi

grep -v '^(' "$basedir/results/$reffile" > "$testdir/expected.txt"

if [ "$width" = "b" ]; then
	tester_output="$testdir/BUSERR_B.TXT"
else
	tester_output="$testdir/BUSERR_W.TXT"
fi

if ! diff -q "$testdir/expected.txt" "$tester_output"; then
	echo "Test FAILED, output differs:"
	diff -u "$testdir/expected.txt" "$tester_output"
	rm -rf "$testdir"
	exit 1
fi

echo "Test PASSED."
rm -rf "$testdir"
exit 0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.