|
|
Joined: May 2012
Posts: 555 Likes: 1
Senior Member
|
OP
Senior Member
Joined: May 2012
Posts: 555 Likes: 1 |
I'd like to run a few dozen of automated tests on the driver I'm working on, and lua looks useful for this. Ideally, the tests should check screen contents while they are running, but I can get by without that -- i.e. stuff some keyboard input, wait a while, stuff more input, capture a screenshot, repeat.
How can I manipulate dip switches, though? "for k,v in pairs(manager:machine():ioport().ports) do print (k) end" enumerates them, but "print (manager:machine():ioport().ports[':SA1'].fields[':'])" fails with:
attempt to index a userdata value (field ':SA1')
|
|
|
|
Joined: May 2012
Posts: 555 Likes: 1
Senior Member
|
OP
Senior Member
Joined: May 2012
Posts: 555 Likes: 1 |
Instead of screenshots, I'm thinking of taking md5 hash of frame buffer; there's a pure lua impl of md5 at https://github.com/kikito/md5.lua, haven't checked yet if lua can get at the actual displayed pixels.
|
|
|
|
Joined: Jan 2012
Posts: 882 Likes: 10
Senior Member
|
Senior Member
Joined: Jan 2012
Posts: 882 Likes: 10 |
Looks like it currently can't put a screen shot in a buffer. It would either have to be added or you'd have to save the shot to a file then open it again.
|
|
|
|
Joined: May 2012
Posts: 555 Likes: 1
Senior Member
|
OP
Senior Member
Joined: May 2012
Posts: 555 Likes: 1 |
Some progress using plan B ("stuff some keyboard input, wait a while, stuff more input, capture a screenshot, repeat") and kyua + atf + lua + pngcmp.
% kyua test
ms1201_tests.sh:t00 -> passed [0.028s]
ms1201_tests.sh:t01 -> passed [3.926s]
ms1201_tests.sh:t02 -> passed [7.742s]
ms1201_tests.sh:t03 -> passed [4.499s]
ms1201_tests.sh:t04 -> passed [8.230s]
ms1201_tests.sh:t11 -> passed [11.441s]
ms1201_tests.sh:t12 -> failed: atf-check failed; see the output of the test for details [7.314s]
ms1201_tests.sh:t13 -> passed [7.197s]
ms1201_tests.sh:t14 -> passed [251.440s]
ms1201_tests.sh:t21 -> failed: atf-check failed; see the output of the test for details [16.619s]
ms1201_tests.sh:t22 -> passed [17.719s]
ms1201_tests.sh:t23 -> passed [19.205s]
ms1201_tests.sh:t24 -> passed [98.905s]
ms1201_tests.sh:t25 -> passed [8.900s]
ms1201_tests.sh:t26 -> passed [9.995s]
ms1201_tests.sh:t31 -> passed [13.914s]
ms1201_tests.sh:t32 -> passed [28.393s]
ms1201_tests.sh:t33 -> passed [25.903s]
ms1201_tests.sh:t41 -> passed [5.015s]
ms1201_tests.sh:t42 -> failed: atf-check failed; see the output of the test for details [72.094s]
'passing' test just means that emulator didn't crash and screenshots match, some of the actual tests running in the emulator are failing; not sure how to report that to atf.
|
|
|
|
Joined: May 2012
Posts: 555 Likes: 1
Senior Member
|
OP
Senior Member
Joined: May 2012
Posts: 555 Likes: 1 |
Apparently Lua cannot control cassette tape motor, or am I missing something?
|
|
|
|
Joined: Jan 2006
Posts: 3,690
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,690 |
LUA can only access port defined in the driver and not the UI inputs. I hope someone can lift eventually this limitation, but I've been unable to make it 
|
|
|
|
Joined: May 2004
Posts: 1,740 Likes: 8
Very Senior Member
|
Very Senior Member
Joined: May 2004
Posts: 1,740 Likes: 8 |
should the cassette player buttons not be actual emulation buttons anyway? for external cassette players they should be devices, with buttons..
you might have more than one (if we emulate tape-to-tape recorders etc.)
just putting it out there, but the concept that play/stop/record with a single cassette player driven directly by the core seems to be one of the more outdated concepts we have.
|
|
|
|
Joined: Jan 2006
Posts: 3,690
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,690 |
we already can have more than one, if you control the cassette drive from the internal menu (you just toggle between the drives in the UI) it's only the shortcut key that is by default mapped to drive 1 and cannot control further drives
that said, I agree it would be great to make cassette players devices with inputs rather than devices whose inputs are handled by the core, it's just a problem of finding the time to do it
|
|
|
|
Joined: Aug 2015
Posts: 405
Senior Member
|
Senior Member
Joined: Aug 2015
Posts: 405 |
Isn't the cassette interface just a serial bit stream with modulation? There are also modems and fax machines in the same theme so maybe there are some similarities that can be generalized and tested together.
Because I can
|
|
|
1 members (Pernod),
23
guests, and
4
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,158
Posts119,911
Members5,034
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|
|