Commit 1e8d2b69 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

Update english

parent 1a141759
Pipeline #20070 passed with stages
in 26 seconds
......@@ -420,15 +420,21 @@ camitk_disable_tests(TESTS action-myaction-level1-10
)
```
This will disable test named `action-myaction-level1-10` (this test was automatically generated by the CamiTK test framework). You can of course use this macro for any test even tests that you added manually.
This will disable the test named `action-myaction-level1-10` (which suppose that the test named `action-myaction-level1-10` was automatically generated by the CamiTK test framework when the developer added the `ENABLE_AUTO_TEST` flag to the `camitk_extension` macro).
Basically, `camitk_disable_tests` macro encapsulates CMake `set_tests_properties` in order to manage version older that CMake 3.9 and to force you to give a (good) reason for bypassing the corresponding tests.
If CMake version is lower than 3.9, the test(s) is/are executed but with the `WILL_FAIL` (i.e., a failed test is considered as passed).
If CMake version is lower than 3.9, the listed tests are still executed but with the `WILL_FAIL` property (i.e., the tests will failed, but will be considered as passed). There are no other way to disable test in CMake prior to version 3.9
You can list as many tests as required in the `TESTS` argument.
You can of course use this macro for any existing test, even for tests that you added manually without the macro provided by the CamiTK test framework.
### Define specific requirement for some tests
Some of your tests (manually generated or automatically generated by the CamiTK test framework) might need to be disabled due to the environment/testbed (e.g., if a test can only pass for a specific version of VTK, or if not run on a virtual desktop...). Use the `camitk_tests_requirement` macro to specify the requirement of specific tests. For instance:
Sometimes some tests (manually generated or automatically generated by the CamiTK test framework) need to be disabled because they can only run properly in a given environment/testbed.
If the specific environment does not match with the actual environment, theses tests _are known_ to fail, and that is expected. For instance, some test can only pass if compiled and linked with a specific version of the VTK library, or if it is run on a specific OS.
Use the `camitk_tests_requirement` macro to specify the requirement of specific tests. For instance:
```cmake
camitk_extension(ACTION_EXTENSION
......@@ -449,7 +455,7 @@ camitk_tests_requirement(TESTS action-itkfilters-integration-test
This test will pass when run directly from a physical windows machine."
)
# disable three tests if VTK version is not a specific version (this is a three-parts requirement statement)
# disable three tests if the action is not compiled using a specific VTK version (this is a three-parts requirement statement)
camitk_tests_requirement(TESTS action-myaction-level1-3 action-myaction-level1-6 action-myaction-level1-11
REQUIRES "${VTK_VERSION} VERSION_EQUAL 6.3"
REASON "VTK version is not equals than 6.3
......@@ -459,20 +465,21 @@ camitk_tests_requirement(TESTS action-myaction-level1-3 action-myaction-level1-6
```
`camitk_tests_requirement` will disable one or more tests if a specific requirement is not met.
It allows for specific test management in case the developper knows that a given test requires a given environment or can not be run in a given environment.
It encapsulates CMake `set_tests_properties`, allows for specifying a requirement and force you to give a (good) reason for bypassing the tests.
`camitk_tests_requirement` will automatically disable one or more tests if a specific requirement is not met.
This macro allows for specific test management in case the developper knows that a given test requires a specific given environment or can not be run (or will fail) in a given environment.
It encapsulates CMake `set_tests_properties`, needs a specific requirement statement (using the `REQUIRES` parameter) and force you to give a (good) reason for bypassing the tests.
The requirement statement is a string that looks like a CMake test statement. It defines a subset of possible test that can check the current environment (OS, library/dependencies version...etc...)
If the requirements are not met, the listed tests are disabled.
The requirement statement is a string that looks like a CMake test statement.
It defines a subset of possible tests that should be used to check the current environment (OS, library/dependencies version...etc...).
If the requirements checked by the `REQUIRES` parameter are not met, the listed tests are disabled.
`REQUIRES` statement looks like a CMake test statement but is restricted to a subset of CMake `if` statement. It can have one, two or three parts.
A `REQUIRES` statement looks like a CMake test statement but is restricted to a small subset of possible CMake `if` statement.
A `REQUIRES` statement can have one, two or three parts (as of Feb 2019):
There is three types of `REQUIRES` statement:
- one-part statement are used to check the OS. Possible values are (as of Feb 2019) `"WIN32"`, `"WIN64"`, `"MSVC"`, `"APPLE"` or `"UNIX"`
- two-parts statement are used to check the opposite of the one-part statement using the `NOT` prefix. In the example given above, the test `action-itkfilters-integration-test` is ran only if the requirement `"NOT WIN32"` is met (e.g., if the platform is not `WIN32`). Possible values are therefore (as of Feb 2019) `"NOT WIN32"`, `"NOT WIN64"`, `"NOT MSVC"`, `"NOT APPLE"` or `"NOT UNIX"`
- three-parts statement are used to check the version of a library/dependency. It is composed of a left value (that is evaluated by the caller CMakeList, not inside the macro) followed by a test statement and a right value (also evaluated by the caller `CMakeList.txt`). Possible test statements are (as of Feb 2019) `VERSION_LESS`, `VERSION_EQUAL` or `VERSION_GREATER`. In the example above, tests `action-myaction-level1-3` `action-myaction-level1-6` `action-myaction-level1-11` are ran only if the variable `VTK_VERSION` (as set at configuration time depending of what version of VTK is detected) is equals to `6.3` (`VERSION_EQUAL` is a CMake test that is aware of major, minor and patch version, in this case the requirement is met for VTK version 6.3.x, whatever the value of x).
- use a one-part statement to check the OS. Possible values are `"WIN32"`, `"WIN64"`, `"MSVC"`, `"APPLE"` or `"UNIX"`. This allows you that you want a test to be ran only on a specific OS.
- use a two-parts statement to check the opposite of a one-part statement using the `NOT` prefix. In the first example given above, the test `action-itkfilters-integration-test` is ran only if the requirement `"NOT WIN32"` is met (e.g., if the platform is not `WIN32`). Possible values are therefore `"NOT WIN32"`, `"NOT WIN64"`, `"NOT MSVC"`, `"NOT APPLE"` or `"NOT UNIX"`
- use a three-parts statement to check the version of a library/dependency. A three-parts statement is composed of a left value (that is evaluated by the caller `CMakeList.txt`, i.e., evaluated in the context of the `CMakeList.txt` that uses the `camitk_tests_requirement` macro) followed by a comparator and a right value (also evaluated by the caller `CMakeList.txt`). Possible comparator are `VERSION_LESS`, `VERSION_EQUAL` or `VERSION_GREATER`. In the second example above, tests `action-myaction-level1-3` `action-myaction-level1-6` `action-myaction-level1-11` are ran only if the variable `VTK_VERSION` (as set at configuration time depending of what version of VTK is detected) is equals to `6.3` (`VERSION_EQUAL` is a CMake test that is aware of major, minor and patch version, in this case the requirement is met when VTK version 6.3.x is used, independently of the value of x).
<!--
OLD Documentation: it is still in place, but is it worth describing?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment