From aaaabab0d2b5c6bef1547d25bae16b82fbf8e931 Mon Sep 17 00:00:00 2001 From: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com> Date: Mon, 18 Oct 2021 23:52:54 +0900 Subject: [PATCH 1/4] run_*.py: check the return value from verify_benchmark() decode_results() gets the return value, but it has never been used. - run_gdbserver_sim.py - run_mac.py - run_native.py - run_stm32f4-discovery.py --- pylib/run_gdbserver_sim.py | 4 ++++ pylib/run_mac.py | 4 ++++ pylib/run_native.py | 4 ++++ pylib/run_stm32f4-discovery.py | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/pylib/run_gdbserver_sim.py b/pylib/run_gdbserver_sim.py index e2269675..624b86f1 100644 --- a/pylib/run_gdbserver_sim.py +++ b/pylib/run_gdbserver_sim.py @@ -99,6 +99,10 @@ def decode_results(stdout_str, stderr_str): if not rcstr: log.debug('Warning: Failed to find return code') return 0.0 + exit_status = int(rcstr.group(1)) + if exit_status: + log.debug('Warning: verify_benchmark() failed') + return 0.0 # The start and end cycle counts are in the stderr string times = re.search('(\d+)\D+(\d+)', stderr_str, re.S) diff --git a/pylib/run_mac.py b/pylib/run_mac.py index 6b789093..a01b1ca5 100644 --- a/pylib/run_mac.py +++ b/pylib/run_mac.py @@ -58,6 +58,10 @@ def decode_results(stdout_str, stderr_str): if not rcstr: log.debug('Warning: Failed to find return code') return 0.0 + exit_status = int(rcstr.group(1)) + if exit_status: + log.debug('Warning: verify_benchmark() failed') + return 0.0 # Match "Real time: dd.ddd" time = re.search('^Real time: (\d+)[.](\d+)', stdout_str, re.S) diff --git a/pylib/run_native.py b/pylib/run_native.py index df5a73cf..0ed98033 100644 --- a/pylib/run_native.py +++ b/pylib/run_native.py @@ -58,6 +58,10 @@ def decode_results(stdout_str, stderr_str): if not rcstr: log.debug('Warning: Failed to find return code') return 0.0 + exit_status = int(rcstr.group(1)) + if exit_status: + log.debug('Warning: verify_benchmark() failed') + return 0.0 # Match "real s.mm?m?" time = re.search('^real (\d+)[.](\d+)', stderr_str, re.S) diff --git a/pylib/run_stm32f4-discovery.py b/pylib/run_stm32f4-discovery.py index d83283ac..e1c7de4b 100644 --- a/pylib/run_stm32f4-discovery.py +++ b/pylib/run_stm32f4-discovery.py @@ -97,6 +97,10 @@ def decode_results(stdout_str, stderr_str): if not rcstr: log.debug('Warning: Failed to find return code') return 0.0 + exit_status = int(rcstr.group(1)) + if exit_status: + log.debug('Warning: verify_benchmark() failed') + return 0.0 # The start and end cycle counts are in the stderr string starttime = re.search('\$1 = (\d+)', stdout_str, re.S) From 7e14134cbcbdeb8c1f9aa31d75834fe43aaa64db Mon Sep 17 00:00:00 2001 From: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com> Date: Tue, 19 Oct 2021 22:20:11 +0900 Subject: [PATCH 2/4] build_all.py: catch a general Exception from a config file - During loading a config file, various exceptions may occur. "PermissionError" is replaced by "Exception". - add missing formatting specifier 'f' on the error message. --- build_all.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_all.py b/build_all.py index c154a289..0c0de13f 100755 --- a/build_all.py +++ b/build_all.py @@ -386,8 +386,8 @@ def set_parameters(args): with open(conf_file) as fileh: try: exec(fileh.read(), globals(), config[conf]) - except PermissionError: - log.error('ERROR: Corrupt config file {conf_file}: exiting') + except Exception: + log.error(f'ERROR: Corrupt config file "{conf_file}": exiting') sys.exit(1) # Populate user values from the command line From cf3d79cb458bf485a997cc23916368dd2641c76e Mon Sep 17 00:00:00 2001 From: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com> Date: Tue, 19 Oct 2021 22:30:06 +0900 Subject: [PATCH 3/4] build_all.py: fix log-output format - suppress the output of unnecessary blank lines - output a blank line after each group compiled or linked --- build_all.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build_all.py b/build_all.py index 0c0de13f..471afdb2 100755 --- a/build_all.py +++ b/build_all.py @@ -681,8 +681,10 @@ def link_benchmark(bench): log.warning('Warning: Link of benchmark "{bench}" failed'.format(bench=bench)) succeeded = False - log.debug(res.stdout.decode('utf-8')) - log.debug(res.stderr.decode('utf-8')) + if (len(res.stdout) != 0): + log.debug(res.stdout.decode('utf-8')) + if (len(res.stderr) != 0): + log.debug(res.stderr.decode('utf-8')) except subprocess.TimeoutExpired: log.warning('Warning: link of benchmark "{bench}" timed out'.format(bench=bench)) @@ -735,6 +737,7 @@ def main(): successful = compile_support() if successful: log.debug('Compilation of support files successful') + log.debug('') for bench in benchmarks: res = compile_benchmark(bench) @@ -745,7 +748,7 @@ def main(): successful &= res if res: log.debug('Linking of benchmark "{bench}" successful'.format(bench=bench)) - log.info(bench) + log.debug('') if successful: log.info('All benchmarks built successfully') From 88a9f783ead6379aae83ddb32568e71ec79539f9 Mon Sep 17 00:00:00 2001 From: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com> Date: Mon, 18 Oct 2021 23:57:17 +0900 Subject: [PATCH 4/4] .gitignore: add some common entries .venv: a commion directory for Python virtual environment .vscode: configuration file directory for VS Code --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 3b04262c..cbc97a7b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,13 @@ *.swp *.tmp +# configuration file directory for VS Code +.vscode/ + # Python things __pycache__/ .pylintrc +.venv/ # Default build and log directories bd/