[cmake-developers] set_tests_properties and several environment variables

Andreas Schneider asn at cryptomilk.org
Tue Jun 25 07:04:23 EDT 2013


On Tuesday 25 June 2013 12:46:37 Andreas Schneider wrote:
> Hi,
> 
> I have a strange issue with set_tests_properties() and several ENVIRONMENT
> definitions. Only the last one shows up in the generated ctest file.
> 
> So this:
> 
> add_cmocka_test(testsuite testsuite.c ${CMOCKA_LIBRARY})
> set_tests_properties(
>     testsuite
>         PROPERTIES
>         ENVIRONMENT LD_PRELOAD=${CMAKE_BINARY_DIR}/src/libnss_wrapper.so
>         ENVIRONMENT NSS_WRAPPER_PASSWD=${CMAKE_CURRENT_BINARY_DIR}/passwd
>         ENVIRONMENT NSS_WRAPPER_GROUP=${CMAKE_CURRENT_BINARY_DIR}/group
>         ENVIRONMENT NSS_WRAPPER_HOSTS=${CMAKE_CURRENT_BINARY_DIR}/hosts)
> 
> results in:
> 
> asn at magrathea:~/workspace/projects/nss_wrapper/build> cat
> tests/CTestTestfile.cmake
> # CMake generated Testfile for
> # Source directory: /home/asn/workspace/projects/nss_wrapper/tests
> # Build directory: /home/asn/workspace/projects/nss_wrapper/build/tests
> #
> # This file includes the relevent testing commands required for
> # testing this directory and lists subdirectories to be tested as well.
> ADD_TEST(testsuite
> "/home/asn/workspace/projects/nss_wrapper/build/tests/testsuite")
> SET_TESTS_PROPERTIES(testsuite PROPERTIES  ENVIRONMENT
> "NSS_WRAPPER_GROUP=/home/asn/workspace/projects/nss_wrapper/build/tests/grou
> p")
> 
> 
> I miss three env variables, so my test fails ...
> 
> 
> Should I open a bug or is this knows?
> 
> 
> cmake version 2.8.11.1
> 

I got it working with:

add_cmocka_test(testsuite testsuite.c ${CMOCKA_LIBRARY})
set_property(
    TEST
        testsuite
    PROPERTY
        ENVIRONMENT LD_PRELOAD=${CMAKE_BINARY_DIR}/src/libnss_wrapper.so)

set_property(
    TEST
        testsuite
    APPEND
    PROPERTY
        ENVIRONMENT NSS_WRAPPER_PASSWD=${CMAKE_CURRENT_BINARY_DIR}/passwd)

set_property(
    TEST
        testsuite
    APPEND
    PROPERTY
        ENVIRONMENT NSS_WRAPPER_GROUP=${CMAKE_CURRENT_BINARY_DIR}/group)

set_property(
    TEST
        testsuite
    APPEND
    PROPERTY
        ENVIRONMENT NSS_WRAPPER_HOSTS=${CMAKE_CURRENT_BINARY_DIR}/hosts)



	-- andreas


-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                asn at cryptomilk.org




More information about the cmake-developers mailing list