How to use parse_quickcmd method in autotest

Best Python code snippet using autotest_python

harness_beaker.py

Source: harness_beaker.py Github

copy

Full Screen

...95 raise error.HarnessError("Bad use of 'quickcmd'")96 self.cmd = a[9:]97 else:98 raise error.HarnessError("Unknown beaker harness arg: %s" % a)99 def parse_quickcmd(self, args):100 # hack allow tests to quickly submit feedback through harness101 if not args:102 return103 if 'BEAKER_TASK_ID' not in os.environ:104 raise error.HarnessError("No BEAKER_TASK_ID set")105 task_id = os.environ['BEAKER_TASK_ID']106 # Commands are from tests and should be reported as results107 cmd, q_args = args.split(':')108 if cmd == 'submit_log':109 try:110 # rhts_submit_log has as args: -S -T -l111 # we just care about -l112 f = None113 arg_list = q_args.split(' ')114 while arg_list:115 arg = arg_list.pop(0)116 if arg == '-l':117 f = arg_list.pop(0)118 break119 if not f:120 raise HarnessException("Argument -l not found in q_args "121 "'%s'" % q_args)122 self.bkr_proxy.task_upload_file(task_id, f)123 except Exception:124 logging.critical('ERROR: Failed to process quick cmd %s' % cmd)125 elif cmd == 'submit_result':126 def init_args(testname='Need/​a/​testname/​here', status="None", logfile=None, score="0"):127 return testname, status, logfile, score128 try:129 # report_result has TESTNAME STATUS LOGFILE SCORE130 arg_list = q_args.split(' ')131 testname, status, logfile, score = init_args(*arg_list)132 resultid = self.bkr_proxy.task_result(task_id, status,133 testname, score, '')134 if (logfile and os.path.isfile(logfile) and135 os.path.getsize(logfile) != 0):136 self.bkr_proxy.result_upload_file(task_id, resultid, logfile)137 # save the dmesg file138 dfile = '/​tmp/​beaker.dmesg'139 utils.system('dmesg -c > %s' % dfile)140 if os.path.getsize(dfile) != 0:141 self.bkr_proxy.result_upload_file(task_id, resultid, dfile)142 # os.remove(dfile)143 except Exception:144 logging.critical('ERROR: Failed to process quick cmd %s' % cmd)145 elif cmd == 'reboot':146 # we are in a stub job. Can't use self.job.reboot() :-(147 utils.system("sync; sync; reboot")148 self.run_pause()149 raise error.JobContinue("more to come")150 else:151 raise error.HarnessError("Bad sub-quickcmd: %s" % cmd)152 def bootstrap(self, fetchdir):153 '''How to kickstart autotest when you have no control file?154 You download the beaker XML, convert it to a control file155 and pass it back to autotest. Much like bootstrapping.. :-)156 '''157 # hack to sneakily pass results back to beaker without running158 # autotest. Need to avoid calling get_recipe below159 if self.cmd:160 self.parse_quickcmd(self.cmd)161 return None162 recipe = self.init_recipe_from_beaker()163 # remove stale file164 if os.path.isfile(self.state_file):165 os.remove(self.state_file)166 self.tests = {}167 # sanity check168 if self.recipe_id != recipe.id:169 raise error.HarnessError('Recipe mismatch: machine %s.. != XML %s..' %170 (self.recipe_id, recipe.id))171 # create unique name172 control_file_name = recipe.job_id + '_' + recipe.id + '.control'173 control_file_path = fetchdir + '/​' + control_file_name174 logging.debug('setting up control file - %s' % control_file_path)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

How To Choose The Right Mobile App Testing Tools

Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Appium Testing Tutorial For Mobile Applications

The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful