Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
gflags
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
gflags
Commits
126f36b8
Commit
126f36b8
authored
Aug 01, 2013
by
Andreas Schuh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable build and execution of tests again using CTest.
parent
620557cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
15 deletions
+63
-15
CMakeLists.txt
CMakeLists.txt
+14
-0
CMakeLists.txt
test/CMakeLists.txt
+34
-0
gflags_strip_flags_test.cc
test/gflags_strip_flags_test.cc
+2
-2
gflags_unittest.cc
test/gflags_unittest.cc
+13
-13
No files found.
CMakeLists.txt
View file @
126f36b8
...
...
@@ -134,6 +134,20 @@ include_directories ("${PROJECT_BINARY_DIR}/include")
include_directories
(
"
${
PROJECT_BINARY_DIR
}
/include/
${
GFLAGS_NAMESPACE
}
"
)
add_library
(
gflags
${
GFLAGS_SRCS
}
)
# ----------------------------------------------------------------------------
# testing
# TODO(andreas) Replace Bash scripts such that tests can be run on Windows (e.g., Python).
# The gflags_unittest.sh script should best be replaced by multiple
# add_test commands in the test/CMakeLists.txt file.
if
(
UNIX
)
include
(
CTest
)
if
(
BUILD_TESTING
)
enable_testing
()
add_subdirectory
(
test
)
endif
()
endif
()
# ----------------------------------------------------------------------------
# installation
if
(
WIN32
)
...
...
test/CMakeLists.txt
0 → 100644
View file @
126f36b8
## 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>
)
test/gflags_strip_flags_test.cc
View file @
126f36b8
...
...
@@ -40,8 +40,8 @@
#include <stdio.h>
using
G
OOGLE
_NAMESPACE
::
SetUsageMessage
;
using
G
OOGLE
_NAMESPACE
::
ParseCommandLineFlags
;
using
G
FLAGS
_NAMESPACE
::
SetUsageMessage
;
using
G
FLAGS
_NAMESPACE
::
ParseCommandLineFlags
;
DEFINE_bool
(
test
,
true
,
"This text should be stripped out"
);
...
...
test/gflags_unittest.cc
View file @
126f36b8
...
...
@@ -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 <g
oogle
/gflags_completions.h>
void
(
*
unused_fn
)()
=
&
G
OOGLE
_NAMESPACE
::
HandleCommandLineCompletions
;
#include <g
flags
/gflags_completions.h>
void
(
*
unused_fn
)()
=
&
G
FLAGS
_NAMESPACE
::
HandleCommandLineCompletions
;
#endif
using
std
::
string
;
using
std
::
vector
;
using
G
OOGLE
_NAMESPACE
::
int32
;
using
G
OOGLE
_NAMESPACE
::
FlagRegisterer
;
using
G
OOGLE
_NAMESPACE
::
StringFromEnv
;
using
G
OOGLE
_NAMESPACE
::
RegisterFlagValidator
;
using
G
OOGLE
_NAMESPACE
::
CommandLineFlagInfo
;
using
G
OOGLE
_NAMESPACE
::
GetAllFlags
;
using
G
FLAGS
_NAMESPACE
::
int32
;
using
G
FLAGS
_NAMESPACE
::
FlagRegisterer
;
using
G
FLAGS
_NAMESPACE
::
StringFromEnv
;
using
G
FLAGS
_NAMESPACE
::
RegisterFlagValidator
;
using
G
FLAGS
_NAMESPACE
::
CommandLineFlagInfo
;
using
G
FLAGS
_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
G
OOGLE
_NAMESPACE
::
main
(
argc
,
argv
);
return
G
FLAGS
_NAMESPACE
::
main
(
argc
,
argv
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment