cmake: BUILD_CLAR is now BUILD_TESTS

Nobody knows what CLAR is.  The test building option should be
`BUILD_TESTS`.
This commit is contained in:
Edward Thomson
2021-09-26 22:06:49 -04:00
parent e61abdce43
commit 4e14d4c6a6
6 changed files with 19 additions and 19 deletions

View File

@@ -38,7 +38,7 @@ INCLUDE(EnableWarnings)
OPTION(SONAME "Set the (SO)VERSION of the target" ON) OPTION(SONAME "Set the (SO)VERSION of the target" ON)
OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON) OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION(THREADSAFE "Build libgit2 as threadsafe" ON) OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
OPTION(BUILD_CLAR "Build Tests using the Clar suite" ON) OPTION(BUILD_TESTS "Build Tests using the Clar suite" ON)
OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF) OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF) OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF)
OPTION(ENABLE_TRACE "Enables tracing support" ON) OPTION(ENABLE_TRACE "Enables tracing support" ON)
@@ -281,7 +281,7 @@ IF (NOT MSVC)
ENDIF() ENDIF()
ENDIF () ENDIF ()
IF (BUILD_CLAR) IF (BUILD_TESTS)
ENABLE_TESTING() ENABLE_TESTING()
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tests)
ENDIF () ENDIF ()
@@ -295,7 +295,7 @@ IF(BUILD_FUZZERS)
IF(BUILD_EXAMPLES) IF(BUILD_EXAMPLES)
MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the examples together") MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the examples together")
ENDIF() ENDIF()
IF(BUILD_CLAR) IF(BUILD_TESTS)
MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the tests together") MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the tests together")
ENDIF() ENDIF()
ENDIF() ENDIF()

View File

