[Beaker-devel] [Autotest] [RFC PATCH 4/4] harness: new beaker harness
Don Zickus
dzickus at redhat.com
Wed Apr 3 17:50:33 UTC 2013
On Tue, Apr 02, 2013 at 08:49:29PM -0300, Lucas Meneghel Rodrigues wrote:
> >+ def upload_task_files(self, except_dirs):
> >+ log.debug('Uploading results except dirs: ' + str(except_dirs))
> >+ task = self.recipe_xml.task[0]
> >+ path = self.job.resultdir + '/' + self.getTestName(task)
> >+
> >+ for root, dirnames, files in sorted(os.walk(path)):
> >+ for name in files:
> >+ #strip full path
> >+ basedir = re.sub(path + "/", "", root)
> >+ result_file = root + '/' + name
> >+ self.bkr_proxy.task_upload_file(result_file,
> >+ task.id, name, basedir)
> >+
> >+ '''do not upload previously uploaded results files'''
> >+ for edir in task.excluded_dir:
> >+ if edir in dirnames:
> >+ dirnames.remove(edir)
> >+
> >+ '''add test name in future excluded directories for recipe'''
> >+ self.recipe_xml.excluded_dir.append(self.getTestName(task))
>
> Here in the method above you forgot to update the calls to the
> task_upload_file API, which has changed when you rewrote bkr_proxy.
> I took a shot at trying to fix the function, check it out:
Yeah, this is one of those functions I haven't started playing with
because I haven't figured out what files I wanted uploaded. Hence the rot
you found. I think your change looks fine on the surface.
My upload testing has been done with the function below it,
upload_test_results().
>
> > def upload_task_files(self, except_dirs):
> >- log.debug('Uploading results except dirs: ' + str(except_dirs))
> >+ log.debug('Uploading results except dirs: %s', str(except_dirs))
> > task = self.recipe_xml.task[0]
> >- path = self.job.resultdir + '/' + self.getTestName(task)
> >+ path = os.path.join(self.job.resultdir, self.getTestName(task))
> >
> > for root, dirnames, files in sorted(os.walk(path)):
> > for name in files:
> >- #strip full path
> >+ # Strip the base dir (path) for the remote path
> > basedir = re.sub(path + "/", "", root)
> >- result_file = root + '/' + name
> >- self.bkr_proxy.task_upload_file(result_file,
> >- task.id, name, basedir)
> >+ remotepath = os.path.join(basedir, name)
> >+ # The localfile has the full path
> >+ localfile = os.path.join(root, name)
> >+ # Upload the file
> >+ self.bkr_proxy.task_upload_file(task.id, localfile,
> >+ remotepath)
>
>
> I *think* this is right, it was just something that came up with the
> basic checks I usually put the patchsets through. Other than this
> small mistake, I found some trailing whitespace errors and other
> little indentation problems. Would you please fix this real quick,
> use utils/reindent.py to reindent both client/harness_beaker.py and
> client/bkr_proxy.py and send an updated patchset? Thanks!
Heh, close! task.id doesn't exist. It would be passed in as a parameter.
:-) But I like the os.path.join idea! I'll work on pulling that in.
Cheers,
Don
More information about the Beaker-devel
mailing list