Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: do not build tests for Release build and cleanups #5916

Closed
wants to merge 12 commits into from

Commits on Dec 13, 2019

  1. cmake: disable WITH_TESTS for Release builds

    cmake pass '-DNDEBUG' to compiler when compiling non-Debug builds.
    and rocksdb's tests are short-circuited if the "NDEBUG" macro is defined,
    so the "Release" builds fail when building tests.
    
    in this change, cmake disables `WITH_TESTS` option if `CMAKE_BUILD_TYPE`
    is `Release`. this also maps how `Makefile` defines `dbg` and `release`
    targets. in `Makefile`, `release` target does not depend on `$(TESTS)`,
    while `dbg` does.
    
    fixes facebook#2445
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    227cdd4 View commit details
    Browse the repository at this point in the history
  2. cmake: compile testharness as a static library

    so we can reference it without worrying about its dependencies like
    gtest. testharness is used by table_reader_bench.
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    7d1de89 View commit details
    Browse the repository at this point in the history
  3. cmake: use CMAKE_DEPENDENT_OPTION() to conditionalize option definition

    `WITH_GFLAGS` is enabled/disabled depending on the
    building system, so it'd be simpler if we could define it using
    `CMAKE_DEPENDENT_OPTION`.
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    9e33443 View commit details
    Browse the repository at this point in the history
  4. cmake: add benchmark tools without a loop

    unfold the loop, and remove the unused dependencies from linked
    libraries.
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    3d65227 View commit details
    Browse the repository at this point in the history
  5. cmake: remove alias variables

    TEST_EXES and C_TEST_EXES are just aliases, so remove them
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    49d3a25 View commit details
    Browse the repository at this point in the history
  6. cmake: simplify db/c_test.c build

    * no need to use a loop for building it
    * no need to set properties like `EXCLUDE_FROM_DEFAULT_BUILD_RELEASE`,
      these properties are not read by anybody
    * no need to link against testutillib
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    a0599be View commit details
    Browse the repository at this point in the history
  7. cmake: default to Debug

    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    b77534d View commit details
    Browse the repository at this point in the history
  8. cmake: add Findgflags.cmake

    newer libgflags-dev ships with cmake support, but libgflags-dev 2.1.2-3
    shipped by xenial does not. let's add the find_package() support. so our
    CI can build with gflags
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    2117e9a View commit details
    Browse the repository at this point in the history
  9. cmake: require gflags if WITH_GFLAGS

    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    a9b5366 View commit details
    Browse the repository at this point in the history
  10. .travis.yml: disable WITH_GFLAGS for cmake-mingw

    as we don't have libgflags-dev installed on mingw, and the toolchain
    is not MSVC. please note, currently WITH_GFLAGS is OFF by default on
    MINGW, but it's still better to be explicit.
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    5492027 View commit details
    Browse the repository at this point in the history
  11. .travis.yml: install gflags on osx

    since WITH_GFLAGS is ON by default on OSX, we need to install or or
    disable it explicitly. it'd be better to install it for better coverage
    of the CI test.
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    f8cd930 View commit details
    Browse the repository at this point in the history
  12. db_stress: silence clang++ warning

    stress_tool/batched_ops_stress.cc:178:41: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    2822    std::array<std::string, 10> keys = {"0", "1", "2", "3", "4",
    2823                                        ^~~~~~~~~~~~~~~~~~~~~~~~
    28241 error generated.
    
    see the discussions at
    https://stackoverflow.com/questions/22501368/why-wasnt-a-double-curly-braces-syntax-preferred-for-constructors-taking-a-std
    and
    https://en.cppreference.com/w/cpp/container/array
    
    Signed-off-by: Kefu Chai <tchaikov@gmail.com>
    tchaikov committed Dec 13, 2019
    Configuration menu
    Copy the full SHA
    04f3573 View commit details
    Browse the repository at this point in the history