[Cmake-commits] [cmake-commits] david.cole committed CMakeLists.txt NONE 1.1 main.cxx NONE 1.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Nov 26 14:38:45 EST 2008
Update of /cvsroot/CMake/CMake/Tests/Environment
In directory public:/mounts/ram/cvs-serv744/Tests/Environment
Added Files:
CMakeLists.txt main.cxx
Log Message:
ENH: Implement feature request from issue 7885. Allow setting environment variables on a per-test basis for ctest using set_test_properties ENVIRONMENT.
--- NEW FILE: main.cxx ---
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char* var = getenv("CMAKE_ENVIRONMENT_TEST_VAR");
if (!var)
{
var = "(null)";
}
fprintf(stdout, "Environment:\n");
fprintf(stdout, " CMAKE_ENVIRONMENT_TEST_VAR='%s'\n", var);
return 0;
}
--- NEW FILE: CMakeLists.txt ---
cmake_minimum_required(VERSION 2.6)
project(EnvironmentProj)
add_executable(Environment main.cxx)
enable_testing()
add_test(Environment1 Environment)
add_test(Environment2 Environment)
add_test(EchoEnvironment1 ${CMAKE_COMMAND} -E environment)
add_test(EchoEnvironment2 ${CMAKE_COMMAND} -E environment)
# Make sure "CMAKE_ENV.*Happy Thanksgiving" is in the output of
# the "1" tests:
#
set_tests_properties(Environment1 EchoEnvironment1 PROPERTIES
ENVIRONMENT "CMAKE_ENVIRONMENT_TEST_VAR=Happy Thanksgiving!"
PASS_REGULAR_EXPRESSION "CMAKE_ENV.*Happy Thanksgiving"
)
# Make sure "CMAKE_ENV.*Happy Thanksgiving" is *NOT* in the output of
# the "2" tests:
#
set_tests_properties(Environment2 EchoEnvironment2 PROPERTIES
FAIL_REGULAR_EXPRESSION "CMAKE_ENV.*Happy Thanksgiving"
)
More information about the Cmake-commits
mailing list