From 9de1b74ed1b8af942b82be8ee53edc4278b34fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Thu, 3 Feb 2022 19:35:35 +0100 Subject: Add CMake variable to pass arguments to ctest This is needed in order to for example turn tarmac tracing on for the FVP running the tests. Change-Id: I6606134046c2e228d3fe06db41792e7403cd6ba8 --- scripts/run_ctest.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'scripts') diff --git a/scripts/run_ctest.py b/scripts/run_ctest.py index 1faf0e2..93a5427 100755 --- a/scripts/run_ctest.py +++ b/scripts/run_ctest.py @@ -21,6 +21,8 @@ import argparse import subprocess import sys +import os +from pathlib import Path def __print_arguments(args): if isinstance(args, list): @@ -89,6 +91,25 @@ def run_corstone_300(args): '-C', 'mps3_board.uart0.unbuffered_output=1', '-C', 'mps3_board.uart0.shutdown_on_eot=1'] + if args.tarmac: + try: + pvlib_home = Path(os.getenv('PVLIB_HOME')) + except: + raise Exception("Environment variable PVLIB_HOME not found. Needed to produce tarmac trace.") + + if sys.platform == 'linux': + tarmac_trace_plugin = pvlib_home / Path('plugins/Linux64_GCC-7.3/TarmacTrace.so') + else: + raise Exception("tarmac trace: This feature is not currently supported on" + sys.platform) + + if tarmac_trace_plugin.exists(): + print("Tarmac trace will be created"); + basename = [ e for e in args.args if e.endswith('.elf')][0][:-4] + cmd += ['--plugin', str(tarmac_trace_plugin)] + cmd += ['-C', f'TRACE.TarmacTrace.trace-file={basename}.trace'] + else: + raise Exception("tarmac trace: Can't find TarmacTrace plugin in " + pvlib_home) + cmd += args.args return run_fvp(cmd) @@ -129,6 +150,8 @@ if __name__ == '__main__': parser.add_argument('-t', '--target', choices=['corstone-300', 'corstone-polaris'], required=True, help='FVP target.') parser.add_argument('-a', '--arch', choices=['ethos-u55', 'ethos-u65'], help='NPU architecture.') parser.add_argument('-m', '--macs', type=int, choices=[32, 64, 128, 256, 512], default=128, help='NPU number of MACs.') + parser.add_argument('-c', '--tarmac', dest='tarmac', action='store_true', help='Collect tarmac traces when running FVP.') + parser.add_argument('args', nargs='+', help='Arguments.') args = parser.parse_args() -- cgit v1.2.1