File:  [HATARI the Atari ST Emulator] / hatari / tests / serial / 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 [ $# -lt 1 -o "$1" = "-h" -o "$1" = "--help" ]; then
	echo "Usage: $0 <hatari> <machine>"
	exit 1
fi

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

sertype=$2
machine=$3

basedir=$(dirname $0)
testdir=$(mktemp -d)

touch "$testdir"/empty.txt

export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=dummy
unset TERM

if [ "$sertype" = "mfp" ]; then
	serparams="--rs232-in $testdir/empty.txt --rs232-out $testdir/serial-out.txt"
	testprog=mfp_ser.tos
elif [ "$sertype" = "midi" ]; then
	serparams="--midi-in $testdir/empty.txt --midi-out $testdir/serial-out.txt"
	testprog=midi_ser.tos
elif [ "$sertype" = "scc" ]; then
	serparams="--scc-b-out $testdir/serial-out.txt"
	testprog=scc_ser.tos
else
	echo "Unsupported serial type: $sertype"
	exit 1
fi

HOME="$testdir" $hatari --log-level fatal --sound off --tos none \
	--fast-forward on  --run-vbls 500 $serparams --machine "$machine" \
	"$basedir"/"$testprog" > "$testdir/out.txt"
exitstat=$?
if [ $exitstat -ne 0 ]; then
	echo "Test FAILED. Hatari exited with status ${exitstat}."
	cat "$testdir/out.txt"
	rm -rf "$testdir"
	exit 1
fi

if ! diff -q "$basedir/expected.txt" "$testdir/serial-out.txt"; then
	echo "Test FAILED, output differs:"
	diff -u "$basedir/expected.txt" "$testdir/serial-out.txt"
	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.