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:
parent
9327fb33a6
commit
e12e7f47de
2 changed files with 21 additions and 3 deletions
|
@ -17,11 +17,18 @@ endif()
|
|||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/suites)
|
||||
|
||||
if(DEV_MODE)
|
||||
execute_process(
|
||||
COMMAND
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_psa_tests.py
|
||||
--list-for-cmake
|
||||
--directory ${CMAKE_CURRENT_BINARY_DIR}/suites
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
OUTPUT_VARIABLE
|
||||
TEST_SUITE_DATA_FILES)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_psa_crypto_not_supported.generated.data
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_psa_crypto_storage_format.current.data
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_psa_crypto_storage_format.v0.data
|
||||
${TEST_SUITE_DATA_FILES}
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue