Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
a89db0e7
Unverified
Commit
a89db0e7
authored
Oct 17, 2021
by
Edward Thomson
Committed by
GitHub
Oct 17, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6083 from libgit2/ethomson/clar_no_more
parents
e61abdce
4e14d4c6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
CMakeLists.txt
+3
-3
README.md
+1
-1
docs/fuzzing.md
+1
-1
fuzzers/corpora/objects/blob
+2
-2
tests/CMakeLists.txt
+10
-10
tests/README.md
+2
-2
No files found.
CMakeLists.txt
View file @
a89db0e7
...
...
@@ -38,7 +38,7 @@ INCLUDE(EnableWarnings)
OPTION
(
SONAME
"Set the (SO)VERSION of the target"
ON
)
OPTION
(
BUILD_SHARED_LIBS
"Build Shared Library (OFF for Static)"
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_FUZZERS
"Build the fuzz targets"
OFF
)
OPTION
(
ENABLE_TRACE
"Enables tracing support"
ON
)
...
...
@@ -281,7 +281,7 @@ IF (NOT MSVC)
ENDIF
()
ENDIF
()
IF
(
BUILD_
CLAR
)
IF
(
BUILD_
TESTS
)
ENABLE_TESTING
()
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
...
...
@@ -295,7 +295,7 @@ IF(BUILD_FUZZERS)
IF
(
BUILD_EXAMPLES
)
MESSAGE
(
FATAL_ERROR
"Cannot build the fuzzer targets and the examples together"
)
ENDIF
()
IF
(
BUILD_
CLAR
)
IF
(
BUILD_
TESTS
)
MESSAGE
(
FATAL_ERROR
"Cannot build the fuzzer targets and the tests together"
)
ENDIF
()
ENDIF
()
...
...
README.md
View file @
a89db0e7
...
...
@@ -278,7 +278,7 @@ The following CMake variables are declared:
-
`CMAKE_INSTALL_LIBDIR`
: Where to install libraries to.
-
`CMAKE_INSTALL_INCLUDEDIR`
: Where to install headers to.
-
`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)
To list all build options and their current value, you can do the
...
...
docs/fuzzing.md
View file @
a89db0e7
...
...
@@ -19,7 +19,7 @@ automated fuzz testing. libFuzzer only works with clang.
and
[
`leak`/`address,leak`
](
https://clang.llvm.org/docs/LeakSanitizer.html
)
.
3.
Create the cmake build environment and configure the build with the
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
tests and examples.
4.
Build libgit2:
`cmake --build .`
...
...
fuzzers/corpora/objects/blob
View file @
a89db0e7
...
...
@@ -64,7 +64,7 @@ slack channel once you've registered.
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
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).
**Reporting Bugs**
...
...
@@ -229,7 +229,7 @@ The following CMake variables are declared:
- `LIB_INSTALL_DIR`: Where to install libraries to.
- `INCLUDE_INSTALL_DIR`: Where to install headers to.
- `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)
- `STDCALL`: Build libgit2 as `stdcall`. Turn off for `cdecl` (Windows; defaults to ON)
...
...
tests/CMakeLists.txt
View file @
a89db0e7
...
...
@@ -3,7 +3,7 @@ FIND_PACKAGE(PythonInterp)
IF
(
NOT PYTHONINTERP_FOUND
)
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
()
SET
(
CLAR_FIXTURES
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/resources/"
)
...
...
@@ -39,26 +39,26 @@ SET_SOURCE_FILES_PROPERTIES(
INCLUDE_DIRECTORIES(
${
LIBGIT2_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_
clar
PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
libgit2_BINARY_DIR
}
)
SET_TARGET_PROPERTIES(libgit2_
tests
PROPERTIES C_STANDARD 90)
SET_TARGET_PROPERTIES(libgit2_
tests
PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
libgit2_BINARY_DIR
}
)
TARGET_INCLUDE_DIRECTORIES(libgit2_
clar
PRIVATE ../src PUBLIC ../include)
TARGET_LINK_LIBRARIES(libgit2_
clar
${
LIBGIT2_LIBS
}
)
IDE_SPLIT_SOURCES(libgit2_
clar
)
TARGET_INCLUDE_DIRECTORIES(libgit2_
tests
PRIVATE ../src PUBLIC ../include)
TARGET_LINK_LIBRARIES(libgit2_
tests
${
LIBGIT2_LIBS
}
)
IDE_SPLIT_SOURCES(libgit2_
tests
)
IF (MSVC_IDE)
# 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
")
ENDIF ()
FUNCTION(ADD_CLAR_TEST name)
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()
ADD_TEST(
${
name
}
"
${
libgit2_BINARY_DIR
}
/libgit2_
clar
"
${
ARGN
}
)
ADD_TEST(
${
name
}
"
${
libgit2_BINARY_DIR
}
/libgit2_
tests
"
${
ARGN
}
)
ENDIF()
ENDFUNCTION(ADD_CLAR_TEST)
...
...
tests/README.md
View file @
a89db0e7
...
...
@@ -11,7 +11,7 @@ https://github.com/vmg/clar
*
Make sure you actually build the tests by setting:
cmake -DBUILD_
CLAR
=ON build/
cmake -DBUILD_
TESTS
=ON build/
*
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/
)
:
```
console
$
cmake
-DBUILD_
CLAR
=
ON
-DVALGRIND
=
ON ..
$
cmake
-DBUILD_
TESTS
=
ON
-DVALGRIND
=
ON ..
$
cmake
--build
.
$
valgrind
--leak-check
=
full
--show-reachable
=
yes
--num-callers
=
50
--suppressions
=
../libgit2_clar.supp
\
./libgit2_clar
...
...
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