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>
diff --git a/tests/scripts/generate_psa_tests.py b/tests/scripts/generate_psa_tests.py
index 260a4c4..16e27ee 100755
--- a/tests/scripts/generate_psa_tests.py
+++ b/tests/scripts/generate_psa_tests.py
@@ -699,6 +699,8 @@
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 @@
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