@@ -278,7 +278,7 @@ The following CMake variables are declared:
- `CMAKE_INSTALL_LIBDIR`: Where to install libraries to. - `CMAKE_INSTALL_LIBDIR`: Where to install libraries to.
- `CMAKE_INSTALL_INCLUDEDIR`: Where to install headers to. - `CMAKE_INSTALL_INCLUDEDIR`: Where to install headers to.
- `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON) - `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON)
- `BUILD_CLAR`: Build [Clar](https://github.com/vmg/clar)-based test suite (defaults to ON) - `BUILD_TESTS`: Build the unit and integration test suites (defaults to ON)
- `THREADSAFE`: Build libgit2 with threading support (defaults to ON) - `THREADSAFE`: Build libgit2 with threading support (defaults to ON)
To list all build options and their current value, you can do the To list all build options and their current value, you can do the

View File

@@ -19,7 +19,7 @@ automated fuzz testing. libFuzzer only works with clang.
and [`leak`/`address,leak`](https://clang.llvm.org/docs/LeakSanitizer.html). and [`leak`/`address,leak`](https://clang.llvm.org/docs/LeakSanitizer.html).
3. Create the cmake build environment and configure the build with the 3. Create the cmake build environment and configure the build with the
sanitizer chosen: `CC=/usr/bin/clang-6.0 CFLAGS="-fsanitize=address" cmake sanitizer chosen: `CC=/usr/bin/clang-6.0 CFLAGS="-fsanitize=address" cmake
-DBUILD_CLAR=OFF -DBUILD_FUZZERS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ..`. -DBUILD_TESTS=OFF -DBUILD_FUZZERS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ..`.
Note that building the fuzzer targets is incompatible with the Note that building the fuzzer targets is incompatible with the
tests and examples. tests and examples.
4. Build libgit2: `cmake --build .` 4. Build libgit2: `cmake --build .`

View File

@@ -64,7 +64,7 @@ slack channel once you've registered.
If you have questions about the library, please be sure to check out the If you have questions about the library, please be sure to check out the
[API documentation](http://libgit2.github.com/libgit2/). If you still have [API documentation](http://libgit2.github.com/libgit2/). If you still have
questions, reach out to us on Slack or post a question on questions, reach out to us on Slack or post a question on
[StackOverflow](http://stackoverflow.com/questions/tagged/libgit2) (with the `libgit2` tag). [StackOverflow](http://stackoverflow.com/questions/tagged/libgit2) (with the `libgit2` tag).
**Reporting Bugs** **Reporting Bugs**
@@ -229,7 +229,7 @@ The following CMake variables are declared:
- `LIB_INSTALL_DIR`: Where to install libraries to. - `LIB_INSTALL_DIR`: Where to install libraries to.
- `INCLUDE_INSTALL_DIR`: Where to install headers to. - `INCLUDE_INSTALL_DIR`: Where to install headers to.
- `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON) - `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON)
- `BUILD_CLAR`: Build [Clar](https://github.com/vmg/clar)-based test suite (defaults to ON) - `BUILD_TESTS`: Build [Clar](https://github.com/vmg/clar)-based test suite (defaults to ON)
- `THREADSAFE`: Build libgit2 with threading support (defaults to ON) - `THREADSAFE`: Build libgit2 with threading support (defaults to ON)
- `STDCALL`: Build libgit2 as `stdcall`. Turn off for `cdecl` (Windows; defaults to ON) - `STDCALL`: Build libgit2 as `stdcall`. Turn off for `cdecl` (Windows; defaults to ON)

View File

@@ -3,7 +3,7 @@ FIND_PACKAGE(PythonInterp)
IF(NOT PYTHONINTERP_FOUND) IF(NOT PYTHONINTERP_FOUND)
MESSAGE(FATAL_ERROR "Could not find a python interpeter, which is needed to build the tests. " MESSAGE(FATAL_ERROR "Could not find a python interpeter, which is needed to build the tests. "
"Make sure python is available, or pass -DBUILD_CLAR=OFF to skip building the tests") "Make sure python is available, or pass -DBUILD_TESTS=OFF to skip building the tests")
ENDIF() ENDIF()
SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/resources/") SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/resources/")
@@ -39,26 +39,26 @@ SET_SOURCE_FILES_PROPERTIES(
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES}) INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
INCLUDE_DIRECTORIES(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES}) INCLUDE_DIRECTORIES(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES})
ADD_EXECUTABLE(libgit2_clar ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS}) ADD_EXECUTABLE(libgit2_tests ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS})
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES C_STANDARD 90) SET_TARGET_PROPERTIES(libgit2_tests PROPERTIES C_STANDARD 90)
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR}) SET_TARGET_PROPERTIES(libgit2_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
TARGET_INCLUDE_DIRECTORIES(libgit2_clar PRIVATE ../src PUBLIC ../include) TARGET_INCLUDE_DIRECTORIES(libgit2_tests PRIVATE ../src PUBLIC ../include)
TARGET_LINK_LIBRARIES(libgit2_clar ${LIBGIT2_LIBS}) TARGET_LINK_LIBRARIES(libgit2_tests ${LIBGIT2_LIBS})
IDE_SPLIT_SOURCES(libgit2_clar) IDE_SPLIT_SOURCES(libgit2_tests)
IF (MSVC_IDE) IF (MSVC_IDE)
# Precompiled headers # Precompiled headers
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h") SET_TARGET_PROPERTIES(libgit2_tests PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
SET_SOURCE_FILES_PROPERTIES("precompiled.c" COMPILE_FLAGS "/Ycprecompiled.h") SET_SOURCE_FILES_PROPERTIES("precompiled.c" COMPILE_FLAGS "/Ycprecompiled.h")
ENDIF () ENDIF ()
FUNCTION(ADD_CLAR_TEST name) FUNCTION(ADD_CLAR_TEST name)
IF (NOT USE_LEAK_CHECKER STREQUAL "OFF") IF (NOT USE_LEAK_CHECKER STREQUAL "OFF")
ADD_TEST(${name} "${libgit2_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${libgit2_BINARY_DIR}/libgit2_clar" ${ARGN}) ADD_TEST(${name} "${libgit2_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${libgit2_BINARY_DIR}/libgit2_tests" ${ARGN})
ELSE() ELSE()
ADD_TEST(${name} "${libgit2_BINARY_DIR}/libgit2_clar" ${ARGN}) ADD_TEST(${name} "${libgit2_BINARY_DIR}/libgit2_tests" ${ARGN})
ENDIF() ENDIF()
ENDFUNCTION(ADD_CLAR_TEST) ENDFUNCTION(ADD_CLAR_TEST)

View File

@@ -11,7 +11,7 @@ https://github.com/vmg/clar
* Make sure you actually build the tests by setting: * Make sure you actually build the tests by setting:
cmake -DBUILD_CLAR=ON build/ cmake -DBUILD_TESTS=ON build/
* Test: * Test:
@@ -32,7 +32,7 @@ These are automatically run as part of CI, but if you want to check locally:
Uses [`valgrind`](http://www.valgrind.org/): Uses [`valgrind`](http://www.valgrind.org/):
```console ```console
$ cmake -DBUILD_CLAR=ON -DVALGRIND=ON .. $ cmake -DBUILD_TESTS=ON -DVALGRIND=ON ..
$ cmake --build . $ cmake --build .
$ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \ $ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \
./libgit2_clar ./libgit2_clar