On Tue, Mar 12, 2013 at 01:21:34AM -0300, Lucas Meneghel Rodrigues wrote:
On 03/08/2013 03:16 PM, Don Zickus wrote:
>This is the bulk of the harness file for enabling beaker.
>
>The idea is to bootstrap it by downloading the remote xml file, parse it,
>convert it into a control file and pass that to autotest.
>
>The rest of the harness has various hacks to deal with passing info
>from autotest to beaker.
>
>The backend classes will be shown in the next patches.
Would've been better to include the backend classes first, as for a
logical progression.
Good Tip! I rushed these out. Usually I push patches as pieces instead
of whole files, so I wasn't thinking which files are more interesting
first.
>+ test.write(" def run_once(self):\n")
>+ test.write(" os.chdir('%s')\n" % task.rpmPath)
>+ #test.write(" raw_output = utils.system_output('make
run', retain_output=True)\n")
^ I wonder why make run itself is commented here.
>+ test.write(" raw_output = utils.system_output('make
help', retain_output=True)\n")
Sorry debug code. I didn't want to run the whole 'make run' as the
backend stuff wasn't ready. So I used the above 'make help' instead to
quickly validate the beaker environment.
Yeah, there is no 'sleep' test (that I know of) that is useful for
debugging like autotest has. ;-)
>+
>+ def tearDown(self):
>+ '''called from complete and abort. clean up and
shutdown'''
>+ self.recipe_upload_files(self.recipe_xml.id)
>+ self.kill_watchdog()
>+
>+ def start_watchdog(self, heartbeat):
>+ log.debug('harness: Starting watchdog process, heartbeat: %d' %
heartbeat)
>+ try:
>+ pid = os.fork()
^ I believe it is better to register a signal handler here. Another problem
I guess I don't follow. I thought this was using a signal handler with the
try/except loop?
>+
>+def getBeakerCode(at_code):
>+ bkr_status = 'warn'
>+ if at_code == 'END GOOD':
>+ bkr_status = 'pass_'
Funny, I wonder why the underscore here.
I don't know, I'll have to ask Jan.
>+ if at_code == 'END WARN':
>+ bkr_status = 'warn'
>+ if at_code == 'END FAIL':
>+ bkr_status = 'fail'
>+ if at_code == 'END ERROR':
>+ bkr_status = 'fail'
>+ if at_code == 'END ABORT':
>+ bkr_status = 'fail'
if at_code in ['END WARN', 'END FAIL', 'END ERROR', 'END
ABORT']:
bkr_status = 'fail'
Heh. Thanks.
Thanks for all the tips.
Cheers,
Don