Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve error log reporting when embench fails #556

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion bin/run_embench.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import sys
import subprocess
import jinja2
import glob
import re


Expand Down Expand Up @@ -216,7 +217,10 @@ def main():
#Check if benchmark run succeeded
if not run_passed(res.stdout, args.type):
logging.fatal(f"EMBench benchmark run failed")

log_file = get_log_file(args.core, paths, args.type)
if log_file:
logging.info('For more debug check EMBench log: {}'.format(log_file))
sys.exit(1)

if check_result(res.stdout, args.target, args.type) and args.target != 0:
print(f"Benchmark run met target")
Expand Down Expand Up @@ -324,6 +328,7 @@ def build_paths(core):
paths['libcfg'] = paths['core'] + '/tests/embench/config/corev32'
paths['libpy'] = paths['core'] + '/tests/embench/pylib'
paths['vlib'] = paths['core'] + '/vendor_lib'
paths['emb_logs'] = paths['core'] + '/vendor_lib/embench/logs'
paths['make'] = paths['core'] + '/sim/uvmt'
paths['embench'] = paths['vlib'] + '/embench'
paths['emcfg'] = paths['embench'] + '/config/corev32'
Expand Down Expand Up @@ -390,6 +395,17 @@ def check_python_version(major, minor):
log.error('ERROR: Requires Python {mjr}.{mnr} or later'.format(mjr=major, mnr=minor))
sys.exit(1)

def get_log_file(core, paths, log_type):
'''Find the log file from EMBench by looking for the latest touched file'''
last_mtime = 0
file = None
for f in glob.glob(os.path.join(paths['emb_logs'], '{}-*.log'.format(log_type))):
if last_mtime < os.stat(f).st_mtime:
last_mtime = os.stat(f).st_mtime
file = f

print('Latest log = {}'.format(file))
return file

#run main
if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions cv32e40x/tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ csrc
inter.vpd
ucli.key
vc_hdrs.h
emb_*/
2 changes: 2 additions & 0 deletions cv32e40x/vendor_lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
embench/

12 changes: 9 additions & 3 deletions mk/Common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,19 @@ sanity: hello-world
###############################################################################
# Read YAML test specifications

ifeq ($(VERBOSE),1)
YAML2MAKE_DEBUG = --debug
else
YAML2MAKE_DEBUG =
endif

# If the gen_corev-dv target is defined then read in a test specification file
YAML2MAKE = $(CORE_V_VERIF)/bin/yaml2make
ifneq ($(filter gen_corev-dv,$(MAKECMDGOALS)),)
ifeq ($(TEST),)
$(error ERROR must specify a TEST variable with gen_corev-dv target)
endif
GEN_FLAGS_MAKE := $(shell $(YAML2MAKE) --test=$(TEST) --yaml=corev-dv.yaml --debug --prefix=GEN --core=$(CV_CORE))
GEN_FLAGS_MAKE := $(shell $(YAML2MAKE) --test=$(TEST) --yaml=corev-dv.yaml $(YAML2MAKE_DEBUG) --prefix=GEN --core=$(CV_CORE))
ifeq ($(GEN_FLAGS_MAKE),)
$(error ERROR Could not find corev-dv.yaml for test: $(TEST))
endif
Expand All @@ -306,7 +312,7 @@ ifneq ($(filter $(TEST_YAML_PARSE_TARGETS),$(MAKECMDGOALS)),)
ifeq ($(TEST),)
$(error ERROR must specify a TEST variable)
endif
TEST_FLAGS_MAKE := $(shell $(YAML2MAKE) --test=$(TEST) --yaml=test.yaml --debug --run-index=$(RUN_INDEX) --prefix=TEST --core=$(CV_CORE))
TEST_FLAGS_MAKE := $(shell $(YAML2MAKE) --test=$(TEST) --yaml=test.yaml $(YAML2MAKE_DEBUG) --run-index=$(RUN_INDEX) --prefix=TEST --core=$(CV_CORE))
ifeq ($(TEST_FLAGS_MAKE),)
$(error ERROR Could not find test.yaml for test: $(TEST))
endif
Expand All @@ -319,7 +325,7 @@ CFGYAML2MAKE = $(CORE_V_VERIF)/bin/cfgyaml2make
CFG_YAML_PARSE_TARGETS=comp test
ifneq ($(filter $(CFG_YAML_PARSE_TARGETS),$(MAKECMDGOALS)),)
ifneq ($(CFG),)
CFG_FLAGS_MAKE := $(shell $(CFGYAML2MAKE) --yaml=$(CFG).yaml --debug --prefix=CFG --core=$(CV_CORE))
CFG_FLAGS_MAKE := $(shell $(CFGYAML2MAKE) --yaml=$(CFG).yaml $(YAML2MAKE_DEBUG) --prefix=CFG --core=$(CV_CORE))
ifeq ($(CFG_FLAGS_MAKE),)
$(error ERROR Error finding or parsing configuration: $(CFG).yaml)
endif
Expand Down
2 changes: 2 additions & 0 deletions mk/uvmt/unsim.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ no_rule:
@echo 'no SIMULATOR and rule/target specified.'
@echo 'Usage: make SIMULATOR=<simulator> <target>'
@echo 'e.g: make SIMULATOR=xrun hello-world'
@exit 1

%::
@echo '$(SIMULATOR): unknown simulator'
@exit 1