Skip to content

Commit

Permalink
Merge pull request #135 from narasimhan-v/job_folder_empty_fix
Browse files Browse the repository at this point in the history
Fix job log path when job folder is empty
  • Loading branch information
Satheesh Rajendran authored Jul 8, 2019
2 parents ba27d53 + fa809a0 commit f12b2cc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions avocado-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ def __init__(self, name, resultdir, vt_type, test=None, mux=None, args=None):
self.vt_type = None

def jobdir(self):
cmd = 'grep %s %s/*/id|grep job-|cut -d":" -f1' % (self.id, self.resultdir)
self.job_dir = helper.runcmd(cmd)[1]
cmd = 'grep %s %s/*/id|grep job-' % (self.id, self.resultdir)
status, self.job_dir = helper.runcmd(cmd, ignore_status=True)
if status != 0:
return ''
self.job_dir = self.job_dir.split(':')[0]
return os.path.dirname(self.job_dir)

def config(self):
Expand Down Expand Up @@ -367,8 +370,12 @@ def run_test(testsuite, avocado_bin):
testsuite.runstatus("Not_Run", "Command execution failed")
return
logger.info('')
result_link = "%s/job.log" % testsuite.jobdir()
testsuite.runstatus("Run", "Successfully executed", result_link)
result_link = testsuite.jobdir()
if result_link:
result_link += "/job.log"
testsuite.runstatus("Run", "Successfully executed", result_link)
else:
testsuite.runstatus("Not_Run", "Unable to find job log file")
return


Expand Down

0 comments on commit f12b2cc

Please sign in to comment.