def test_address_collision(self): core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) mgmt.clear_log() self.execute(AddressCollision) log = mgmt.get_log() self.assertIn("RTIO collision", log) mgmt.close()
def execute_and_test_in_log(self, experiment, string): core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) mgmt.clear_log() self.execute(experiment) log = mgmt.get_log() self.assertIn(string, log) mgmt.close()
def execute_and_test_in_log(self, experiment, string): core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) mgmt.clear_log() self.execute(experiment) log = mgmt.get_log() self.assertIn(string, log) mgmt.close()
def test_compile(self): core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) mgmt.clear_log() with tempfile.TemporaryDirectory() as tmp: db_path = os.path.join(artiq_root, "device_db.py") subprocess.call([sys.executable, "-m", "artiq.frontend.artiq_compile", "--device-db", db_path, "-e", "CheckLog", "-o", os.path.join(tmp, "check_log.elf"), __file__]) subprocess.call([sys.executable, "-m", "artiq.frontend.artiq_run", "--device-db", db_path, os.path.join(tmp, "check_log.elf")]) log = mgmt.get_log() self.assertIn("test_artiq_compile", log) mgmt.close()
def main(): args = get_argparser().parse_args() init_logger(args) core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) try: if args.action == "set_level": mgmt.set_log_level(args.level) elif args.action == "set_uart_level": mgmt.set_uart_log_level(args.level) elif args.action == "clear": mgmt.clear_log() else: print(mgmt.get_log(), end="") finally: mgmt.close()
def main(): args = get_argparser().parse_args() init_logger(args) core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) try: if args.action == "set_level": mgmt.set_log_level(args.level) elif args.action == "set_uart_level": mgmt.set_uart_log_level(args.level) elif args.action == "clear": mgmt.clear_log() else: print(mgmt.get_log(), end="") finally: mgmt.close()
def main(): args = get_argparser().parse_args() common_args.init_logger_from_args(args) if args.device is None: ddb = DeviceDB(args.device_db) core_addr = ddb.get("core", resolve_alias=True)["arguments"]["host"] else: core_addr = args.device mgmt = CommMgmt(core_addr) if args.tool == "log": if args.action == "set_level": mgmt.set_log_level(args.level) if args.action == "set_uart_level": mgmt.set_uart_log_level(args.level) if args.action == "clear": mgmt.clear_log() if args.action == None: print(mgmt.get_log(), end="") if args.tool == "config": if args.action == "read": value = mgmt.config_read(args.key) if not value: print("Key {} does not exist".format(args.key)) else: print(value) if args.action == "write": for key, value in args.string: mgmt.config_write(key, value.encode("utf-8")) for key, filename in args.file: with open(filename, "rb") as fi: mgmt.config_write(key, fi.read()) if args.action == "remove": for key in args.key: mgmt.config_remove(key) if args.action == "erase": mgmt.config_erase() if args.tool == "reboot": mgmt.reboot() if args.tool == "debug": if args.action == "allocator": mgmt.debug_allocator()
def test_compile(self): core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) mgmt.clear_log() with tempfile.TemporaryDirectory() as tmp: db_path = os.path.join(artiq_root, "device_db.py") subprocess.call([ sys.executable, "-m", "artiq.frontend.artiq_compile", "--device-db", db_path, "-e", "CheckLog", "-o", os.path.join(tmp, "check_log.elf"), __file__ ]) subprocess.call([ sys.executable, "-m", "artiq.frontend.artiq_run", "--device-db", db_path, os.path.join(tmp, "check_log.elf") ]) log = mgmt.get_log() self.assertIn("test_artiq_compile", log) mgmt.close()
def main(): args = get_argparser().parse_args() init_logger(args) device_mgr = DeviceManager(DeviceDB(args.device_db)) try: core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"] mgmt = CommMgmt(core_addr) if args.tool == "log": if args.action == "set_level": mgmt.set_log_level(args.level) if args.action == "set_uart_level": mgmt.set_uart_log_level(args.level) if args.action == "clear": mgmt.clear_log() if args.action == None: print(mgmt.get_log(), end="") if args.tool == "config": if args.action == "read": value = mgmt.config_read(args.key) if not value: print("Key {} does not exist".format(args.key)) else: print(value) if args.action == "write": for key, value in args.string: mgmt.config_write(key, value.encode("utf-8")) for key, filename in args.file: with open(filename, "rb") as fi: mgmt.config_write(key, fi.read()) if args.action == "remove": for key in args.key: mgmt.config_remove(key) if args.action == "erase": mgmt.config_erase() if args.tool == "reboot": mgmt.reboot() if args.tool == "hotswap": mgmt.hotswap(args.image.read()) if args.tool == "profile": if args.action == "start": mgmt.start_profiler(args.interval, args.hits_size, args.edges_size) elif args.action == "stop": mgmt.stop_profiler() elif args.action == "save": hits, edges = mgmt.get_profile() writer = CallgrindWriter(args.output, args.firmware, "or1k-linux", args.compression, args.demangle) writer.header() for addr, count in hits.items(): writer.hit(addr, count) for (caller, callee), count in edges.items(): writer.edge(caller, callee, count) if args.tool == "debug": if args.action == "allocator": mgmt.debug_allocator() finally: device_mgr.close_devices()
def main(): args = get_argparser().parse_args() init_logger(args) if args.device is None: core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"] else: core_addr = args.device mgmt = CommMgmt(core_addr) if args.tool == "log": if args.action == "set_level": mgmt.set_log_level(args.level) if args.action == "set_uart_level": mgmt.set_uart_log_level(args.level) if args.action == "clear": mgmt.clear_log() if args.action == None: print(mgmt.get_log(), end="") if args.tool == "config": if args.action == "read": value = mgmt.config_read(args.key) if not value: print("Key {} does not exist".format(args.key)) else: print(value) if args.action == "write": for key, value in args.string: mgmt.config_write(key, value.encode("utf-8")) for key, filename in args.file: with open(filename, "rb") as fi: mgmt.config_write(key, fi.read()) if args.action == "remove": for key in args.key: mgmt.config_remove(key) if args.action == "erase": mgmt.config_erase() if args.tool == "reboot": mgmt.reboot() if args.tool == "hotswap": mgmt.hotswap(args.image.read()) if args.tool == "profile": if args.action == "start": mgmt.start_profiler(args.interval, args.hits_size, args.edges_size) elif args.action == "stop": mgmt.stop_profiler() elif args.action == "save": hits, edges = mgmt.get_profile() writer = CallgrindWriter(args.output, args.firmware, "or1k-linux", args.compression, args.demangle) writer.header() for addr, count in hits.items(): writer.hit(addr, count) for (caller, callee), count in edges.items(): writer.edge(caller, callee, count) if args.tool == "debug": if args.action == "allocator": mgmt.debug_allocator()