def setUp(self): self.dut1 = DutInformation("plat1", "12345", "1", "vendor") self.dut2 = DutInformation("plat1", "23456", "2", "vendor") self.dut3 = DutInformation("plat2", "34567", "3", "vendor") array_of_duts = [self.dut1, self.dut2, self.dut3] self.testlist = DutInformationList(array_of_duts) self.emptylist = DutInformationList()
def test_build_sha(self): # pylint: disable=W0212 DutInformationList._cache = dict() info = DutInformation("plat1", "12345", "1", "vendor") self.assertEqual(info.build_binary_sha1, None) info.build_binary_sha1 = "123" self.assertEqual(info.build_binary_sha1, "123") DutInformationList._cache = dict()
def _alloc_error_helper(self): """ Helper for exception handling in the __init_duts method. """ d_info_list = [] for i, resource in enumerate(self.resource_configuration.get_dut_configuration()): dutinfo = DutInformation(resource.get("platform_name"), None, i) d_info_list.append(dutinfo) self._dutinformations = d_info_list
def __init__(self, type='process', name='process', config=None, params=None): Dut.__init__(self, name=name, params=params) GenericProcess.__init__(self, self.name, logger=self.logger) self.disable_io_prints() # because those are printed in Dut object self.proc = False self.type = type self.config = config if config else {} self.dutinformation = DutInformation(self.type, self.resource_id if self.resource_id else "", index=None, build=None) self.command = None
def __init__(self, name='serial', port=None, baudrate=460800, config=None, ch_mode_config=None, serial_config=None, params=None): Dut.__init__(self, name=name, params=params) ch_mode_config = ch_mode_config if ch_mode_config is not None else {} serial_config = serial_config if serial_config is not None else {} self.readthread = None self.port = False self.comport = port self.type = 'serial' self.name = port self.platform = '' self.serialparams = SerialParams( timeout=serial_config.get("serial_timeout", 0.01), xonxoff=serial_config.get("serial_xonxoff", False), rtscts=serial_config.get("serial_rtscts", False), baudrate=baudrate) self.chunkmodeparams = ChunkModeParams( on=ch_mode_config.get("ch_mode", False), size=ch_mode_config.get("ch_mode_chunk_size", 1), chunk_delay=ch_mode_config.get("ch_mode_ch_delay", 0.01), start_delay=ch_mode_config.get("ch_mode_start_delay", 0)) self.input_queue = deque() # Input queue self.daemon = True # Allow Python to stop us self.keep_reading = False if config: self.config.update(config) self.device = config.get("allocated", None) init_cli_cmds = None if "init_cli_cmds" in config["application"]: init_cli_cmds = config["application"]["init_cli_cmds"] if init_cli_cmds is not None: self.set_init_cli_cmds(init_cli_cmds) post_cli_cmds = None if "post_cli_cmds" in config["application"]: post_cli_cmds = config["application"]["post_cli_cmds"] if post_cli_cmds is not None: self.set_post_cli_cmds(post_cli_cmds) tid = self.config.get('allocated', {}).get('target_id', "unknown") self.dutinformation = DutInformation("serial", tid, index=self.index, build=self.build)
def test_result_metainfo_generation(self): pass_result = Result() pass_result.set_verdict('pass', 0, 10) dinfo = DutInformation("Test_platform", "123456", "1") dinfo.build = Build(ref="test_file", type="file") pass_result.add_dutinformation(dinfo) self.args_tc.branch = "test_branch" self.args_tc.commitId = "123456" self.args_tc.gitUrl = "url" self.args_tc.buildUrl = "url2" self.args_tc.campaign = "campaign" self.args_tc.jobId = "test_job" self.args_tc.toolchain = "toolchain" self.args_tc.buildDate = "today" pass_result.build_result_metadata(args=self.args_tc) self.assertEqual(pass_result.build_branch, "test_branch") self.assertEqual(pass_result.buildcommit, "123456") self.assertEqual(pass_result.build_git_url, "url") self.assertEqual(pass_result.build_url, "url2") self.assertEqual(pass_result.campaign, "campaign") self.assertEqual(pass_result.job_id, "test_job") self.assertEqual(pass_result.toolchain, "toolchain") self.assertEqual(pass_result.build_date, "today")