Skip to content

Commit

Permalink
[v2.0.0] Merge branch 'bleeding' (Version release)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snaipe committed Sep 14, 2015
2 parents 0f7adeb + 5e275da commit a0af6a0
Show file tree
Hide file tree
Showing 155 changed files with 4,564 additions and 749 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
current_version = 1.3.1
commit = True
commit = False

[bumpversion:file:CMakeLists.txt]

Expand Down
14 changes: 0 additions & 14 deletions .ci/install-libcsptr.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .ci/install-pip.sh

This file was deleted.

31 changes: 31 additions & 0 deletions .cmake/Modules/FindDyncall.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (C) 2015 Franklin "Snaipe" Mathieu.
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the LICENSE file distributed with Criterion.

# - Find dyncall
# Find the native libcsptr headers and libraries.
#
# DYNCALL_INCLUDE_DIRS - where to find smart_ptr.h, etc.
# DYNCALL_LIBRARIES - List of libraries when using libcsptr.
# DYNCALL_FOUND - True if libcsptr has been found.

# Look for the header file.
FIND_PATH(DYNCALL_INCLUDE_DIR dyncall.h)

# Look for the library.
FIND_LIBRARY(DYNCALL_LIBRARY NAMES dyncall_s)

# Handle the QUIETLY and REQUIRED arguments and set DYNCALL_FOUND to TRUE if all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DYNCALL DEFAULT_MSG DYNCALL_LIBRARY DYNCALL_INCLUDE_DIR)

# Copy the results to the output variables.
IF(DYNCALL_FOUND)
SET(DYNCALL_LIBRARIES ${DYNCALL_LIBRARY})
SET(DYNCALL_INCLUDE_DIRS ${DYNCALL_INCLUDE_DIR})
ELSE(DYNCALL_FOUND)
SET(DYNCALL_LIBRARIES)
SET(DYNCALL_INCLUDE_DIRS)
ENDIF(DYNCALL_FOUND)

MARK_AS_ADVANCED(DYNCALL_INCLUDE_DIRS DYNCALL_LIBRARIES)
56 changes: 56 additions & 0 deletions .cmake/Modules/Submodules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
if(EXISTS "${PROJECT_SOURCE_DIR}/.gitmodules")
message(STATUS "Updating submodules to their latest/fixed versions")
message(STATUS "(this can take a while, please be patient)")

### set the direcory where the submodules live
set(GIT_SUBMODULES_DIRECTORY dependencies)

### set the directory names of the submodules
set(GIT_SUBMODULES libcsptr dyncall)

### set each submodules's commit or tag that is to be checked out
### (leave empty if you want master)

### First, get all submodules in
if(${GIT_SUBMODULES_CHECKOUT_QUIET})
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_QUIET
ERROR_QUIET
)
else()
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
endif()

### Then, checkout each submodule to the specified commit
# Note: Execute separate processes here, to make sure each one is run,
# should one crash (because of branch not existing, this, that ... whatever)
foreach(GIT_SUBMODULE ${GIT_SUBMODULES})

if( "${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}" STREQUAL "" )
message(STATUS "no specific version given for submodule ${GIT_SUBMODULE}, checking out master")
set(GIT_SUBMODULE_VERSION_${GIT_SUBMODULE} "master")
endif()

if(${GIT_SUBMODULES_CHECKOUT_QUIET})
execute_process(
COMMAND git checkout ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE}
OUTPUT_QUIET
ERROR_QUIET
)
else()
message(STATUS "checking out ${GIT_SUBMODULE}'s commit/tag ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}")
execute_process(
COMMAND git checkout -q ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE}
)
endif()

endforeach(${GIT_SUBMODULE})

endif()
15 changes: 11 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@

