FORWARD_ENV
option can be used to forward environment variable from host to target. Feature is useful while running tests on iOS and Android devices since environment for such tests created from scratch and is not the same as local user environment. For other platforms there are no extra functionality introduced.
As an example let assume test is reading environment variables MY_GAUZE_VARIABLE_1
and MY_GAUZE_VARIABLE_2
:
/../test/gauze/forward_env/main.cpp
Environment variable MY_GAUZE_VARIABLE_1
will be set by CTest:
/../test/gauze/forward_env/CMakeLists.txt
Run test (Android build):
> ctest -VV -R gauze_forward_env
...
5: Forwarding user's variable 'MY_GAUZE_VARIABLE_1' with value '42'
5: Forwarding user's variable 'MY_GAUZE_VARIABLE_2' with value ''
5: Command output (with exit code):
5: *** BEGIN ***
5: Variable MY_GAUZE_VARIABLE_1 found!
5: MY_GAUZE_VARIABLE_2 value:
5: 0
5: *** END ***
5: Done
1/1 Test #5: gauze_forward_env ................ Passed 0.53 sec
If environment variable MY_GAUZE_VARIABLE_2
will be set on host then Gauze will forward it to the Android test environment:
> export MY_GAUZE_VARIABLE_2=hello
> ctest -VV -R gauze_forward_env
...
5: Forwarding user's variable 'MY_GAUZE_VARIABLE_1' with value '42'
5: Forwarding user's variable 'MY_GAUZE_VARIABLE_2' with value 'hello'
5: Command output (with exit code):
5: *** BEGIN ***
5: Variable MY_GAUZE_VARIABLE_1 found!
5: MY_GAUZE_VARIABLE_2 value: hello
5: 0
5: *** END ***
5: Done
1/1 Test #5: gauze_forward_env ................ Passed 0.48 sec
There is no need to rebuild test or reconfigure CMake project.