• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1REQUIRED_FILES
2--------------
3
4List of files required to run the test.  The filenames are relative to the
5test :prop_test:`WORKING_DIRECTORY` unless an absolute path is specified.
6
7If set to a list of files, the test will not be run unless all of the
8files exist.
9
10Examples
11~~~~~~~~
12
13Suppose that ``test.txt`` is created by test ``baseTest`` and ``none.txt``
14does not exist:
15
16.. code-block:: cmake
17
18  add_test(NAME baseTest ...)   # Assumed to create test.txt
19  add_test(NAME fileTest ...)
20
21  # The following ensures that if baseTest is successful, test.txt will
22  # have been created before fileTest is run
23  set_tests_properties(fileTest PROPERTIES
24    DEPENDS baseTest
25    REQUIRED_FILES test.txt
26  )
27
28  add_test(NAME notRunTest ...)
29
30  # The following makes notRunTest depend on two files. Nothing creates
31  # the none.txt file, so notRunTest will fail with status "Not Run".
32  set_tests_properties(notRunTest PROPERTIES
33    REQUIRED_FILES "test.txt;none.txt"
34  )
35
36The above example demonstrates how ``REQUIRED_FILES`` works, but it is not the
37most robust way to implement test ordering with failure detection.  For that,
38test fixtures are a better alternative (see :prop_test:`FIXTURES_REQUIRED`).
39