Ejemplo n.º 1
0
def libmgr_cfg_mgr_dev_default_test():
  lcd = LibCfg(LibCfg.CREATE_MODE_OFF, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
  lmc = LibMgrCfg(dev_default=lcd)
  assert lmc.get_dev_cfg("bla.device") == lcd
  lc = LibCfg(LibCfg.CREATE_MODE_OFF, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
  lmc.add_dev_cfg("bla.device", lc)
  assert lmc.get_dev_cfg("bla.device") == lc
Ejemplo n.º 2
0
def libmgr_cfg_mgr_lib_default_test():
  lcd = LibCfg(LibCfg.CREATE_MODE_OFF, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
  lmc = LibMgrCfg(lib_default=lcd)
  assert lmc.get_lib_cfg("bla.library") == lcd
  lc = LibCfg(LibCfg.CREATE_MODE_OFF, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
  lmc.add_lib_cfg("bla.library", lc)
  assert lmc.get_lib_cfg("bla.library") == lc
Ejemplo n.º 3
0
def libmgr_cfg_mgr_dev_test():
    lmc = LibMgrCfg()
    lc = LibCfg(LibCfg.CREATE_MODE_OFF, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_dev_cfg("bla.device", lc)
    assert lmc.get_dev_cfg("bla.device") == lc
    assert lmc.get_dev_cfg("foo.device") == LibCfg()
    lc2 = LibCfg(LibCfg.CREATE_MODE_AMIGA, 11, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_dev_cfg("foo.device", lc2)
    assert lmc.get_dev_cfg("foo.device") == lc2
Ejemplo n.º 4
0
def libmgr_cfg_mgr_lib_test():
    lmc = LibMgrCfg()
    lc = LibCfg(LibCfg.CREATE_MODE_OFF, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_lib_cfg("bla.library", lc)
    assert lmc.get_lib_cfg("bla.library") == lc
    assert lmc.get_lib_cfg("foo.library") == LibCfg()
    lc2 = LibCfg(LibCfg.CREATE_MODE_AMIGA, 11, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_lib_cfg("foo.library", lc2)
    assert lmc.get_lib_cfg("foo.library") == lc2
Ejemplo n.º 5
0
def libmgr_cfg_mgr_custom_test():
    lcd = LibCfg(LibCfg.CREATE_MODE_OFF, True, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc = LibMgrCfg(do_profile_all=True, profile_add_samples=True, def_cfg=lcd)
    assert lmc.get_do_profile_all()
    assert lmc.get_profile_add_samples()
    assert lmc.get_def_cfg() == lcd
    assert lmc.get_all_names() == []
    assert lmc.get_cfg("bla.library") == lcd
    lc = LibCfg(LibCfg.CREATE_MODE_OFF, True, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_cfg("bla.library", lc)
    assert lmc.get_cfg("bla.library") == lc
    assert lmc.get_all_names() == ["bla.library"]
Ejemplo n.º 6
0
def libmgr_cfg_mgr_default_test():
    lmc = LibMgrCfg()
    assert not lmc.get_do_profile_all()
    assert not lmc.get_profile_add_samples()
    assert lmc.get_def_cfg() == LibCfg()
    assert lmc.get_all_names() == []
    assert lmc.get_cfg("bla.library") == LibCfg()
    lc = LibCfg(LibCfg.CREATE_MODE_OFF, True, 1, LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_cfg("bla.library", lc)
    assert lmc.get_cfg("bla.library") == lc
    assert lmc.get_all_names() == ["bla.library"]
    assert lmc.get_cfg("foo.library") == LibCfg()
    lc2 = LibCfg(LibCfg.CREATE_MODE_AMIGA, False, 11,
                 LibCfg.EXPUNGE_MODE_NO_MEM)
    lmc.add_cfg("foo.library", lc2)
    assert lmc.get_cfg("foo.library") == lc2
    assert lmc.get_all_names() == ["bla.library", "foo.library"]
Ejemplo n.º 7
0
def setup(path_mgr=None):
    log_libmgr.setLevel(logging.INFO)
    log_exec.setLevel(logging.INFO)
    machine = Machine()
    # machine.show_instr(True)
    sp = machine.get_ram_begin() - 4
    alloc = MemoryAlloc.for_machine(machine)
    segloader = SegmentLoader(alloc, path_mgr)
    cfg = LibMgrCfg()
    mgr = LibManager(machine, alloc, segloader, cfg)
    # setup ctx map
    cpu = machine.get_cpu()
    mem = machine.get_mem()
    cpu_type = machine.get_cpu_type()
    exec_ctx = ExecLibCtx(machine, alloc, segloader, path_mgr, mgr)
    mgr.add_ctx("exec.library", exec_ctx)
    mgr.add_impl_cls("exec.library", ExecLibrary)
    dos_ctx = DosLibCtx(machine, alloc, segloader, path_mgr, None, None)
    mgr.add_ctx("dos.library", dos_ctx)
    mgr.add_impl_cls("dos.library", DosLibrary)
    mgr.add_impl_cls("vamostest.library", VamosTestLibrary)
    mgr.add_impl_cls("vamostestdev.device", VamosTestDevice)
    return machine, alloc, mgr, sp, cfg