Re: [hatari-devel] problems in b/w mode

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On perjantai 06 tammikuu 2012, Eero Tamminen wrote:
> On perjantai 06 tammikuu 2012, Nicolas Pomarède wrote:
>>>> The included EmuTOS 0.8.6 works Atari TOS doesn't.
>>>
>>> TOS 2.05 works (2.06 doesn't) as does TOS 3.06.
>>> 
>>> TOS 4.x asserts with:
>>> cycInt.c:378: CycInt_AddRelativeInterruptWithOffset: Assertion
>>> `CycleTime>= 0' failed.

Even EmuTOS doesn't work in all modes.  This produces also the assert:
	hatari -m --machine ste --tos etos512k.img

And this freezes Hatari completely with 100% CPU usage:
	hatari -m --machine ste --tos etos512k.img --fast-boot off

 
>>> Every other TOS version (from v1.00 upwards) is stuck at startup with
>>> black screen when "-m" option is given.

In these cases Hatari still reacts.


>> Couldn't this be related to the patches thomas made in rev 3659 and
>> 3671 ? Does it works it you revert to before these patches ?
> 
> I think I'll first write an automated tester (based on hconsole) that
> goes through all the TOS versions and machine & monitor types and
> then reports (based on comparing resulting screenshots) whether
> something failed.

What combinations this kind of "release" tester should go through?

The attached version will go through:
* given TOS images
* st, ste, tt, falcon machine types
* tv, vga, rgb, mono, 1 plane vdi, 4 planes vdi
* 1, 4, 14 MB of memory
* GEMDOS emulation on/off

And all their combinations which should work for given TOS version.
It takes screenshots of booting Hatari with these combos which you
can check afterwards[1].

This already takes quite a while a while for all TOS versions and produces
pretty large number of screenshots, about 16 for ST TOS versions and
a lot more for EmuTOS.

Are there any other things that should be tested in combination with
the TOS images these, like:
* --fullscreen on/off
* --fast-boot on/off
* --timer-d on/off
* --rtc on/off
* --compatible CPU on/off
* with ASCI/IDE images
?


[1] I'll probably write a separate script that makes a HTML report
    page out of the screenshots.  If there's a "reference" screenshots
    directory, it could compare the screenshots against those and
    report only ones that differ.


	- Eero

PS. A similar automated tester could be created for demos.
It would run through large number of demos with their HW configs
(specified in demo specific Hatari config file) to see that
the captured screenshots match earlier ones.

Because many demos have constant animations, being sure that
screenshots are taken from matching places may require writing
demo specific debugger scripts that take the screenshots in
suitable breakpoints.

There might also be a script that helps in finding out HW config
limits (amount of RAM needed, supported machine and monitor types,
whether DSP emu is needed etc) for a demo or game by running through
a suitable selection of configs and checking that inputs given
at specified intervals produce a specified screenshot.
#!/usr/bin/env python
#
# This script tests that all given TOS image files boot under
# Hatari with several different HW configurations.
#
# If Hatari and hconsole are installed to the system,
# you can run this just with:
#   ./tos-tester.py <TOS images>
# 
# Otherwise you need to have PATH pointing to correct Hatari
# version and have hconsole in same directory with this:
#   PATH=../../build/src/:$PATH ./tos-tester.py

# 
import hconsole, os, sys

def warning(msg):
    sys.stderr.write("WARNING: %s\n" % msg)
def error_exit(msg):
    sys.stderr.write("""
usage: %s <TOS image files>

Boots the given TOS versions under Hatari with a selection
of machine and monitor types and memory sizes supported by
the given TOS version.

Verification screenshot is taken of the booted TOS desktop
before proceeding to booting the next combination.

Screenshot name indicates the used combination, for example:
        etos512k-falcon-rgb-14M.png
        etos512k-st-mono-1M.png

ERROR: %s!
""" % (os.path.basename(sys.argv[0]), msg))
    sys.exit(1)


class TOS:
    def __init__(self, argv):
        self.images = []
        if len(argv) < 1:
            error_exit("no TOS image files given")
        for img in argv:
            self.add_image(img)
        if not self.images:
            error_exit("no (valid) TOS image files given")
    
    def image_machines(self, img):
        (version, is_etos) = self.image_version(img)
        if is_etos:
            if version > 0x200:
                return (is_etos, ("st", "ste", "tt", "falcon"))
            else:
                return (is_etos, ("st", "ste", "tt"))
        elif version < 0x160:
            return (is_etos, ("st",))
        elif version < 0x200:
            return (is_etos, ("ste",))
        elif version < 0x300:
            return (is_etos, ("st", "ste", "tt"))
        elif version < 0x400:
            return (is_etos, ("tt",))
        else:
            return (is_etos, ("falcon",))
    
    def image_version(self, img):
        "return tuple of (TOSversion, IsEmuTOS)"
        f = open(img)
        f.seek(0x2, 0)
        version = (ord(f.read(1)) << 8) + ord(f.read(1))
        f.seek(0x2C, 0)
        etos = f.read(4)
        return (version, etos == "ETOS")
    
    def add_image(self, img):
        "add valid TOS images"
        if not os.path.isfile(img):
            warning("'%s' isn't a file")
            return
        size = os.stat(img).st_size
        tossizes = (196608, 262144, 524288)
        if size not in tossizes:
            warning("image '%s' size not one of TOS sizes %s" % (img, repr(tossizes)))
            return
        basename = os.path.basename(img)
        (version, is_etos) = self.image_version(img)
        if is_etos:
            print "%s is EmuTOS v%x" % (basename, version)
        elif version >= 0x100 and version < 0x500:
            print "%s is normal TOS v%x" % (basename, version)
        else:
            warning("'%s' with TOS version 0x%x isn't valid" % (basename, version))
            return
        self.images.append(img)

    def files(self):
        return self.images


class Tester:
    # dummy config file to force suitable default options
    dummycfg = "dummy.cfg"
    defaults = [sys.argv[0], "--configfile", dummycfg]
    hddir = "gemdos"
    
    def __init__(self):
        self.images = TOS(sys.argv[1:])
        # dummy configuration to avoid user's own config,
        # get rid of the dialogs, disable GEMDOS emu by default
        # and get rid of statusbar in screenshots
        dummy = open(self.dummycfg, "w")
        dummy.write("[Log]\nnAlertDlgLogLevel = 0\nbConfirmQuit = FALSE\n")
        dummy.write("[HardDisk]\nbUseHardDiskDirectory = FALSE\n")
        dummy.write("[Screen]\nbCrop = TRUE\n")
        dummy.close()
        # directory for GEMDOS emu testing
        if not os.path.isdir(self.hddir):
            os.mkdir(self.hddir)
        # remove left over screenshots
        if os.path.isfile("grab0001.png"):
            os.remove("grab0001.png")
        if os.path.isfile("grab0001.bmp"):
            os.remove("grab0001.bmp")

    def test(self, identity, testargs, bootwait, deskwait):
        sys.argv = self.defaults + testargs
        instance = hconsole.Main()
        # pass memory test
        instance.run("sleep %d" % bootwait)
        instance.run("keypress %s" % hconsole.Scancode.Space)
        # wait until in desktop, TOS3 is slower in color
        instance.run("sleep %d" % deskwait)
        # screenshot of desktop
        instance.run("screenshot")
        if os.path.isfile("grab0001.png"):
            os.rename("grab0001.png", identity+".png")
        elif os.path.isfile("grab0001.bmp"):
            os.rename("grab0001.bmp", identity+".bmp")
        else:
            warning("failed to locate screenshot grab0001.{png,bmp}")
        # get rid of this Hatari instance
        instance.run("kill")

    def run(self):
        for tos in self.images.files():

            name = os.path.basename(tos)
            name = name[:name.rfind('.')]
            print
            print "***** TESTING: %s *****" % name
            print
            
            (is_etos, machines) = self.images.image_machines(tos)
            for machine in machines:

                if machine in ("st", "ste"):
                    bootwait = 1
                    deskwait = 3
                    if is_etos:
                        # EmuTOS is slower than TOS 1.x
                        deskwait += 2
                    monitors = ("tv", "mono", "vdi1", "vdi4")
                    memories = (1, 4) # (0, 1, 2, 4)
                else:
                    bootwait = 2
                    # e.g. TOS3 is quite slow in color modes
                    deskwait = 5
                    monitors = ("rgb", "vga", "mono", "vdi1", "vdi4")
                    memories = (1,14) # (1, 4, 8, 14)

                for monitor in monitors:
                    for memory in memories:
                        # e.g. TOS4 is slower with more mem
                        bootwait += memory//8
                        deskwait += memory//8
                        for gemdos in (False, True):
                            identity = "%s-%s-%s-%sM" % (name, machine, monitor, memory)
                            testargs = ["--memsize", str(memory), "--machine", machine, "--tos", tos]
                            if monitor[:3] == "vdi":
                                planes = monitor[-1]
                                if planes == "1":
                                    testargs += ["--vdi-width", "640", "--vdi-height", "480", "--vdi-planes", planes]
                                else:
                                    testargs += ["--vdi-width", "320", "--vdi-height", "240", "--vdi-planes", planes]
                            else:
                                testargs += ["--monitor", monitor]
                            if gemdos:
                                identity += "-gemdos"
                                testargs += ["--harddrive", self.hddir]
                            self.test(identity, testargs, bootwait, deskwait)



if __name__ == "__main__":
    tests = Tester()
    tests.run()


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/