Get generated data file list from script

Use the generate_psa_tests.py script to generate the list
of test data files used as output files by cmake.

Do this by introducing a new option --list-for-cmake
that prints a semicolon-separated list of the data files
with no terminating newline (since this is how a cmake list
is represented).

Replace the hard-coded output file list with a variable
generated by the script using this option.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2021-10-15 19:10:15 +01:00
parent 9327fb33a6
commit e12e7f47de
2 changed files with 21 additions and 3 deletions

View file

@ -699,6 +699,8 @@ def main(args):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--list', action='store_true',
help='List available targets and exit')
parser.add_argument('--list-for-cmake', action='store_true',
help='Print \';\'-separated list of available targets and exit')
parser.add_argument('--directory', metavar='DIR',
help='Output directory (default: tests/suites)')
parser.add_argument('targets', nargs='*', metavar='TARGET',
@ -710,6 +712,15 @@ def main(args):
for name in sorted(generator.TARGETS):
print(generator.filename_for(name))
return
# List in a cmake list format (i.e. ';'-separated)
if options.list_for_cmake:
filenames = []
for name in sorted(generator.TARGETS):
if ';' in generator.filename_for(name):
raise ValueError('Cannot pass filename containing \';\' to cmake: ' + name)
filenames.append(generator.filename_for(name))
print(';'.join(filenames), end='')
return
if options.targets:
# Allow "-" as a special case so you can run
# ``generate_psa_tests.py - $targets`` and it works uniformly whether