Skip to content

Commit a0af6a0

Browse files
committed
[v2.0.0] Merge branch 'bleeding' (Version release)
2 parents 0f7adeb + 5e275da commit a0af6a0

File tree

155 files changed

+4564
-749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+4564
-749
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[bumpversion]
22
current_version = 1.3.1
3-
commit = True
3+
commit = False
44

55
[bumpversion:file:CMakeLists.txt]
66

.ci/install-libcsptr.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

.ci/install-pip.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.cmake/Modules/FindDyncall.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (C) 2015 Franklin "Snaipe" Mathieu.
2+
# Redistribution and use of this file is allowed according to the terms of the MIT license.
3+
# For details see the LICENSE file distributed with Criterion.
4+
5+
# - Find dyncall
6+
# Find the native libcsptr headers and libraries.
7+
#
8+
# DYNCALL_INCLUDE_DIRS - where to find smart_ptr.h, etc.
9+
# DYNCALL_LIBRARIES - List of libraries when using libcsptr.
10+
# DYNCALL_FOUND - True if libcsptr has been found.
11+
12+
# Look for the header file.
13+
FIND_PATH(DYNCALL_INCLUDE_DIR dyncall.h)
14+
15+
# Look for the library.
16+
FIND_LIBRARY(DYNCALL_LIBRARY NAMES dyncall_s)
17+
18+
# Handle the QUIETLY and REQUIRED arguments and set DYNCALL_FOUND to TRUE if all listed variables are TRUE.
19+
INCLUDE(FindPackageHandleStandardArgs)
20+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DYNCALL DEFAULT_MSG DYNCALL_LIBRARY DYNCALL_INCLUDE_DIR)
21+
22+
# Copy the results to the output variables.
23+
IF(DYNCALL_FOUND)
24+
SET(DYNCALL_LIBRARIES ${DYNCALL_LIBRARY})
25+
SET(DYNCALL_INCLUDE_DIRS ${DYNCALL_INCLUDE_DIR})
26+
ELSE(DYNCALL_FOUND)
27+
SET(DYNCALL_LIBRARIES)
28+
SET(DYNCALL_INCLUDE_DIRS)
29+
ENDIF(DYNCALL_FOUND)
30+
31+
MARK_AS_ADVANCED(DYNCALL_INCLUDE_DIRS DYNCALL_LIBRARIES)

.cmake/Modules/Submodules.cmake

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
if(EXISTS "${PROJECT_SOURCE_DIR}/.gitmodules")
2+
message(STATUS "Updating submodules to their latest/fixed versions")
3+
message(STATUS "(this can take a while, please be patient)")
4+
5+
### set the direcory where the submodules live
6+
set(GIT_SUBMODULES_DIRECTORY dependencies)
7+
8+
### set the directory names of the submodules
9+
set(GIT_SUBMODULES libcsptr dyncall)
10+
11+
### set each submodules's commit or tag that is to be checked out
12+
### (leave empty if you want master)
13+
14+
### First, get all submodules in
15+
if(${GIT_SUBMODULES_CHECKOUT_QUIET})
16+
execute_process(
17+
COMMAND git submodule update --init --recursive
18+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
19+
OUTPUT_QUIET
20+
ERROR_QUIET
21+
)
22+
else()
23+
execute_process(
24+
COMMAND git submodule update --init --recursive
25+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
26+
)
27+
endif()
28+
29+
### Then, checkout each submodule to the specified commit
30+
# Note: Execute separate processes here, to make sure each one is run,
31+
# should one crash (because of branch not existing, this, that ... whatever)
32+
foreach(GIT_SUBMODULE ${GIT_SUBMODULES})
33+
34+
if( "${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}" STREQUAL "" )
35+
message(STATUS "no specific version given for submodule ${GIT_SUBMODULE}, checking out master")
36+
set(GIT_SUBMODULE_VERSION_${GIT_SUBMODULE} "master")
37+
endif()
38+
39+
if(${GIT_SUBMODULES_CHECKOUT_QUIET})
40+
execute_process(
41+
COMMAND git checkout ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}
42+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE}
43+
OUTPUT_QUIET
44+
ERROR_QUIET
45+
)
46+
else()
47+
message(STATUS "checking out ${GIT_SUBMODULE}'s commit/tag ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}")
48+
execute_process(
49+
COMMAND git checkout -q ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}
50+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE}
51+
)
52+
endif()
53+
54+
endforeach(${GIT_SUBMODULE})
55+
56+
endif()

.gitignore

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,31 @@
33

