diff options
author | Andreas Schuh <andreas.schuh.84@gmail.com> | 2013-08-01 01:47:13 +0100 |
---|---|---|
committer | Andreas Schuh <andreas.schuh.84@gmail.com> | 2013-08-01 01:47:13 +0100 |
commit | 126f36b82617aaf9c1cd2b4d819c02c7e2102cdd (patch) | |
tree | a27235fffe60612d77ab4b2cca004b123fa18349 /test | |
parent | 620557ccbc537e8cf4c1fe5c9d4549fafd8b3e0f (diff) | |
download | gflags-126f36b82617aaf9c1cd2b4d819c02c7e2102cdd.tar.gz gflags-126f36b82617aaf9c1cd2b4d819c02c7e2102cdd.tar.bz2 gflags-126f36b82617aaf9c1cd2b4d819c02c7e2102cdd.zip |
Enable build and execution of tests again using CTest.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 34 | ||||
-rw-r--r-- | test/gflags_strip_flags_test.cc | 4 | ||||
-rw-r--r-- | test/gflags_unittest.cc | 26 |
3 files changed, 49 insertions, 15 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..1157426 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,34 @@ +## gflags tests + +# ---------------------------------------------------------------------------- +# output directories +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/bin") +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/lib") +set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/lib") + +set (TEMPDIR "${PROJECT_BINARY_DIR}/Testing/Temporary") + +# ---------------------------------------------------------------------------- +# common link libraries +link_libraries (gflags) + +# ---------------------------------------------------------------------------- +# test executables +add_executable (strip_flags gflags_strip_flags_test.cc) +add_executable (unittest gflags_unittest.cc) + +# ---------------------------------------------------------------------------- +# test commands +add_test ( + NAME strip_flags + COMMAND /bin/bash "${CMAKE_CURRENT_SOURCE_DIR}/gflags_strip_flags_test.sh" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/strip_flags" +) + +add_test ( + NAME unittest + COMMAND /bin/bash "${CMAKE_CURRENT_SOURCE_DIR}/gflags_unittest.sh" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest" + "${CMAKE_CURRENT_SOURCE_DIR}" # <srcdir> + "${TEMPDIR}/unittest" # <tempdir> +) diff --git a/test/gflags_strip_flags_test.cc b/test/gflags_strip_flags_test.cc index 001ccd3..25ef53a 100644 --- a/test/gflags_strip_flags_test.cc +++ b/test/gflags_strip_flags_test.cc @@ -40,8 +40,8 @@ #include <stdio.h> -using GOOGLE_NAMESPACE::SetUsageMessage; -using GOOGLE_NAMESPACE::ParseCommandLineFlags; +using GFLAGS_NAMESPACE::SetUsageMessage; +using GFLAGS_NAMESPACE::ParseCommandLineFlags; DEFINE_bool(test, true, "This text should be stripped out"); diff --git a/test/gflags_unittest.cc b/test/gflags_unittest.cc index cce60d9..4edf3df 100644 --- a/test/gflags_unittest.cc +++ b/test/gflags_unittest.cc @@ -53,18 +53,18 @@ EXPECT_DEATH_INIT // works. But don't bother on windows; the windows port is so new // it never had the old location-names. #ifndef _MSC_VER -#include <google/gflags_completions.h> -void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions; +#include <gflags/gflags_completions.h> +void (*unused_fn)() = &GFLAGS_NAMESPACE::HandleCommandLineCompletions; #endif using std::string; using std::vector; -using GOOGLE_NAMESPACE::int32; -using GOOGLE_NAMESPACE::FlagRegisterer; -using GOOGLE_NAMESPACE::StringFromEnv; -using GOOGLE_NAMESPACE::RegisterFlagValidator; -using GOOGLE_NAMESPACE::CommandLineFlagInfo; -using GOOGLE_NAMESPACE::GetAllFlags; +using GFLAGS_NAMESPACE::int32; +using GFLAGS_NAMESPACE::FlagRegisterer; +using GFLAGS_NAMESPACE::StringFromEnv; +using GFLAGS_NAMESPACE::RegisterFlagValidator; +using GFLAGS_NAMESPACE::CommandLineFlagInfo; +using GFLAGS_NAMESPACE::GetAllFlags; DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files"); #ifdef _MSC_VER // in MSVC, we run from the vsprojects directory @@ -236,7 +236,7 @@ namespace fLI { } using fLI::FLAGS_tldflag2; -_START_GOOGLE_NAMESPACE_ +namespace GFLAGS_NAMESPACE { namespace { @@ -253,9 +253,9 @@ static string TmpFile(const string& basename) { // Must be called after ParseCommandLineFlags(). static const char* GetFlagFileFlag() { #ifdef _MSC_VER - static const string flagfile = FLAGS_srcdir + "\\src\\gflags_unittest_flagfile"; + static const string flagfile = FLAGS_srcdir + "\\gflags_unittest_flagfile"; #else - static const string flagfile = FLAGS_srcdir + "/src/gflags_unittest_flagfile"; + static const string flagfile = FLAGS_srcdir + "/gflags_unittest_flagfile"; #endif static const string flagfile_flag = string("--flagfile=") + flagfile; return flagfile_flag.c_str(); @@ -1526,9 +1526,9 @@ int main(int argc, char **argv) { return exit_status; } -_END_GOOGLE_NAMESPACE_ +} // GFLAGS_NAMESPACE int main(int argc, char** argv) { - return GOOGLE_NAMESPACE::main(argc, argv); + return GFLAGS_NAMESPACE::main(argc, argv); } |