!.gitignore
!.bumpversion.cfg
!.ci/*
!.cmake/*

!dev/*
!doc/*

!*.c
!*.cc
!*.h
!*.rst
!samples/tests/*.sh
!*.po
!*.in
!samples/tests/*.sh
!samples/*.expected

!LICENSE
!HEADER
!ChangeLog

CMakeFiles/
!CMakeLists.txt
!.cmake/*

!src/config.h.in
src/config.h

build

*~
*.swp
.*.swp
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "dependencies/libcsptr"]
path = dependencies/libcsptr
url = https://github.com/Snaipe/libcsptr.git
[submodule "dependencies/dyncall"]
path = dependencies/dyncall
url = https://github.com/Snaipe/dyncall.git
[submodule "dependencies/wingetopt"]
path = dependencies/wingetopt
url = https://github.com/alex85k/wingetopt.git
17 changes: 15 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@ language: c
os:
- linux
- osx

compiler:
- gcc
- gcc-4.9

sudo: false

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9

before_install:
- export GCOV="gcov-4.9"
- export LOCAL_INSTALL="$HOME"
- ".ci/install-libcsptr.sh"
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib
- export CFLAGS="-g -O0"
- export CXX="g++-4.9"
script:
- mkdir -p build
- cd build
- cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$HOME -DCMAKE_INSTALL_PREFIX=criterion-${TRAVIS_TAG} ..
- make
- make criterion_tests
- make test
after_success:
- make coveralls
Expand Down
72 changes: 56 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,49 @@
cmake_minimum_required(VERSION 2.8)

project(Criterion C)
project(Criterion C CXX)

# Project setup & environment variables
set(MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR})
set(LIBCSPTR_DISABLE_TESTS ON)
set(LIBCSPTR_DISABLE_COVERALLS ON)

enable_testing()
add_subdirectory(samples)
include(Submodules)

if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
endif ()

add_subdirectory(dependencies/libcsptr/ EXCLUDE_FROM_ALL)
add_subdirectory(dependencies/dyncall/ EXCLUDE_FROM_ALL)

include_directories(
dependencies/libcsptr/include/
dependencies/dyncall/dyncall/
)

if (MSVC)
add_subdirectory(dependencies/wingetopt/ EXCLUDE_FROM_ALL)
include_directories(dependencies/wingetopt/src/)
endif ()

# Project setup & environment variables

set(PROJECT_VERSION "1.3.1")
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
set(GettextTranslate_ALL 1)
set(GettextTranslate_GMO_BINARY 1)
set(MODULE_DIR "${CMAKE_SOURCE_DIR}/.cmake/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu99")
add_definitions(-DCRITERION_BUILDING_DLL=1)

if (NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu99")
endif ()

if (MSVC)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
endif ()

if (WIN32)
if (WIN32 AND NOT MSVC)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-no-undefined")
endif()

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

find_package(PCRE)
find_package(Libcsptr REQUIRED)

# List sources and headers

Expand All @@ -71,7 +97,11 @@ set(SOURCE_FILES
src/i18n.h
src/ordered-set.c
src/posix-compat.c
src/theories.c
src/asprintf.c
src/file.c
src/main.c
src/entry.c
)

if (PCRE_FOUND)
Expand All @@ -94,18 +124,26 @@ set(INTERFACE_FILES
include/criterion/options.h
include/criterion/ordered-set.h
include/criterion/stats.h
include/criterion/theories.h
include/criterion/asprintf-compat.h
include/criterion/designated-initializer-compat.h
include/criterion/preprocess.h
)

# Generate the configure file

configure_file(
"${CMAKE_SOURCE_DIR}/src/config.h.in"
"${CMAKE_SOURCE_DIR}/src/config.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/config.h"
)

include_directories(include src ${CSPTR_INCLUDE_DIRS})
include_directories(include src)
add_library(criterion SHARED ${SOURCE_FILES} ${INTERFACE_FILES})
target_link_libraries(criterion ${CSPTR_LIBRARIES})
target_link_libraries(criterion csptr dyncall_s)

if (MSVC)
target_link_libraries(criterion wingetopt)
endif ()

if (HAVE_CLOCK_GETTIME)
target_link_libraries(criterion rt)
Expand All @@ -130,6 +168,8 @@ install(TARGETS criterion
ARCHIVE DESTINATION lib
)

add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake"
)
add_custom_target(criterion_tests)

enable_testing()
add_subdirectory(samples)
add_subdirectory(test)
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Contributing

Contributions are welcomed, but must follow a simple set of rules in order to
be merged.

**Please follow these conventions if you want your pull request(s) accepted.**

## General

* Use 4 (four) spaces for indentation.
* No trailing whitespaces.
* 80 chars column limit.
* No trash files. Trash files are by-products of the compilation process, or
generated files that does not need to be under version control.
* Pull requests must compile and work properly.
* Pull requests must pass all tests.
* Pull requests must be mergeable automatically.
* Number of commits in a pull request should be kept to one commit and all
additional commits must be squashed.
* You may have more than one commit in a pull request if the commits are
separate changes, otherwise squash them.

## Translations

* You can contribute new translation files for output messages, on the
condition that you are fluent with the language itself.
* Each correction on existing translations must be followed by a
rationale ("why would the translation be better if the change is applied?")

## Roadmap

.
|- .cmake/: CMake modules
|- dependencies/: dependencies for building libcriterion
|- doc/: Sphinx documentation files
|- include/criterion/: Public API
|- src/: Sources for libcriterion
| `- log/: Output providers, all the output logic in general
|- po/: Translation files, i18n stuff
|- test/: Unit tests for libcriterion
`- samples/: Sample files
|- outputs/: Expected output files for the current samples
`- tests/: Internal regression tests
`- outputs/: Expected output files for the regression tests
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2015-09-14 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>

* criterion: version 2.0.0
* Breaking: ABI incompatibility with prior versions of criterion. You
**must** recompile your tests.
* Breaking: cr_abort_test(NULL) does not compile anymore.
* Change: Changed all assertion macros to accept a printf format string as a
message.
* Change: Made the API C++11-compatible.
* Change: Made the library ISO C compliant. You can now compile the library
with VC 14+.
* Addition: Added support for theories.
* Addition: Added ability to test the exit status of a test.
* Addition: Added C++11 throw assertions.
* Addition: Added assert message localization.
* Addition: Added test timeouts.
* Addition: Added test standard i/o redirection & file comparison assertions.
* Removal: Removed the deprecated prefixless assertion macros
* Deprecation: Deprecated cr_abort_test.
* Deprecation: cr_{assert,expect}_strings_* and cr_{assert,expect}_arrays_*
are deprecated in favor of cr_{assert,expect}_str_* and
cr_{assert,expect}_arr_* respectively.

2015-08-20 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>

* criterion: version 1.3.1
Expand Down
Loading

0 comments on commit a0af6a0

Please sign in to comment.