44
!.gitignore
55
!.bumpversion.cfg
6+
!.ci/*
7+
!.cmake/*
8+
9+
!dev/*
10+
!doc/*
611

712
!*.c
13+
!*.cc
814
!*.h
915
!*.rst
10-
!samples/tests/*.sh
1116
!*.po
17+
!*.in
18+
!samples/tests/*.sh
1219
!samples/*.expected
1320

1421
!LICENSE
1522
!HEADER
1623
!ChangeLog
1724

25+
CMakeFiles/
1826
!CMakeLists.txt
19-
!.cmake/*
2027

21-
!src/config.h.in
2228
src/config.h
23-
2429
build
30+
2531
*~
2632
*.swp
33+
.*.swp

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "dependencies/libcsptr"]
2+
path = dependencies/libcsptr
3+
url = https://github.com/Snaipe/libcsptr.git
4+
[submodule "dependencies/dyncall"]
5+
path = dependencies/dyncall
6+
url = https://github.com/Snaipe/dyncall.git
7+
[submodule "dependencies/wingetopt"]
8+
path = dependencies/wingetopt
9+
url = https://github.com/alex85k/wingetopt.git

.travis.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,32 @@ language: c
22
os:
33
- linux
44
- osx
5+
56
compiler:
6-
- gcc
7+
- gcc-4.9
8+
79
sudo: false
10+
11+
addons:
12+
apt:
13+
sources:
14+
- ubuntu-toolchain-r-test
15+
packages:
16+
- gcc-4.9
17+
- g++-4.9
18+
819
before_install:
20+
- export GCOV="gcov-4.9"
921
- export LOCAL_INSTALL="$HOME"
10-
- ".ci/install-libcsptr.sh"
1122
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib
1223
- export CFLAGS="-g -O0"
24+
- export CXX="g++-4.9"
1325
script:
1426
- mkdir -p build
1527
- cd build
1628
- cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$HOME -DCMAKE_INSTALL_PREFIX=criterion-${TRAVIS_TAG} ..
1729
- make
30+
- make criterion_tests
1831
- make test
1932
after_success:
2033
- make coveralls

CMakeLists.txt

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
cmake_minimum_required(VERSION 2.8)
22

3-
project(Criterion C)
3+
project(Criterion C CXX)
44

5-
# Project setup & environment variables
5+
set(MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/Modules")
6+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR})
7+
set(LIBCSPTR_DISABLE_TESTS ON)
8+
set(LIBCSPTR_DISABLE_COVERALLS ON)
69

7-
enable_testing()
8-
add_subdirectory(samples)
10+
include(Submodules)
11+
12+
if (MSVC)
13+
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
14+
endif ()
15+
16+
add_subdirectory(dependencies/libcsptr/ EXCLUDE_FROM_ALL)
17+
add_subdirectory(dependencies/dyncall/ EXCLUDE_FROM_ALL)
18+
19+
include_directories(
20+
dependencies/libcsptr/include/
21+
dependencies/dyncall/dyncall/
22+
)
23+
24+
if (MSVC)
25+
add_subdirectory(dependencies/wingetopt/ EXCLUDE_FROM_ALL)
26+
include_directories(dependencies/wingetopt/src/)
27+
endif ()
28+
29+
# Project setup & environment variables
930

1031
set(PROJECT_VERSION "1.3.1")
1132
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
1233
set(GettextTranslate_ALL 1)
1334
set(GettextTranslate_GMO_BINARY 1)
14-
set(MODULE_DIR "${CMAKE_SOURCE_DIR}/.cmake/Modules")
15-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR})
1635

17-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu99")
36+
add_definitions(-DCRITERION_BUILDING_DLL=1)
37+
38+
if (NOT MSVC)
39+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu99")
40+
endif ()
41+
42+
if (MSVC)
43+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
44+
endif ()
1845

19-
if (WIN32)
46+
if (WIN32 AND NOT MSVC)
2047
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-no-undefined")
2148
endif()
2249

@@ -44,7 +71,6 @@ include(CheckLibraryExists)
4471
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
4572

4673
find_package(PCRE)
47-
find_package(Libcsptr REQUIRED)
4874

4975
# List sources and headers
5076

@@ -71,7 +97,11 @@ set(SOURCE_FILES
7197
src/i18n.h
7298
src/ordered-set.c
7399
src/posix-compat.c
100+
src/theories.c
101+
src/asprintf.c
102+
src/file.c
74103
src/main.c
104+
src/entry.c
75105
)
76106

77107
if (PCRE_FOUND)
@@ -94,18 +124,26 @@ set(INTERFACE_FILES
94124
include/criterion/options.h
95125
include/criterion/ordered-set.h
96126
include/criterion/stats.h
127+
include/criterion/theories.h
128+
include/criterion/asprintf-compat.h
129+
include/criterion/designated-initializer-compat.h
130+
include/criterion/preprocess.h
97131
)
98132

99133
# Generate the configure file
100134

101135
configure_file(
102-
"${CMAKE_SOURCE_DIR}/src/config.h.in"
103-
"${CMAKE_SOURCE_DIR}/src/config.h"
136+
"${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in"
137+
"${CMAKE_CURRENT_SOURCE_DIR}/src/config.h"
104138
)
105139

106-
include_directories(include src ${CSPTR_INCLUDE_DIRS})
140+
include_directories(include src)
107141
add_library(criterion SHARED ${SOURCE_FILES} ${INTERFACE_FILES})
108-
target_link_libraries(criterion ${CSPTR_LIBRARIES})
142+
target_link_libraries(criterion csptr dyncall_s)
143+
144+
if (MSVC)
145+
target_link_libraries(criterion wingetopt)
146+
endif ()
109147

110148
if (HAVE_CLOCK_GETTIME)
111149
target_link_libraries(criterion rt)
@@ -130,6 +168,8 @@ install(TARGETS criterion
130168
ARCHIVE DESTINATION lib
131169
)
132170

133-
add_custom_target(uninstall
134-
"${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake"
135-
)
171+
add_custom_target(criterion_tests)
172+
173+
enable_testing()
174+
add_subdirectory(samples)
175+
add_subdirectory(test)

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing
2+
3+
Contributions are welcomed, but must follow a simple set of rules in order to
4+
be merged.
5+
6+
**Please follow these conventions if you want your pull request(s) accepted.**
7+
8+
## General
9+
10+
* Use 4 (four) spaces for indentation.
11+
* No trailing whitespaces.
12+
* 80 chars column limit.
13+
* No trash files. Trash files are by-products of the compilation process, or
14+
generated files that does not need to be under version control.
15+
* Pull requests must compile and work properly.
16+
* Pull requests must pass all tests.
17+
* Pull requests must be mergeable automatically.
18+
* Number of commits in a pull request should be kept to one commit and all
19+
additional commits must be squashed.
20+
* You may have more than one commit in a pull request if the commits are
21+
separate changes, otherwise squash them.
22+
23+
## Translations
24+
25+
* You can contribute new translation files for output messages, on the
26+
condition that you are fluent with the language itself.
27+
* Each correction on existing translations must be followed by a
28+
rationale ("why would the translation be better if the change is applied?")
29+
30+
## Roadmap
31+
32+
.
33+
|- .cmake/: CMake modules
34+
|- dependencies/: dependencies for building libcriterion
35+
|- doc/: Sphinx documentation files
36+
|- include/criterion/: Public API
37+
|- src/: Sources for libcriterion
38+
| `- log/: Output providers, all the output logic in general
39+
|- po/: Translation files, i18n stuff
40+
|- test/: Unit tests for libcriterion
41+
`- samples/: Sample files
42+
|- outputs/: Expected output files for the current samples
43+
`- tests/: Internal regression tests
44+
`- outputs/: Expected output files for the regression tests

ChangeLog

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2015-09-14 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
2+
3+
* criterion: version 2.0.0
4+
* Breaking: ABI incompatibility with prior versions of criterion. You
5+
**must** recompile your tests.
6+
* Breaking: cr_abort_test(NULL) does not compile anymore.
7+
* Change: Changed all assertion macros to accept a printf format string as a
8+
message.
9+
* Change: Made the API C++11-compatible.
10+
* Change: Made the library ISO C compliant. You can now compile the library
11+
with VC 14+.
12+
* Addition: Added support for theories.
13+
* Addition: Added ability to test the exit status of a test.
14+
* Addition: Added C++11 throw assertions.
15+
* Addition: Added assert message localization.
16+
* Addition: Added test timeouts.
17+
* Addition: Added test standard i/o redirection & file comparison assertions.
18+
* Removal: Removed the deprecated prefixless assertion macros
19+
* Deprecation: Deprecated cr_abort_test.
20+
* Deprecation: cr_{assert,expect}_strings_* and cr_{assert,expect}_arrays_*
21+
are deprecated in favor of cr_{assert,expect}_str_* and
22+
cr_{assert,expect}_arr_* respectively.
23+
124
2015-08-20 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
225

326
* criterion: version 1.3.1

0 commit comments

Comments
 (0)