diff options
author | Michael Hirsch <scivision@users.noreply.github.com> | 2020-06-03 20:33:36 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2020-06-08 23:20:23 (GMT) |
commit | 6b751752195f3ca6c71889c7342e0ce41c806fb4 (patch) | |
tree | 738c1c8816b4eb38239af985593e8a68592932a4 /Help | |
parent | 61139c91d25302c9b7594b73638093d96af9539a (diff) | |
download | CMake-6b751752195f3ca6c71889c7342e0ce41c806fb4.zip CMake-6b751752195f3ca6c71889c7342e0ce41c806fb4.tar.gz CMake-6b751752195f3ca6c71889c7342e0ce41c806fb4.tar.bz2 |
Help: Add example for REQUIRED_FILES test property
Diffstat (limited to 'Help')
-rw-r--r-- | Help/prop_test/REQUIRED_FILES.rst | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/Help/prop_test/REQUIRED_FILES.rst b/Help/prop_test/REQUIRED_FILES.rst index fac357c..baf209c 100644 --- a/Help/prop_test/REQUIRED_FILES.rst +++ b/Help/prop_test/REQUIRED_FILES.rst @@ -1,7 +1,38 @@ REQUIRED_FILES -------------- -List of files required to run the test. +List of files required to run the test. The filenames are relative to the +test :prop_test:`WORKING_DIRECTORY` unless an absolute path is specified. If set to a list of files, the test will not be run unless all of the files exist. + +Examples +~~~~~~~~ + +Suppose that ``test.txt`` is created by test ``baseTest`` and ``none.txt`` +does not exist: + +.. code-block:: cmake + + add_test(NAME baseTest ...) # Assumed to create test.txt + add_test(NAME fileTest ...) + + # The following ensures that if baseTest is successful, test.txt will + # have been created before fileTest is run + set_tests_properties(fileTest PROPERTIES + DEPENDS baseTest + REQUIRED_FILES test.txt + ) + + add_test(NAME notRunTest ...) + + # The following makes notRunTest depend on two files. Nothing creates + # the none.txt file, so notRunTest will fail with status "Not Run". + set_tests_properties(notRunTest PROPERTIES + REQUIRED_FILES "test.txt;none.txt" + ) + +The above example demonstrates how ``REQUIRED_FILES`` works, but it is not the +most robust way to implement test ordering with failure detection. For that, +test fixtures are a better alternative (see :prop_test:`FIXTURES_REQUIRED`). |