1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-28 15:58:43 +00:00

workloads/dhrystone: Fix crash if workload did not complete

Only try to process output from the workload if it is available.
This commit is contained in:
Marc Bonnici 2018-03-23 12:04:24 +00:00 committed by setrofim
parent 72f2f82594
commit 120ea20ea0

View File

@ -100,6 +100,7 @@ class Dhrystone(Workload):
self.target.killall('dhrystone') self.target.killall('dhrystone')
def run(self, context): def run(self, context):
self.output = None
try: try:
self.output = self.target.execute(self.command, self.output = self.target.execute(self.command,
timeout=self.timeout, timeout=self.timeout,
@ -109,12 +110,16 @@ class Dhrystone(Workload):
raise raise
def extract_results(self, context): def extract_results(self, context):
outfile = os.path.join(context.output_directory, 'dhrystone.output') if self.output:
with open(outfile, 'w') as wfh: outfile = os.path.join(context.output_directory, 'dhrystone.output')
wfh.write(self.output) with open(outfile, 'w') as wfh:
context.add_artifact('dhrystone-output', outfile, 'raw', "dhrystone's stdout") wfh.write(self.output)
context.add_artifact('dhrystone-output', outfile, 'raw', "dhrystone's stdout")
def update_output(self, context): def update_output(self, context):
if not self.output:
return
score_count = 0 score_count = 0
dmips_count = 0 dmips_count = 0
total_score = 0 total_score = 0