Best Python code snippet using autotest_python
job.py
Source:job.py
...185 manage_stdout_and_stderr=True, redirect_fds=True)186 self.logging.start_logging()187 self._config = config.config(self)188 self.profilers = profilers.profilers(self)189 self._init_bootloader()190 self.machines = [options.hostname]191 self.machine_dict_list = [{'hostname' : options.hostname}]192 # Client side tests should always run the same whether or not they are193 # running in the lab.194 self.in_lab = False195 self.hosts = set([local_host.LocalHost(hostname=options.hostname,196 bootloader=self.bootloader)])197 self.args = []198 if options.args:199 self.args = self._parse_args(options.args)200 if options.user:201 self.user = options.user202 else:203 self.user = getpass.getuser()204 self.sysinfo.log_per_reboot_data()205 if not options.cont:206 self.record('START', None, None)207 self.harness.run_start()208 if options.log:209 self.enable_external_logging()210 self._init_cmdline(extra_copy_cmdline)211 self.num_tests_run = None212 self.num_tests_failed = None213 self.warning_loggers = None214 self.warning_manager = None215 def _init_drop_caches(self, drop_caches):216 """217 Perform the drop caches initialization.218 """219 self.drop_caches_between_iterations = (220 GLOBAL_CONFIG.get_config_value('CLIENT',221 'drop_caches_between_iterations',222 type=bool, default=True))223 self.drop_caches = drop_caches224 if self.drop_caches:225 utils.drop_caches()226 def _init_bootloader(self):227 """228 Perform boottool initialization.229 """230 tool = self.config_get('boottool.executable')231 self.bootloader = boottool.boottool(tool)232 def _init_packages(self):233 """234 Perform the packages support initialization.235 """236 self.pkgmgr = packages.PackageManager(237 self.autodir, run_function_dargs={'timeout':3600})238 def _init_cmdline(self, extra_copy_cmdline):239 """240 Initialize default cmdline for booted kernels in this job....
bootload.py
Source:bootload.py
...121 self._send_dual_packet(higgs.FPGA_ADDR['eth'], 0, delay)122 self._send_dual_packet(higgs.FPGA_ADDR[fpga], (0x17000000) | 0x1 | 0x2 | 0x4, delay*4) # does this work?123 # dont write the size message for file outputs124 if not self.dump_to_file:125 self._init_bootloader(fpga, delay)126 # long time after first packet to give a slow polling program a chance127 if not self.dump_to_file:128 time.sleep(1.0)129 # number of ringbus messages to send in a single udp packet130 # note that the ringbus address is repeated for every byte so this number should not be more than udpmaxlen / 2131 # (at the moment this method breaks dump_to_file support)132 chunk = 4133 # math for printing, 1/thresh is number of prints134 progress_thresh = 1.0/10.0135 progress_last_p = 0.0136 137 llen = len(self.program_opcode)138 fpga_ttl = higgs.FPGA_ADDR[fpga]139 pp = lambda a : print("Bootloading ({}) {:0.2f}%".format(fpga_ttl,a))140 # printing141 if print_progress:142 print("")143 pp(0)144 sys.stdout.flush()145 for i in range(0,llen, chunk):146 opcodes = self.program_opcode[i:i+chunk]147 self._send_variable_packet(fpga_ttl, opcodes, delay)148 if print_progress:149 progress_at = i/(1.0*llen)150 if progress_at > (progress_last_p + progress_thresh):151 pp(progress_at*100.0)152 sys.stdout.flush()153 progress_last_p += progress_thresh154 if print_progress:155 pp(100)156 print("")157 sys.stdout.flush()158 if not self.dump_to_file:159 logger.info('%d packets sent', llen)160 # right now eth requires the incoming DMAs to be cleared up after a bootload161 # we send 0x00000000 which is ignored by eth right now162 if fpga == 'eth' and not self.dump_to_file:163 logger.info('4 extra packets to help eth')164 time.sleep(1.0)165 for _ in range(4):166 self._send_dual_packet(fpga_ttl, 0, delay)167 168 def _init_bootloader(self, fpga, delay):169 filetype = "hex"170 '''Initialize Higgs to prepare bootloading sequence171 Initializing Higgs include telling Higgs which FPGA to bootload and the172 size of bootloader173 Args:174 fpga (str): Name of FPGA to bootload175 delay (float): Time delay between sending each packet176 '''177 # Setting destination FPGA to bootload178 # self._send_packet(FPGA_ADDR[fpga], PACKET_DELAY)179 if filetype == "hex":180 program_len = len(self.program_opcode)181 else:182 program_len = len(self.program_opcode)/2...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!