|[hatari-devel] Automated testing of Atari software with Hatari - Some tips|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
- To: Hatari Development <hatari-devel@xxxxxxxxxxxxxxxxxxx>
- Subject: [hatari-devel] Automated testing of Atari software with Hatari - Some tips
- From: Christian Zietz <czietz@xxxxxxx>
- Date: Fri, 8 Mar 2019 19:48:01 +0100
- Autocrypt: addr=czietz@xxxxxxx; prefer-encrypt=mutual; keydata= mQGiBDdn2AURBADksdHVyN55nv0lx4qGx+GQMrbo7zs7lSkAfhkgmgqp84xUeUiWI/kj1on/ wxkmJ96Yzt0ktDbZYM0C9Z66M3rLfXE1vXALHhegeMuOy/tVWybcohRrhfB7tmANTESJOZke 0lZZ59DcIfFoqLYErb6qX8nLPYnOv6sFubxnhuF9QQCg/3GaIR1sVK9Xq+b4B9BtVxd7cHMD /i2hAEOX3WY3K7PNZJziYF54uBbGiVS88W41l1RARcaeogIZcAKpFH3on+Tf60fAC85MCp17 QIeP44hj4Cf46B+UTVhf3EFG4IOsLRxUonpt7dKO8txsKFN/OFsjlPOuDyg7XMpEWkTWZetm HC9/0pcApIXSDnggde4T8AX6nn/+A/4hBOhPxuvkV7Uw/ebLYwXrLo2vt9OvvC1VfeywNseq PIkFX/+n/+niBS+Cb2ess2SVQNKJ9vP5+vBxg5AMfQXqk1ONldGQ/ARHmL6+Iuo47mO51e7R i691hq13wHUvyKh1AN7fpKI2m3YW55XEQ+3iTMIZcqfjr6xYgG8GJTppdbQgQ2hyaXN0aWFu IFppZXR6IDxjemlldHpAZ214Lm5ldD6IYwQQEQIAIwIZAQIeAQIXgAUCVGD5IgcLCQgHAwIB BhUIAgkKCwQWAgMBAAoJEFLLl/ZtoCXKubQAoIHNaurSMQB8MHDoTk3B7WHk2ApoAJ0egA8q aNoVj0kU4+OjeGzFiSHMOrkCDQQ3Z9gFEAgA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlL OCDaAadWoxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeS Wc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknb zSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGze MyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlL IhkmuquiXsNV6TILOwACAgf+JhucyZDzOWGht9e0U71kC2bxIOr4iz+ADd3sxS62okrocHXp B9zYDhmJ74BFfC7xMd9bwWNj7YR0yiUdOzY27OcXcEkVmhVBW6AqxuRAKfmYMvvnyR5z5OP6 vg2YSzgOmooc5vequa5YIjLmFkuRlglLiEgdW9gPBFtirNqxOtAqSxEcRrblSn8JBEU51Ii6 SVVuo1nXOP11g8rVO4YvEED89pHT4jgLZu4th1N+mDumNZlqyUIxZ4tQyw3X2OWvEbKWGn2j h0ZywaomUTpVA+wiwxndawP40oowFYT8LNeLtfZyq6xPpQmT2DaNhP4gdy3qkDfnmXkc2zFM YukXo4g/AwUYN2fYBVLLl/ZtoCXKEQKA3QCfTJstYzXurbt9ZnoTU3SFQQmG0/wAoNX91nWM nsS7JOepPAzOUoke4AIi
- Openpgp: preference=signencrypt
recently, I was working on a low-level software routine that I wanted to
test for compatibility with as many TOS versions as possible. In order
to automate this task, I put Hatari to use. I want to give a short
summary as a reference in case someone else wants to do the same.
* Writing the test:
I wrote some test cases that exercise my routine and detect whether the
tests pass or fail. To output the status, I considered two options:
- Regular output to the screen via GEMDOS function Cconws.
- Output to the MIDI port via XBIOS function Midiws, as suggested by Eero.
In the end, I decided to keep both in. In case I want to run the test on
actual hardware, I'll still have the screen output.
The only Hatari-specific addition is at the end of my test cases: a call
to XBIOS function #255, passing a pointer to the string
"hatari-debug q\n" on the stack. This will terminate Hatari, when BIOS
intercept is on. Again, I also call GEMDOS function Pterm afterwards, in
case the test runs on real HW.
* Running the test:
Since my routine does not need any AES functions, I can run it from the
AUTO folder. Hence I created such a directory and copied my test.prg
into it. A GEM program could presumably be run with the "--auto" option
I call Hatari from the directory containing my AUTO folder with...
hatari -d . -t TOS --bios-intercept on --midi-out midi.txt --log-level
fatal --alert-level fatal --fast-forward on --run-vbls 7500 --fast-boot on
.... where "TOS" is replaced by the image of the TOS version I want to
test with. (In reality this runs in a loop over a lot of different TOS
versions.) Further options could be added to specify amount of RAM,
screen type, etc., as needed by the test cases.
The "--run-vbls 7500" option is so that if my test crashes, Hatari does
still eventually terminate. If your test runs for a long time, you need
to increase the number. Most other options are to speed Hatari up and to
remove any clutter/distraction from the output.
If I hadn't been interested in TOS 1.00, I could also have skipped the
MIDI output and redirection and I could have added "--conout 2" instead
to the command line to intercept the VT52 console output. However, due
to limitations of TOS 1.00, this does not work; which is why I used the
MIDI port as suggested by Eero. (He mentioned that for this to work
Hatari needs to be built without portmidi support. Fortunately, this is
the case for the Windows version, anyway.)
Hatari will overwrite the MIDI output file ("midi.txt" in my case), so
after each test run, I append its contents to my test log.
With all that I can automatically verify that my routine passes all test
cases under all considered TOS versions.
I hope someone will find this helpful,