Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
05b97c47
Unverified
Commit
05b97c47
authored
Aug 25, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
👷
added flags for Valgrind and Clang sanitizer
parent
c87b080c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
10 deletions
+29
-10
.travis.yml
.travis.yml
+3
-9
test/CMakeLists.txt
test/CMakeLists.txt
+26
-1
No files found.
.travis.yml
View file @
05b97c47
...
@@ -29,34 +29,28 @@ matrix:
...
@@ -29,34 +29,28 @@ matrix:
include
:
include
:
# Valgrind
# Valgrind
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
env
:
env
:
-
COMPILER=g++-4.9
-
COMPILER=g++-4.9
-
SPECIAL=valgrind
-
CMAKE_OPTIONS=-DJSON_Valgrind=ON
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
g++-4.9
,
valgrind
]
packages
:
[
g++-4.9
,
valgrind
]
after_success
:
-
make check TEST_PREFIX="valgrind --error-exitcode=1 --leak-check=full " TEST_PATTERN=""
# clang sanitizer
# clang sanitizer
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
env
:
env
:
-
COMPILER=clang++-5.0
-
COMPILER=clang++-5.0
-
SPECIAL=sanitizer
-
CMAKE_OPTIONS=-DJSON_Sanitizer=ON
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
]
after_success
:
-
make clang_sanitize -j4
# cppcheck
# cppcheck
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
env
:
env
:
...
@@ -289,7 +283,7 @@ script:
...
@@ -289,7 +283,7 @@ script:
# compile and execute unit tests
# compile and execute unit tests
-
mkdir -p build && cd build
-
mkdir -p build && cd build
-
cmake .. && cmake --build . --config Release -- -j4
-
cmake ..
${CMAKE_OPTIONS}
&& cmake --build . --config Release -- -j4
-
ctest -C Release -V
-
ctest -C Release -V
-
cd ..
-
cd ..
...
...
test/CMakeLists.txt
View file @
05b97c47
option
(
JSON_Sanitizer
"Build with Clang Sanitizer"
OFF
)
option
(
JSON_Valgrind
"Execute tests with Valgrind"
OFF
)
if
(
JSON_Sanitizer
)
if
(
NOT MSVC
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
)
endif
()
endif
()
if
(
JSON_Valgrind
)
find_program
(
CMAKE_MEMORYCHECK_COMMAND valgrind
)
set
(
MEMORYCHECK_COMMAND_OPTIONS
"--error-exitcode=1 --leak-check=full"
)
set
(
memcheck_command
"
${
CMAKE_MEMORYCHECK_COMMAND
}
${
CMAKE_MEMORYCHECK_COMMAND_OPTIONS
}
"
)
separate_arguments
(
memcheck_command
)
endif
()
#############################################################################
#############################################################################
# Catch library with the main function to speed up build
# Catch library with the main function to speed up build
#############################################################################
#############################################################################
...
@@ -35,7 +51,7 @@ foreach(file ${files})
...
@@ -35,7 +51,7 @@ foreach(file ${files})
target_link_libraries
(
${
testcase
}
${
JSON_TARGET_NAME
}
)
target_link_libraries
(
${
testcase
}
${
JSON_TARGET_NAME
}
)
if
(
NOT MSVC
)
if
(
NOT MSVC
)
set
(
CMAKE_CXX
_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
set
_target_properties
(
${
testcase
}
PROPERTIES COMPILE
_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
endif
()
endif
()
include
(
cotire OPTIONAL
)
include
(
cotire OPTIONAL
)
...
@@ -54,4 +70,13 @@ foreach(file ${files})
...
@@ -54,4 +70,13 @@ foreach(file ${files})
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
)
set_tests_properties
(
"
${
testcase
}
_all"
PROPERTIES LABELS
"all"
)
set_tests_properties
(
"
${
testcase
}
_all"
PROPERTIES LABELS
"all"
)
if
(
JSON_Valgrind
)
add_test
(
NAME
"
${
testcase
}
_valgrind"
COMMAND
${
memcheck_command
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
testcase
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
set_tests_properties
(
"
${
testcase
}
_valgrind"
PROPERTIES LABELS
"valgrind"
)
endif
()
endforeach
()
endforeach
()
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