mirror of
https://github.com/Michaelangel007/c2t.git
synced 2024-12-27 10:30:46 +00:00
major test clean up
This commit is contained in:
parent
9d3f517423
commit
7794f7a173
7
Makefile
7
Makefile
@ -7,7 +7,7 @@ windows: c2t.exe c2t-96h.exe
|
||||
|
||||
dist: all windows
|
||||
|
||||
clean:
|
||||
clean: testclean
|
||||
rm -f c2t.h c2t c2t-96h c2t.exe c2t-96h.exe
|
||||
cd asm; make clean
|
||||
|
||||
@ -27,4 +27,7 @@ c2t.h: mon/dos33.boot1.mon mon/dos33.boot2.mon asm/autoload.s asm/diskload2.s as
|
||||
./makeheader
|
||||
|
||||
test: c2t-96h c2t-96h.exe
|
||||
./test.sh
|
||||
cd tests; ./test.sh
|
||||
|
||||
testclean:
|
||||
cd tests; rm -f passed test.log
|
||||
|
@ -75,15 +75,14 @@ Automated testing is only supported on OS/X and requires the following:
|
||||
|
||||
|
||||
* Virtual ][ (<http://http://www.virtualii.com/>)
|
||||
* `disks/zork.dsk` (May be found as `zork_i.dsk`, in any case save as `zork.dsk`)
|
||||
* `disks/dangerous_dave.po` (You can find this on Asimov as `dangerous_dave.dsk`, but it's really a PO ordered file, just rename to `.po`.)
|
||||
* Windows cross-compiling tools <http://crossgcc.rts-software.org/download/gcc-4.8.0-qt-4.8.4-win32/gcc-4.8.0-qt-4.8.4-for-mingw32.dmg>
|
||||
* Wine (<http://winehq.org>) installed in `~/wine` (extract the tarball in `~/wine` and move the contents of `~/wine/usr` to `~/wine`, or change the path to `wine` in `test.sh`).
|
||||
|
||||
> You can hack `test.sh` if you do not want to test Windows binaries or want to use different disk images for test.
|
||||
> You can hack `test.md` if you do not want to test Windows binaries or want to use different disk images for test.
|
||||
|
||||
To test, type:
|
||||
```
|
||||
make testclean # only once, unless you want to start over
|
||||
make test
|
||||
```
|
||||
|
||||
|
66
test.sh
66
test.sh
@ -1,66 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path to wine binary for testing Windows binary
|
||||
PATH=~/wine/bin:$PATH
|
||||
|
||||
# list of commands to test, must be space delimited
|
||||
CMD=("./c2t-96h" "wine c2t-96h.exe")
|
||||
|
||||
# list of disks to test, must be space delimited.
|
||||
# Disks (and paths to disks) cannot have spaces in names.
|
||||
IMAGES="disks/zork.dsk disks/dangerous_dave.po"
|
||||
|
||||
_test()
|
||||
{
|
||||
IMAGE=$1
|
||||
DONE=$2
|
||||
BASENAME=$(basename $1)
|
||||
FILETYPE=$(echo $BASENAME | awk -F. '{print $NF}')
|
||||
|
||||
dd if=/dev/zero of=test.$FILETYPE bs=1k count=140 >/dev/null 2>&1
|
||||
|
||||
if ! OUTPUT=$(osascript test.scrp test.${FILETYPE} $DONE)
|
||||
then
|
||||
echo
|
||||
return 1
|
||||
fi
|
||||
|
||||
if echo $OUTPUT | grep ERROR >/dev/null 2>&1
|
||||
then
|
||||
echo $OUTPUT
|
||||
echo
|
||||
return 1
|
||||
fi
|
||||
|
||||
S1=$(md5sum ${IMAGE} | awk '{print $1}')
|
||||
S2=$(md5sum test.$FILETYPE | awk '{print $1}')
|
||||
|
||||
echo "$IMAGE $S1 $S2"
|
||||
|
||||
if [ "$S1" = "$S2" ]
|
||||
then
|
||||
rm -f test.$FILETYPE test.aif
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
for i in $IMAGES
|
||||
do
|
||||
for j in $(seq 0 $(( ${#CMD[@]} - 1 )) )
|
||||
do
|
||||
echo ${CMD[$j]} $i test.aif
|
||||
eval ${CMD[$j]} $i test.aif
|
||||
if _test $i dskappleiie.tiff
|
||||
then
|
||||
echo "$i passed"
|
||||
echo
|
||||
else
|
||||
echo "$i failed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
60
tests/gentiff.scrp
Normal file
60
tests/gentiff.scrp
Normal file
@ -0,0 +1,60 @@
|
||||
on run argv
|
||||
|
||||
set my_path to (system attribute "PWD") & "/"
|
||||
set my_test to item 1 of argv
|
||||
set my_machine to item 2 of argv
|
||||
set my_done to item 3 of argv
|
||||
set dsk to item 4 of argv
|
||||
set loadcmd to item 5 of argv
|
||||
|
||||
tell application "Virtual ]["
|
||||
activate
|
||||
-- delay 0.5
|
||||
delay 1
|
||||
-- Close all open machines
|
||||
close every machine saving no
|
||||
-- Create a new (AppleIIe, AppleIIPlus, AppleII)
|
||||
if my_machine = "iie" then
|
||||
set theMachine to (make new AppleIIe)
|
||||
end if
|
||||
if my_machine = "iip" then
|
||||
set theMachine to (make new AppleIIPlus)
|
||||
end if
|
||||
if my_machine = "ii" then
|
||||
set theMachine to (make new AppleII)
|
||||
end if
|
||||
tell theMachine
|
||||
-- Change to a color screen
|
||||
-- set monochrome screen to false
|
||||
set speaker volume to 0.25
|
||||
|
||||
if dsk = "1" then
|
||||
insert my_path & my_test into device "S6D1"
|
||||
end if
|
||||
-- Now wait for the startup screen
|
||||
delay 0.5
|
||||
reset
|
||||
|
||||
set my_prompt to "*"
|
||||
if loadcmd = "LOAD" then
|
||||
set my_prompt to "]"
|
||||
end if
|
||||
|
||||
repeat until the last line of the compact screen text = my_prompt
|
||||
delay 0.5
|
||||
end repeat
|
||||
|
||||
-- type line "LOAD"
|
||||
type line loadcmd
|
||||
|
||||
play my_path & "test.aif" on device "cassette recorder"
|
||||
set speed to maximum
|
||||
delay 15
|
||||
snap screen picture to POSIX path of (my_path & my_done) format tiff
|
||||
end tell
|
||||
delay 1
|
||||
close every machine saving no
|
||||
quit
|
||||
end tell
|
||||
|
||||
end run
|
85
tests/gentiff.sh
Executable file
85
tests/gentiff.sh
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
TIFFDIR=tiffs
|
||||
C2T=../c2t-96h
|
||||
|
||||
_gentiff()
|
||||
{
|
||||
MACHINE=$1
|
||||
TIFF=$2
|
||||
DSK=$3
|
||||
LOAD="$4"
|
||||
|
||||
if [ "$DSK" = "1" ]
|
||||
then
|
||||
dd if=/dev/zero of=test.dsk bs=1k count=140 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if ! OUTPUT=$(osascript gentiff.scrp test.dsk $MACHINE $TIFF $DSK "$LOAD")
|
||||
then
|
||||
echo
|
||||
return 1
|
||||
fi
|
||||
|
||||
#if echo $OUTPUT | grep ERROR >/dev/null 2>&1
|
||||
#then
|
||||
# echo $OUTPUT
|
||||
# echo
|
||||
# return 1
|
||||
#fi
|
||||
|
||||
if test -s $TIFF
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
mkdir -p ${TIFFDIR}
|
||||
|
||||
TIFF=${TIFFDIR}/dskiie.tiff
|
||||
if [ ! -s "$TIFF" ]
|
||||
then
|
||||
eval $C2T images/zork.dsk test.aif
|
||||
if ! _gentiff iie $TIFF 1 "LOAD"
|
||||
then
|
||||
echo "$TIFF failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
TIFF=${TIFFDIR}/dskiip.tiff
|
||||
if [ ! -s "$TIFF" ]
|
||||
then
|
||||
eval $C2T images/zork.dsk test.aif
|
||||
if ! _gentiff iip $TIFF 1 "LOAD"
|
||||
then
|
||||
echo "$TIFF failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
TIFF=${TIFFDIR}/mpiie.tiff
|
||||
if [ ! -s "$TIFF" ]
|
||||
then
|
||||
eval $C2T -2bf images/moon.patrol,801 test.aif
|
||||
if ! _gentiff iie $TIFF 0 "LOAD"
|
||||
then
|
||||
echo "$TIFF failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
TIFF=${TIFFDIR}/mpii.tiff
|
||||
if [ ! -s "$TIFF" ]
|
||||
then
|
||||
eval $C2T -2af images/moon.patrol,801 test.aif
|
||||
if ! _gentiff ii $TIFF 0 "800.A00R 800G"
|
||||
then
|
||||
echo "$TIFF failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f test.aif test.dsk
|
||||
|
BIN
tests/images/moon.patrol
Normal file
BIN
tests/images/moon.patrol
Normal file
Binary file not shown.
17
tests/test.md
Normal file
17
tests/test.md
Normal file
@ -0,0 +1,17 @@
|
||||
## Automated Tests
|
||||
|
||||
|
||||
| Test | Command | Input | Machine | Load | Compare | Offset | Timeout |
|
||||
|:----:|--------------------------|-----------------|---------|---------------|-------------|:------:|:-------:|
|
||||
| 1 | ../c2t-96h | zork.dsk | iie | LOAD | dskiie.tiff | 0 | 25 |
|
||||
| 2 | wine ../c2t-96h.exe | zork.dsk | iie | LOAD | dskiie.tiff | 0 | 25 |
|
||||
| 3 | ../c2t-96h | dd.po | iie | LOAD | dskiie.tiff | 0 | 25 |
|
||||
| 4 | wine ../c2t-96h.exe | dd.po | iie | LOAD | dskiie.tiff | 0 | 25 |
|
||||
| 5 | ../c2t-96h | zork.dsk | iip | LOAD | dskiip.tiff | 0 | 25 |
|
||||
| 6 | wine ../c2t-96h.exe | zork.dsk | iip | LOAD | dskiip.tiff | 0 | 25 |
|
||||
| 7 | ../c2t-96h | dd.po | iip | LOAD | dskiip.tiff | 0 | 25 |
|
||||
| 8 | wine ../c2t-96h.exe | dd.po | iip | LOAD | dskiip.tiff | 0 | 25 |
|
||||
| 9 | ../c2t-96h -2bf | moon.patrol,801 | iie | LOAD | mpiie.tiff | 0 | 25 |
|
||||
| 10 | wine ../c2t-96h.exe -2bf | moon.patrol,801 | iie | LOAD | mpiie.tiff | 0 | 25 |
|
||||
| 11 | ../c2t-96h -2af | moon.patrol,801 | ii | 800.A00R 800G | mpii.tiff | 0 | 25 |
|
||||
| 12 | wine ../c2t-96h.exe -2af | moon.patrol,801 | ii | 800.A00R 800G | mpii.tiff | 0 | 25 |
|
@ -3,37 +3,53 @@ on run argv
|
||||
set my_path to (system attribute "PWD") & "/"
|
||||
set my_test to item 1 of argv
|
||||
set my_done to item 2 of argv
|
||||
set my_machine to item 3 of argv
|
||||
set dsk to item 4 of argv
|
||||
set loadcmd to item 5 of argv
|
||||
set my_timeout to item 6 of argv
|
||||
|
||||
tell application "Virtual ]["
|
||||
activate
|
||||
delay 0.5
|
||||
delay 1
|
||||
-- Close all open machines
|
||||
close every machine saving no
|
||||
-- Create a new (AppleIIe, AppleIIPlus, AppleII)
|
||||
-- set theMachine to (make new AppleIIPlus)
|
||||
set theMachine to (make new AppleIIe)
|
||||
if my_machine = "iie" then
|
||||
set theMachine to (make new AppleIIe)
|
||||
end if
|
||||
if my_machine = "iip" then
|
||||
set theMachine to (make new AppleIIPlus)
|
||||
end if
|
||||
if my_machine = "ii" then
|
||||
set theMachine to (make new AppleII)
|
||||
end if
|
||||
tell theMachine
|
||||
-- Change to a color screen
|
||||
-- set monochrome screen to false
|
||||
set speaker volume to 0.25
|
||||
insert my_path & my_test into device "S6D1"
|
||||
if dsk = "1" then
|
||||
insert my_path & my_test into device "S6D1"
|
||||
end if
|
||||
-- Now wait for the startup screen
|
||||
delay 0.5
|
||||
reset
|
||||
|
||||
set my_prompt to "*"
|
||||
if loadcmd = "LOAD" then
|
||||
set my_prompt to "]"
|
||||
end if
|
||||
|
||||
repeat until the last line of the compact screen text = "]"
|
||||
repeat until the last line of the compact screen text = my_prompt
|
||||
delay 0.5
|
||||
end repeat
|
||||
|
||||
type line "LOAD"
|
||||
type line loadcmd
|
||||
|
||||
play my_path & "test.aif" on device "cassette recorder"
|
||||
set speed to maximum
|
||||
|
||||
try
|
||||
with timeout of 25 seconds
|
||||
-- repeat until the last line of the compact screen text = "DONE. PRESS [RETURN] TO REBOOT."
|
||||
-- delay 0.5
|
||||
-- end repeat
|
||||
with timeout of my_timeout seconds
|
||||
waiting until screen equals imagefile POSIX path of (my_path & my_done)
|
||||
end timeout
|
||||
on error
|
||||
@ -46,8 +62,9 @@ on run argv
|
||||
-- delay 3
|
||||
|
||||
end tell
|
||||
delay 0.5
|
||||
delay 1
|
||||
close every machine saving no
|
||||
quit
|
||||
end tell
|
||||
end run
|
||||
|
111
tests/test.sh
Executable file
111
tests/test.sh
Executable file
@ -0,0 +1,111 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path to wine binary for testing Windows binary
|
||||
PATH=~/wine/bin:$PATH
|
||||
|
||||
TESTS=test.md
|
||||
IMAGES=images
|
||||
TIFFS=tiffs
|
||||
|
||||
_test()
|
||||
{
|
||||
IMAGE=$1
|
||||
DONE=$2
|
||||
MACHINE=$3
|
||||
LOAD="$4"
|
||||
TIMEOT=$5
|
||||
FILETYPE=$(echo $IMAGE | tr '[:upper:]' '[:lower:]' | awk -F. '{print $NF}')
|
||||
|
||||
DSK=0
|
||||
if [ "$FILETYPE" = "po" -o "$FILETYPE" = "do" -o "$FILETYPE" = "dsk" ]
|
||||
then
|
||||
DSK=1
|
||||
fi
|
||||
|
||||
if [ "$DSK" = "1" ]
|
||||
then
|
||||
dd if=/dev/zero of=test.$FILETYPE bs=1k count=140 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if ! OUTPUT=$(osascript test.scrp test.${FILETYPE} $DONE $MACHINE $DSK "$LOAD" $TIMEOT)
|
||||
then
|
||||
echo
|
||||
return 1
|
||||
fi
|
||||
|
||||
if echo $OUTPUT | grep ERROR >/dev/null 2>&1
|
||||
then
|
||||
echo $OUTPUT
|
||||
echo
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$DSK" = "0" ]
|
||||
then
|
||||
rm -f test.aif
|
||||
return 0
|
||||
fi
|
||||
|
||||
S1=$(md5sum ${IMAGE} | awk '{print $1}')
|
||||
S2=$(md5sum test.$FILETYPE | awk '{print $1}')
|
||||
|
||||
echo "$IMAGE $S1 $S2" >>test.log
|
||||
|
||||
if [ "$S1" = "$S2" ]
|
||||
then
|
||||
rm -f test.$FILETYPE test.aif
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
>test.log
|
||||
|
||||
echo "Tests:"
|
||||
echo
|
||||
grep '^|' $TESTS
|
||||
echo
|
||||
|
||||
IFS=$'\n'
|
||||
for i in $(grep '^| [0-9]' $TESTS | perl -p -e 's/\| +/|/g' | perl -p -e 's/ +\|/|/g' | sed 's/\|/:/g')
|
||||
do
|
||||
IFS=:
|
||||
set -- $i
|
||||
|
||||
N=$2
|
||||
CMD="$3"
|
||||
INPUT=$4
|
||||
MACHINE=$5
|
||||
LOAD="$6"
|
||||
DONE=$7
|
||||
OFFSET=$8
|
||||
TIMEOT=$9
|
||||
|
||||
#echo $N : $CMD : $INPUT : $MACHINE : $LOAD : $DONE : $OFFSET : $TIMEOT
|
||||
|
||||
if grep "^$N:" passed >/dev/null 2>&1
|
||||
then
|
||||
echo "Test $N already passed"
|
||||
continue
|
||||
fi
|
||||
|
||||
EC=0
|
||||
echo "Running test $N..."
|
||||
echo $* >>test.log
|
||||
echo " $CMD $IMAGES/$INPUT test.aif"
|
||||
eval "$CMD" $IMAGES/$INPUT test.aif >>test.log 2>&1
|
||||
echo " _test ${IMAGES}/${INPUT} ${TIFFS}/${DONE} $MACHINE $LOAD $TIMEOT"
|
||||
if _test ${IMAGES}/${INPUT} ${TIFFS}/${DONE} $MACHINE "$LOAD" $TIMEOT
|
||||
then
|
||||
echo " passed"
|
||||
echo "$N:$(date)" >>passed
|
||||
else
|
||||
echo " FAILED"
|
||||
EC=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
unset IFS
|
||||
exit $EC
|
||||
|
BIN
tests/tiffs/dskiie.tiff
Normal file
BIN
tests/tiffs/dskiie.tiff
Normal file
Binary file not shown.
BIN
tests/tiffs/dskiip.tiff
Normal file
BIN
tests/tiffs/dskiip.tiff
Normal file
Binary file not shown.
BIN
tests/tiffs/mpii.tiff
Normal file
BIN
tests/tiffs/mpii.tiff
Normal file
Binary file not shown.
BIN
tests/tiffs/mpiie.tiff
Normal file
BIN
tests/tiffs/mpiie.tiff
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user