Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
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
Chen Yisong
json
Commits
56843eb7
Commit
56843eb7
authored
Nov 27, 2016
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/individual_tests' into feature/messagepack
parents
93589e63
2477b09c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
64 deletions
+42
-64
.gitignore
.gitignore
+2
-0
.travis.yml
.travis.yml
+5
-55
Makefile
Makefile
+8
-6
Makefile
test/Makefile
+27
-3
No files found.
.gitignore
View file @
56843eb7
...
@@ -18,3 +18,5 @@ benchmarks/files/numbers/*.json
...
@@ -18,3 +18,5 @@ benchmarks/files/numbers/*.json
.idea
.idea
cmake-build-debug
cmake-build-debug
test/test-*
.travis.yml
View file @
56843eb7
...
@@ -39,7 +39,7 @@ matrix:
...
@@ -39,7 +39,7 @@ matrix:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
g++-4.9
,
valgrind
]
packages
:
[
g++-4.9
,
valgrind
]
after_success
:
after_success
:
-
valgrind --error-exitcode=1 --leak-check=full test/json_unit
-
make check TEST_PREFIX="valgrind --error-exitcode=1 --leak-check=full " TEST_PATTERN=""
# cppcheck
# cppcheck
...
@@ -68,9 +68,10 @@ matrix:
...
@@ -68,9 +68,10 @@ matrix:
-
tar xf lcov_1.11.orig.tar.gz
-
tar xf lcov_1.11.orig.tar.gz
-
sudo make -C lcov-1.11/ install
-
sudo make -C lcov-1.11/ install
-
gem install coveralls-lcov
-
gem install coveralls-lcov
-
pip install --user cpp-coveralls
after_success
:
after_success
:
-
make clean
-
make clean
-
CXXFLAGS="--coverage -g -O0" CPPFLAGS="-DNDEBUG" make
-
CXXFLAGS="--coverage -g -O0" CPPFLAGS="-DNDEBUG" make
json_unit
-
test/json_unit "*"
-
test/json_unit "*"
-
coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
-
coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
-
lcov --directory src --directory test/src --capture --output-file coverage.info --rc lcov_branch_coverage=1 --no-external
-
lcov --directory src --directory test/src --capture --output-file coverage.info --rc lcov_branch_coverage=1 --no-external
...
@@ -248,11 +249,8 @@ script:
...
@@ -248,11 +249,8 @@ script:
-
uname -a
-
uname -a
-
$CXX --version
-
$CXX --version
# compile
# compile and execute unit tests
-
make
-
make check
# execute unit tests
-
test/json_unit "*"
# check if homebrew works (only checks develop branch)
# check if homebrew works (only checks develop branch)
-
if [ `which brew` ]; then
-
if [ `which brew` ]; then
...
@@ -261,51 +259,3 @@ script:
...
@@ -261,51 +259,3 @@ script:
brew install nlohmann_json --HEAD ;
brew install nlohmann_json --HEAD ;
brew test nlohmann_json ;
brew test nlohmann_json ;
fi
fi
#language: cpp
#
#dist: trusty
#sudo: required
#
#env:
# global:
# # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# # via the "travis encrypt" command using the project repo's public key
# - secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA="
#
## from http://stackoverflow.com/a/32127147/266378
#matrix:
# include:
# - os: linux
# compiler: gcc
# addons:
# apt:
# sources: ['ubuntu-toolchain-r-test']
# packages: ['g++-4.9', 'valgrind', 'python-pip', 'python-yaml']
# before_script:
# - pip install --user git+git://github.com/eddyxu/cpp-coveralls.git
# after_success:
# - make clean
# - touch src/json.hpp
# - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER
# - test/json_unit "*"
# - coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
# env: COMPILER=g++-4.9
#
# - os: linux
# compiler: gcc
# before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
# addons:
# apt:
# sources: ['ubuntu-toolchain-r-test']
# packages: ['g++-5', 'valgrind']
# coverity_scan:
# project:
# name: "nlohmann/json"
# description: "Build submitted via Travis CI"
# notification_email: niels.lohmann@gmail.com
# build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)"
# build_command: "make"
# branch_pattern: coverity_scan
# env: COMPILER=g++-5
#
Makefile
View file @
56843eb7
...
@@ -5,7 +5,8 @@ RE2C = re2c
...
@@ -5,7 +5,8 @@ RE2C = re2c
SED
=
sed
SED
=
sed
# main target
# main target
all
:
json_unit
all
:
$(MAKE)
-C
test
# clean up
# clean up
clean
:
clean
:
...
@@ -21,14 +22,14 @@ clean:
...
@@ -21,14 +22,14 @@ clean:
# build unit tests
# build unit tests
json_unit
:
json_unit
:
@
$(MAKE)
-C
test
@
$(MAKE)
json_unit
-C
test
# run unit tests
# run unit tests
check
:
json_unit
check
:
test
/json_unit
"*"
$(MAKE)
check
-C
test
check-fast
:
json_unit
check-fast
:
test
/json_unit
$(MAKE)
check
-C
test
TEST_PATTERN
=
""
##########################################################################
##########################################################################
...
@@ -69,6 +70,7 @@ cppcheck:
...
@@ -69,6 +70,7 @@ cppcheck:
clang_sanitize
:
clean
clang_sanitize
:
clean
CXX
=
clang++
CXXFLAGS
=
"-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
$(MAKE)
CXX
=
clang++
CXXFLAGS
=
"-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
$(MAKE)
##########################################################################
##########################################################################
# maintainer targets
# maintainer targets
##########################################################################
##########################################################################
...
...
test/Makefile
View file @
56843eb7
...
@@ -42,7 +42,20 @@ SOURCES = src/unit.cpp \
...
@@ -42,7 +42,20 @@ SOURCES = src/unit.cpp \
OBJECTS
=
$
(
SOURCES:.cpp
=
.o
)
OBJECTS
=
$
(
SOURCES:.cpp
=
.o
)
all
:
json_unit
TESTCASES
=
$
(
patsubst src/unit-%.cpp,test-%,
$
(
wildcard src/unit-
*
.cpp
))
##############################################################################
# main rules
##############################################################################
all
:
$(TESTCASES)
clean
:
rm
-fr
json_unit
$(OBJECTS)
$
(
SOURCES:.cpp
=
.gcno
)
$
(
SOURCES:.cpp
=
.gcda
)
$(TESTCASES)
##############################################################################
# single test file
##############################################################################
json_unit
:
$(OBJECTS) ../src/json.hpp src/catch.hpp
json_unit
:
$(OBJECTS) ../src/json.hpp src/catch.hpp
@
echo
"[CXXLD]
$@
"
@
echo
"[CXXLD]
$@
"
...
@@ -52,5 +65,16 @@ json_unit: $(OBJECTS) ../src/json.hpp src/catch.hpp
...
@@ -52,5 +65,16 @@ json_unit: $(OBJECTS) ../src/json.hpp src/catch.hpp
@
echo
"[CXX]
$@
"
@
echo
"[CXX]
$@
"
@
$(CXX)
$(CXXFLAGS)
$(CPPFLAGS)
-c
$<
-o
$@
@
$(CXX)
$(CXXFLAGS)
$(CPPFLAGS)
-c
$<
-o
$@
clean
:
rm
-fr
json_unit
$(OBJECTS)
$
(
SOURCES:.cpp
=
.gcno
)
$
(
SOURCES:.cpp
=
.gcda
)
##############################################################################
# individual test cases
##############################################################################
test-%
:
src/unit-%.cpp
@
echo
"[CXXLD]
$@
"
@
$(CXX)
$(CXXFLAGS)
$(CPPFLAGS)
$(LDFLAGS)
-DCATCH_CONFIG_MAIN
$<
-o
$@
TEST_PATTERN
=
"*"
TEST_PREFIX
=
""
check
:
$(TESTCASES)
@
cd
..
;
for
testcase
in
$(TESTCASES)
;
do
echo
"Executing
$$
testcase..."
;
$(TEST_PREFIX)
test
/
$$
testcase
$(TEST_PATTERN)
-r
compact
;
done
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