Ejemplo n.º 1
0
    def test(self, identity, testargs, tos, memory):
        "run single boot test with given args and waits"
        # Hatari command line options, don't exit if Hatari exits
        instance = hconsole.Main(self.defaults + testargs, False)
        fifo = self.open_fifo(tos.fullwait)
        if not fifo:
            print("ERROR: failed to get fifo to Hatari!")
            self.get_screenshot(instance, identity)
            instance.run("kill")
            return (False, False, False, False)
        else:
            init_ok = True

        if tos.memwait:
            # pass memory test
            time.sleep(tos.memwait)
            instance.run("keypress %s" % hconsole.Scancode.Space)

        # wait until test program has been run and output something to fifo
        prog_ok, tests_ok = self.wait_fifo(fifo, tos.fullwait)
        if tests_ok:
            output_ok = self.verify_output(identity, tos, memory)
        else:
            print("TODO: collect info on failure, regs etc")
            output_ok = False

        # get screenshot after a small wait (to guarantee all
        # test program output got to screen even with frameskip)
        time.sleep(0.2)
        self.get_screenshot(instance, identity)
        # get rid of this Hatari instance
        instance.run("kill")
        return (init_ok, prog_ok, tests_ok, output_ok)
Ejemplo n.º 2
0
#   PATH=../../build/src/:$PATH ./example.py --tos etos512k.img
# Or if Hatari and hconsole are installed to the system:
#   /usr/share/hatari/hconsole/example.py --tos etos512k.img

import hconsole, os, sys

# path for this script
path = os.path.dirname(sys.argv[0])
# current work directory
cwd = os.path.abspath(os.path.curdir)

# shortcuts to hconsole stuff
#
# GEMDOS emulation dir is given because without
# a disk, EmuTOS console invocation is ~8s
main = hconsole.Main(sys.argv + ["."])
code = hconsole.Scancode

# execute commands from external file in current directory
main.script(path + "/example-commands")


# define shortcut functions for entering specific key presses
def backspace():
    main.run("keypress %s" % code.Backspace)


def enter():
    main.run("keypress %s" % code.Return)

Ejemplo n.º 3
0
# This is an example of scripting hatari using hconsole
#
# Run with (using correct EmuTOS path):
#   PATH=../../build/src/:$PATH ./example.py --tos etos512k.img
# Or if Hatari and hconsole are installed to the system:
#   /usr/share/hatari/hconsole/example.py --tos etos512k.img

import hconsole, os, sys

# path for this script
path = os.path.dirname(sys.argv[0])
# current work directory
cwd = os.path.abspath(os.path.curdir)

# shortcuts to hconsole stuff
main = hconsole.Main()
code = hconsole.Scancode

# execute commands from external file in current directory
main.script(path + "/example-commands")


# define shortcut functions for entering specific key presses
def backspace():
    main.run("keypress %s" % code.Backspace)


def enter():
    main.run("keypress %s" % code.Return)