pax_global_header 0000666 0000000 0000000 00000000064 14713245764 0014527 g ustar 00root root 0000000 0000000 52 comment=91ba387904d7f43c6564486690386e76d4f8bc76
cgreen-1.6.4/ 0000775 0000000 0000000 00000000000 14713245764 0013002 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/.cproject 0000664 0000000 0000000 00000005201 14713245764 0014612 0 ustar 00root root 0000000 0000000
make
all
true
false
true
rm
-rf build
true
false
true
cgreen-1.6.4/.dir-locals.el 0000664 0000000 0000000 00000000116 14713245764 0015431 0 ustar 00root root 0000000 0000000 ((c-mode . (
(indent-tabs-mode . nil)
(c-basic-offset . 4)
)
)
)
cgreen-1.6.4/.gitattributes 0000664 0000000 0000000 00000000572 14713245764 0015701 0 ustar 00root root 0000000 0000000 # Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
cgreen-1.6.4/.github/ 0000775 0000000 0000000 00000000000 14713245764 0014342 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/.github/workflows/ 0000775 0000000 0000000 00000000000 14713245764 0016377 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/.github/workflows/asciidoctor-docs.yml 0000664 0000000 0000000 00000001450 14713245764 0022353 0 ustar 00root root 0000000 0000000 name: asciidoctor-docs
on:
push:
branches:
- master
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Includes the AsciiDoctor GitHub Pages Action to convert adoc files to html and publish to gh-pages branch
- name: asciidoctor-ghpages
uses: manoelcampos/asciidoctor-ghpages-action@v2.2.4
with:
asciidoctor_params: -r asciidoctor-diagram -a VERSION=1.6.0
source_dir: doc
post_build: git add -f *.png
adoc_file_ext: .asciidoc
cgreen-1.6.4/.gitignore 0000664 0000000 0000000 00000000254 14713245764 0014773 0 ustar 00root root 0000000 0000000 build
.idea
.cache
CMakeCache.txt
CMakeFiles
Testing
*.exe
*.stackdump
*.so
build-stamp
configure-stamp
*~
#*#
.#*
bin
lib
valgrind.log
gitrevision.h
.cgreen-debug-commands cgreen-1.6.4/.project 0000664 0000000 0000000 00000004363 14713245764 0014457 0 ustar 00root root 0000000 0000000
cgreen
org.eclipse.cdt.managedbuilder.core.genmakebuilder
clean,full,incremental,
?name?
org.eclipse.cdt.make.core.append_environment
true
org.eclipse.cdt.make.core.autoBuildTarget
all
org.eclipse.cdt.make.core.buildArguments
org.eclipse.cdt.make.core.buildCommand
make
org.eclipse.cdt.make.core.cleanBuildTarget
clean
org.eclipse.cdt.make.core.contents
org.eclipse.cdt.make.core.activeConfigSettings
org.eclipse.cdt.make.core.enableAutoBuild
false
org.eclipse.cdt.make.core.enableCleanBuild
true
org.eclipse.cdt.make.core.enableFullBuild
true
org.eclipse.cdt.make.core.fullBuildTarget
all
org.eclipse.cdt.make.core.stopOnError
true
org.eclipse.cdt.make.core.useDefaultBuildCmd
true
org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
org.eclipse.cdt.core.cnature
org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
org.eclipse.cdt.managedbuilder.core.managedBuildNature
org.eclipse.cdt.core.ccnature
cgreen-1.6.4/.travis.yml 0000664 0000000 0000000 00000003716 14713245764 0015122 0 ustar 00root root 0000000 0000000 language: c
dist: focal
# Build matrix
arch:
- amd64
- s390x
compiler:
- gcc
- clang
env:
- CGREEN_WITH_STATIC_LIBRARY="OFF"
- CGREEN_WITH_STATIC_LIBRARY="ON"
addons:
apt:
packages:
- cmake
- lcov
- g++
- valgrind
- libxml2-dev
before_install:
- if [[ $CC == gcc ]] ; then export CXX=g++ ; else export CXX=clang++ ; fi
- $CC --version
- $CXX --version
- gem install coveralls-lcov
- if [ "$CC" = "gcc" ]; then export WITH_GCOV=ON; else WITH_GCOV=OFF; fi
script:
- mkdir -p build
- cd build
- cmake -DCGREEN_WITH_XML:BOOL=OFF -DCGREEN_WITH_LIBXML2:BOOL=OFF -DCGREEN_WITH_UNIT_TESTS:BOOL=ON -DCGREEN_WITH_STATIC_LIBRARY:BOOL=$CGREEN_WITH_STATIC_LIBRARY -DCGREEN_INTERNAL_WITH_GCOV:BOOL=OFF .. && make -j2 && ctest --output-on-failure
- rm -f CMakeCache.txt
- cmake -DCGREEN_WITH_UNIT_TESTS:BOOL=ON -DCGREEN_WITH_STATIC_LIBRARY:BOOL=$CGREEN_WITH_STATIC_LIBRARY -DCGREEN_INTERNAL_WITH_GCOV:BOOL=$WITH_GCOV .. && make -j2 && ctest --output-on-failure
after_success:
- if [ "$CC" = "gcc" ];
then
lcov -d tests -d src -d tools -base-directory .. -c -o coverage.info;
lcov --remove coverage.info '/usr/*' -o coverage.info;
cd ..;
coveralls-lcov build/coverage.info;
fi
notifications:
slack:
rooms:
secure: "Tobw+sqwGWscQo/mnBiO/+CQDMu8of5kXUhFKK1GblxTqxvJGGRVVvjt5ZlYaTyJD6YCzaVAO9hSjMvebnTTIqqP5WFmhpO3Du3khZJhFjzhqfjIUmK4S0rAMs3BBvLTGAUa0Hvnrt1VOkOJUdwdSW8nmnw9uFx3rVCthAOLkQugUY4s8tCc/QHBJPUSqdKntTq9e4bapaMl4gREPFvtneOyN7LQp0JtI/nyrdTVlONaqkPv7M8sEC7a6ec6RK/AiEurp8XczNW0ifTwqCg2y/sLfnRg+wzG1H9sMmzs+Kx7akcGdGzi/rqWRnBDF3mKL4pt8YhmBy/znDnMAR559puRiyz6ZZhlBKRviZrsfQmC0F3IyTZY/S3SjvatT9DrAIsHDLbDNxRxzO0GC+cpkq4HU8VnF4rQ31VVb75igMHzgw3SvDOqsZ3g0jPiBybEi0jVRUzmDWrw7p6qtl5hwQam6dxfmO6xXpwOTqPI9WQEOZeZfOw7eIeEbpB5wJ723z2cEwutoDdConIZElJBKjcjFp5rjR/yG94H/0OEgCmC/JRrdd71BB9vPh4SO40RvKkxV0adY7Xk2vkAxwLFhxS7QIdNfyQBFFEBnR+JFBHE+9XwEH1JmaAbrSYgg0+vVUZPOuqcqvz+9PUTlAb5rqYB97XEbF//5t8URrriuB0="
cgreen-1.6.4/.vscode/ 0000775 0000000 0000000 00000000000 14713245764 0014343 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/.vscode/launch.json 0000664 0000000 0000000 00000001131 14713245764 0016504 0 ustar 00root root 0000000 0000000 {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Cgreen C tests",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/tests/test_cgreen_c",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"MIMode": "lldb"
//"miDebuggerPath": "/opt/clang+llvm-15.0.6-arm64-apple-darwin21.0//bin/lldb-vscode"
}
]
}
cgreen-1.6.4/CMakeLists.txt 0000664 0000000 0000000 00000013254 14713245764 0015547 0 ustar 00root root 0000000 0000000 cmake_minimum_required(VERSION 3.10)
project(cgreen)
if (NOT(CMAKE_MAJOR_VERSION LESS 3) AND APPLE)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) # CMake 3.0 to use @rpath on MacOSX libraries
endif()
endif()
find_package (Threads)
set(CGREEN_WITH_XML ON CACHE BOOL
"Add a simple XML report generator without external dependencies")
set(CGREEN_WITH_LIBXML2 ON CACHE BOOL
"Add an XML report generator which uses libxml2 for output formatting")
if (CGREEN_WITH_LIBXML2)
find_package (LibXml2)
if (NOT LibXml2_FOUND)
set(CGREEN_WITH_LIBXML2 OFF)
endif (NOT LibXml2_FOUND)
endif (CGREEN_WITH_LIBXML2)
enable_testing()
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
# VERSION:
# NOTE: If you change version here, also change in
# include/cgreen/cgreen.h unless you write some code that
# automatically updates that...
set(APPLICATION_VERSION_MAJOR "1")
set(APPLICATION_VERSION_MINOR "6")
set(APPLICATION_VERSION_PATCH "4")
set(APPLICATION_VERSION ${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}${APPLICATION_VERSION_STATUS})
add_definitions(-DVERSION="${APPLICATION_VERSION}")
set(LIBRARY_VERSION ${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH})
set(LIBRARY_SOVERSION ${APPLICATION_VERSION_MAJOR})
# INSTALL:
include(GNUInstallDirs)
if(MSVC)
# these have sensible defaults on other platforms
set(CMAKE_INSTALL_BINDIR ".")
set(CMAKE_INSTALL_LIBDIR ".")
endif(MSVC)
# If OSX and using Homebrew use its install prefix
find_program(BREW brew)
if (BREW)
execute_process(COMMAND brew --prefix OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# COMPLETION:
set(BASHCOMPLETION_STATUS "Unavailable")
find_package(bash-completion QUIET)
if(BASH_COMPLETION_FOUND OR UNIX)
set(BASHCOMPLETION_STATUS "Available")
install(FILES tools/cgreen_completion.bash DESTINATION "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" RENAME "cgreen-runner")
install(FILES tools/cgreen_completion.bash DESTINATION "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" RENAME "cgreen-debug")
endif()
# CMAKE MODULES:
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/Modules
)
# add definitions
include(DefineCMakeDefaults)
include(DefineCompilerFlags)
include(DefineOptions.cmake)
include(DefineCPackConfig)
# add macros
include(MacroAddPlugin)
include(MacroCopyFile)
# GIT REVISION:
# Generate gitrevision.h if Git is available and the .git directory is found.
find_program(GIT_EXECUTABLE git DOC "Git version control")
mark_as_advanced(GIT_EXECUTABLE)
# Find path to .git/logs/HEAD so that the gitrevision.h generation will only
# happen on new commits. This is done from $PROJECT_SOURCE_DIR because git rev-parse
# doesn't always return an absolute path so need to use get_filename_component()
# to get a cross-platform `readlink -f $(git rev-parse --git-path logs/HEAD)`
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --git-path logs/HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GITDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (GITDIR)
get_filename_component(GITDIR "${GITDIR}" ABSOLUTE)
endif()
# config.h checks
include(ConfigureChecks.cmake)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# check subdirectories
add_subdirectory(src)
add_subdirectory(doc)
add_subdirectory(include)
# Dependency on our own library so we can use CGREEN_LIBRARY in all subdirectories
if (CGREEN_WITH_STATIC_LIBRARY)
set(CGREEN_LIBRARY ${CGREEN_STATIC_LIBRARY})
else ()
set(CGREEN_LIBRARY ${CGREEN_SHARED_LIBRARY})
endif()
if (CGREEN_WITH_UNIT_TESTS)
include(MacroAddUnitTest)
include(MacroAddTest)
include(MacroAddValgrindTest)
add_subdirectory(tests)
if (UNIX OR MSYS)
# reflective runner only supported on UNIX/binutils platforms
add_subdirectory(tools)
endif(UNIX OR MSYS)
endif (CGREEN_WITH_UNIT_TESTS)
# add custom 'check' target to run tests with output-on-failure
if (CMAKE_CONFIGURATION_TYPES)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process --output-on-failure
--build-config "$")
else()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process --output-on-failure)
endif()
IF(CGREEN_INTERNAL_WITH_GCOV)
IF(CMAKE_C_COMPILER_ID STREQUAL GNU)
include(CodeCoverage)
add_custom_target(coverage
COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage.info
COMMAND ${LCOV_PATH} --remove coverage.info '/usr/*' -o coverage.info
COMMAND ${GENHTML_PATH} -o coverage coverage.info
)
ENDIF()
ELSE()
add_custom_target(coverage
COMMAND echo "WARNING: Configure CGREEN_INTERNAL_WITH_GCOV to get coverage")
ENDIF()
#### Begin cgreen package configuration steps. ####
# After install other CMake projects can
# use find_package( cgreen )
set( CONFIG_INSTALL_DIR
"${CMAKE_INSTALL_LIBDIR}/cmake/${APPLICATION_NAME}" )
set( PROJECT_CONFIG_IN
"${CMAKE_CURRENT_SOURCE_DIR}/cgreen-config.cmake.in" )
set( VERSION_CONFIG_IN
"${CMAKE_CURRENT_SOURCE_DIR}/cgreen-config-version.cmake.in" )
set( PROJECT_CONFIG
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cgreen-config.cmake" )
set( VERSION_CONFIG
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cgreen-config-version.cmake" )
configure_file( ${PROJECT_CONFIG_IN}
"${PROJECT_CONFIG}" @ONLY )
configure_file( ${VERSION_CONFIG_IN}
"${VERSION_CONFIG}" @ONLY )
install(FILES
"${PROJECT_CONFIG}" "${VERSION_CONFIG}"
DESTINATION
"${CONFIG_INSTALL_DIR}" )
#### End cgreen package configuration steps. ####
cgreen-1.6.4/CTestConfig.cmake 0000664 0000000 0000000 00000001021 14713245764 0016146 0 ustar 00root root 0000000 0000000 ## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "CGreen")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=CGreen")
set(CTEST_DROP_SITE_CDASH TRUE)
cgreen-1.6.4/ConfigureChecks.cmake 0000664 0000000 0000000 00000000616 14713245764 0017051 0 ustar 00root root 0000000 0000000 include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckCXXSourceCompiles)
set(PACKAGE ${APPLICATION_NAME})
set(VERSION ${APPLICATION_VERSION})
set(DATADIR ${DATA_INSTALL_DIR})
set(LIBDIR ${LIB_INSTALL_DIR})
set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
cgreen-1.6.4/DefineOptions.cmake 0000664 0000000 0000000 00000000367 14713245764 0016560 0 ustar 00root root 0000000 0000000 option(CGREEN_WITH_STATIC_LIBRARY "Build with a static library" OFF)
option(CGREEN_WITH_UNIT_TESTS "Build unit tests" ON)
option(CGREEN_INTERNAL_WITH_GCOV "Build with test coverage instrumentation" OFF)
mark_as_advanced(CGREEN_INTERNAL_WITH_GCOV)
cgreen-1.6.4/INSTALL.md 0000664 0000000 0000000 00000005246 14713245764 0014441 0 ustar 00root root 0000000 0000000 # Building and Installing Cgreen
Here are your alternatives for installing `Cgreen`.
## Install using your distro package manager
Cgreen is available for [some Linux distros]
(https://repology.org/project/cgreen/versions). If you are on one of
those you can do
$ sudo apt install cgreen1
or equivalent. Not all distros have an up-to-date version.
## Install pre-built binary
There are occassionally pre-built binaries available from [the GitHub
repo](https://github.com/cgreen-devs/cgreen/releases). You can
download and install these using an appropriate package manager.
## Build from source
### Get source and build
Clone the [`Cgreen` repo](https://github.com/cgreen-devs/cgreen)
$ git clone https://github.com/cgreen-devs/cgreen
or get the source from the same place.
Then build it
$ cd cgreen
$ make
The Makefile is mainly for convenience as `Cgreen` is actually built
using `CMake`. So you can tweak the build using normal `CMake`
settings.
You can run some tests using
$ make unit
$ make test
NOTE: to also build the dynamically auto-discovering runner
`cgreen-runner`, which `make unit` uses, you need `binutils` as per
the description in the README.md.
### Build options
You also have some extra options available
- build with static libraries
- build HTML or PDF documentation
To enable any of these use the `CMake` graphical user interface (CMakeSetup
on Windows or ccmake on UNIX) to turn these options on or off.
Note on CYGWIN: Cygwin is not a WIN32 platform, but it is a
DLL-platform where libraries normally goes in the bin directory. Running
the self-tests handles this automatically but if you want to use the binaries
in the 'build'-tree you can either:
1) install before running the tests and also set your PATH to include
"/usr/local/lib"
2) setting the PATH to include the build directory where the libraries are
there is a sh-compatible command script to do that for you. From the top
of the Cgreen source directory do:
. cygwin-setup.sh
### Use directly
You can use `Cgreen` from the source tree without actually
installing. Just set your compilation includes to include
`/include` and link with the built library by pointing
the linker to `/build/src/` and use `-lcgreen`. E.g.
$ cc ... -I/home/me/cgreen/include ...
$ cc ... -L/home/me/cgreen/build/src -lcgreen ...
### Install
You can also install `Cgreen` with
$ make install
which will install `Cgreen` in what `CMake` considers standard
locations for your environment. Assuming that is `/usr/local` you
should now be able to compile and link using
$ cc ... -I/usr/local/include ...
$ cc ... -L/usr/local/lib -lcgreen ...
cgreen-1.6.4/LICENSE 0000664 0000000 0000000 00000001350 14713245764 0014006 0 ustar 00root root 0000000 0000000 ISC License
Copyright (c) [year], [fullname]
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
cgreen-1.6.4/Makefile 0000664 0000000 0000000 00000011106 14713245764 0014441 0 ustar 00root root 0000000 0000000 # This Makefile ensures that the build is made out of source in a
# subdirectory called 'build' If it doesn't exist, it is created.
#
# This Makefile also contains delegation of the most common make commands
#
# If you have cmake installed you should be able to do:
#
# make
# make test
# make install
# make package
#
# That should build Cgreen in the build directory, run some tests,
# install it locally and generate a distributable package.
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif
.PHONY:all
all: build-it
.PHONY:debug
debug:
cmake -DCMAKE_BUILD_TYPE:string=Debug -S . -B build
$(MAKE) -C build
.PHONY:test
test: build-it
cd build; ctest
.PHONY:clean
clean: build/Makefile
$(MAKE) -C build clean
.PHONY:package
package: build/Makefile
$(MAKE) -C build package
.PHONY:install
install: build
ifeq ($(OS),Msys)
# Thanks to https://stackoverflow.com/a/46027426/204658
$(MAKE) -C build install DESTDIR=/
else
$(MAKE) -C build install
endif
# This is kind of a hack to get a quicker and clearer feedback when
# developing Cgreen by allowing 'make unit'. Must be updated when new
# test libraries or output comparisons are added.
# Find out if 'uname -o' works, if it does - use it, otherwise use 'uname -s'
UNAMEOEXISTS=$(shell uname -o &>/dev/null; echo $$?)
ifeq ($(UNAMEOEXISTS),0)
OS=$(shell uname -o)
else
OS=$(shell uname -s)
endif
# Set prefix and suffix for shared libraries depending on platform
ifeq ($(OS),Darwin)
LDPATH=DYLD_LIBRARY_PATH=$(PWD)/build/src
PREFIX=lib
SUFFIX=.dylib
else ifeq ($(OS),Cygwin)
LDPATH=PATH=$(PWD)/build/src:"$$PATH"
PREFIX=cyg
SUFFIX=.dll
else ifeq ($(OS),Msys)
# This is for Msys "proper"
# TODO: handle Msys/Mingw32/64
LDPATH=PATH=$(PWD)/build/src:"$$PATH"
PREFIX=msys-
SUFFIX=.dll
else
LDPATH=LD_LIBRARY_PATH=$(PWD)/build/src
PREFIX=lib
SUFFIX=.so
endif
# Here are
#
# 1. tests linked into a library that we run as is
# 2. tests linked into a library that we run and compare its normalized output to expected output
# TODO: the diff_tools scripts determine prefix and extension by themselves
# Would be better if those were arguments, since we do it here anyway
# These "diff tools" also normalize the output using replacements
DIFF_TOOL=../../tools/cgreen_runner_output_diff
XML_DIFF_TOOL=../../tools/cgreen_xml_output_diff
DIFF_TOOL_ARGUMENTS = $(1)_tests \
../../tests \
$(1)_tests.expected
.PHONY: unit
unit: build-it
cd build ; \
$(LDPATH) tools/cgreen-runner -c `find tests -name $(PREFIX)cgreen_c_tests$(SUFFIX)` ; \
r=$$((r + $$?)) ; \
$(LDPATH) tools/cgreen-runner -c `find tests -name $(PREFIX)cgreen_cpp_tests$(SUFFIX)` ; \
r=$$((r + $$?)) ; \
$(LDPATH) tools/cgreen-runner -c `find tools -name $(PREFIX)cgreen_runner_tests$(SUFFIX)` ; \
r=$$((r + $$?)) ; \
cd tests ; \
$(LDPATH) $(XML_DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,xml_output) ; \
r=$$((r + $$?)) ; \
$(LDPATH) $(DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,assertion_messages) ; \
r=$$((r + $$?)) ; \
$(LDPATH) $(DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,mock_messages) ; \
r=$$((r + $$?)) ; \
$(LDPATH) $(DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,constraint_messages) ; \
r=$$((r + $$?)) ; \
$(LDPATH) $(DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,custom_constraint_messages) ; \
r=$$((r + $$?)) ; \
$(LDPATH) $(DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,ignore_messages) ; \
r=$$((r + $$?)) ; \
$(LDPATH) CGREEN_PER_TEST_TIMEOUT=1 $(DIFF_TOOL) $(call DIFF_TOOL_ARGUMENTS,failure_messages) ; \
r=$$((r + $$?)) ; \
exit $$r
.PHONY: doc
doc: build
cmake -DCGREEN_WITH_HTML_DOCS:bool=TRUE -S . -B build
cmake --build build
cmake -DCGREEN_WITH_HTML_DOCS:bool=False -S . -B build
echo open $(PWD)/build/doc/cgreen-guide-en.html
pdf: build
cmake -DCGREEN_WITH_PDF_DOCS:bool=TRUE -S . -B build
cmake --build build
cmake -DCGREEN_WITH_PDF_DOCS:bool=FALSE -S . -B build
echo open $(PWD)/build/doc/cgreen-guide-en.pdf
chunked: doc
asciidoctor-chunker build/doc/cgreen-guide-en.html -o docs
echo open $(PWD)/docs/index.html
.PHONY:valgrind
valgrind: build-it
@echo -n "Running all tests under Valgrind "
@> valgrind.log
@for lib in `ls build/tests/$(PREFIX)*_tests$(SUFFIX)` ; \
do \
echo -n "." ; \
LD_LIBRARY_PATH=build/src valgrind --leak-check=full build/tools/cgreen-runner $$lib >> valgrind.log 2>&1 ; \
done
@echo
grep --with-filename --line-number " lost: " valgrind.log | grep -v " 0 bytes" ; \
if [ $$? -eq 1 ] ; then echo "Nothing lost" ; fi
############# Internal
build build/Makefile:
ifeq ($(OS),Darwin)
cmake -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -S . -B build
#cmake -S . -B build
else
cmake -S . -B build
endif
.PHONY:build-it
build-it: build
$(MAKE) -C build
.SILENT:
cgreen-1.6.4/README.md 0000664 0000000 0000000 00000016021 14713245764 0014261 0 ustar 00root root 0000000 0000000 [](https://app.travis-ci.com/github/cgreen-devs/cgreen)
[](https://coveralls.io/github/cgreen-devs/cgreen?branch=master)

Cgreen - The Modern Unit Test and Mocking Framework for C and C++
=================================================================
Do you TDD? In C or C++? Maybe you want to have your tests read out in
a fluent fashion? Like this
Ensure(Converter, converts_XIV_to_14) {
assert_that(convert_roman_to_decimal("XIV"), is_equal_to(14));
}
And you want output like this
roman_test.c:12: Failure: Converter -> converts_XIV_to_14
Expected [convert_roman_to_decimal("XIV")] to [equal] [14]
actual value: [0]
expected value: [14]
Then *Cgreen* is the thing for you!
**TLDR;** The full tutorial is on
[github.io](https://cgreen-devs.github.io/cgreen/cgreen-guide-en.html).
Or have a look at the [cheat sheet](https://cgreen-devs.github.io/cgreen/cheat-sheet.html).
## What It Is
Cgreen is a modern unit test and mocking framework for C and C++.
Here are some of Cgreens unique selling points:
- fast build, clean code, highly portable
- auto-discovery of tests without the abuse of static initializers or globals
- extensible without recompiling
- fluent, expressive and readable API with the same modern syntax across C and C++
- process isolation for each test preventing intermittent failures
and cross-test dependencies
- built-in mocking for C, compatible with mockitopp and other C++ mocking libraries
- expressive and clear output using the default reporter
- fully functional mocks, both strict, loose and learning
- mocks with side effects
- extensive and expressive constraints for many datatypes
- custom constraints can be constructed by user
- bdd-flavoured test declarations with Before and After declarations
- extensible reporting mechanism
- fully composable test suites
- a single test can be run in a single process for easier debugging
## Getting It
Cgreen is hosted on [GitHub](https://github.com/cgreen-devs/cgreen).
As of now there are no pre-built packages to download, but Cgreen is available in [Debian, Fedora and some other package repositories](https://repology.org/project/cgreen/versions), although some are lagging.
There are also some other packaging scripts available, not all official:
- [PACMAN script](https://github.com/voins/cgreen-pkg)
- [MacOS packagesbuild](https://github.com/cgreen-devs/cgreen-macosx-packaging)
- [Cygwin package script](https://github.com/cgreen-devs/cgreen-cygport)
You can also clone the repository or download the source zip from [GitHub](http://www.github.com/cgreen-devs/cgreen) and build it yourself.
## Building It
You need the [CMake](http://www.cmake.org) build system.
Most standard C/C++ compilers should work. GCC definitely does.
Perl, diff, find and sed are required to run Cgreen's own
unit-tests. Most distro will have those already installed.
In the root directory run ``make``. That will configure and build the
library and the `cgreen-runner`, both supporting both C and C++. See
also the documentation.
## Using It
Tests are fairly easy write, as shown by the examples in the beginning
of this readme. You should probably read the
[tutorial](https://cgreen-devs.github.io/cgreen/cgreen-guide-en.html) once before writing your
first test, though.
Basically you can run your tests in two ways
1. Compile and link all your tests with a test driver (as shown in the
fist chapters of the tutorial)
2. Link your tests into separate shared libraries (`.so`, `.dylib` or
similar) and run them with the `cgreen-runner` (described in chapter
6 of the tutorial)
Option 2 is very handy, you can run multiple libraries in the same
run, but also specify single tests that you want to run. And with the
completion script available for bash you can get TAB-completion not
only for files and options but also for tests inside the libraries.
`cgreen-debug` is a small script that you invoke in the same way as
the runner but runs a single, specified, test and puts you in the
debugger at the start of that test. Awesome!
## Using Cgreen in other CMake projects
Once Cgreen is installed you can use ``find_package(cgreen)`` in your CMake
projects to get access to useful variables like ``${CGREEN_LIBRARIES}``,
``${CGREEN_EXECUTABLE}`` and ``${CGREEN_INCLUDE_DIRS}``. Version can be
specified in ``find_package`` as well. For example, in order to enforce a minimum
version of Cgreen in your project use ``find_package(cgreen 1.1.0)``
## Reading Up!
You can read the extensive tutorial directly on
[GitHub](https://cgreen-devs.github.io/cgreen/cgreen-guide-en.html).
There is a [cheat sheet](https://github.com/cgreen-devs/cgreen/blob/master/doc/cheat-sheet.md)
available.
You can also build the documentation yourself in HTML and PDF format.
Generate it using Asciidoctor, which can be done using the CMake
configuration. Of course you need
[Asciidoctor](http://www.asciidoctor.org).
make doc
make pdf
(Generating PDF also requires [asciidoctor-pdf](https://asciidoctor.org/docs/asciidoctor-pdf/).)
## License
Cgreen is licensed under the ISC License
(http://spdx.org/licenses/ISC), sometimes known as the OpenBSD
license. If there is no licence agreement with this package please
download a version from the location above. You must read and accept
that licence to use this software. The file is titled simply LICENSE.
## The Original Version
What is it? It's a framework for unit testing, written in C. A tool
for C developers writing tests of their own code.
If you have used JUnit, or any of the xUnit clones, you will find
the concept familiar. In particular the tool supports a range of
assertions, composable test suites and setup/teardown facilities.
Because of the peculiarities of C programming, each test function
is normally run in it's own process.
This project is very close in scope to the "Check" unit tester and
was initially influenced by it.
The main difference from this tool and other xUnit tools, such as
"Check", is that test results are not stored. Instead they are
streamed to the reporter psuedo-class, one that is easily
overridden by the end user.
The other main extra feature is the support for writing mock
callbacks. This includes generating sequences for return values
or parameter expectations.
Feedback, queries and request should be put to the cgreen developers
through https://github.com/cgreen-devs/cgreen.
This tool is basically a spin off from a research project at
Wordtracker and would not have happened without the generous
financial support of the Wordtracker keyword tool...
http://www.wordtracker.com/
Substantial inital work by Marcus Baker . Recent
additions by Matt Hargett , Thomas Nilefalk
, João Freitas and others.
cgreen-1.6.4/cgreen-config-version.cmake.in 0000664 0000000 0000000 00000000711 14713245764 0020601 0 ustar 00root root 0000000 0000000 set(PACKAGE_VERSION "@APPLICATION_VERSION_MAJOR@.@APPLICATION_VERSION_MINOR@.@APPLICATION_VERSION_PATCH@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
cgreen-1.6.4/cgreen-config.cmake.in 0000664 0000000 0000000 00000001002 14713245764 0017110 0 ustar 00root root 0000000 0000000 # - Config file for the cgreen package
# It defines the following variables
# CGREEN_CMAKE_DIR - include directories for cgreen
# CGREEN_INCLUDE_DIRS - include directories for cgreen
# CGREEN_LIBRARIES - libraries to link against
# CGREEN_EXECUTABLE - the cgreen executable
get_filename_component( CGREEN_CMAKE_DIRS "${CMAKE_CURRENT_LIST_FILE}" PATH )
# leave this up to cmake
find_path(CGREEN_INCLUDE_DIRS NAMES cgreen/cgreen.h)
set( CGREEN_LIBRARIES cgreen )
set( CGREEN_EXECUTABLE cgreen-runner )
cgreen-1.6.4/cmake/ 0000775 0000000 0000000 00000000000 14713245764 0014062 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/cmake/Modules/ 0000775 0000000 0000000 00000000000 14713245764 0015472 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/cmake/Modules/COPYING-CMAKE-SCRIPTS 0000664 0000000 0000000 00000002457 14713245764 0020500 0 ustar 00root root 0000000 0000000 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cgreen-1.6.4/cmake/Modules/CodeCoverage.cmake 0000664 0000000 0000000 00000007361 14713245764 0021031 0 ustar 00root root 0000000 0000000 # - Enable Code Coverage
#
# 2012-01-31, Lars Bilke
#
# USAGE:
# 1. Copy this file into your cmake modules path
# 2. Add the following line to your CMakeLists.txt:
# INCLUDE(CodeCoverage)
#
# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
# which runs your test executable and produces a lcov code coverage report.
#
# Check prereqs
FIND_PROGRAM( GCOV_PATH gcov )
FIND_PROGRAM( LCOV_PATH lcov )
FIND_PROGRAM( GENHTML_PATH genhtml )
FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
IF(NOT GCOV_PATH)
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
ENDIF() # NOT GCOV_PATH
IF(NOT CMAKE_C_COMPILER_ID STREQUAL GNU)
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF()
IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
# Setup compiler options
ADD_DEFINITIONS(-fprofile-arcs -ftest-coverage)
LINK_LIBRARIES(gcov)
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests
# Param _outputname lcov output is generated as _outputname.info
# HTML report is generated in _outputname/index.html
# Optional fourth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
IF(NOT LCOV_PATH)
MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
ENDIF() # NOT LCOV_PATH
IF(NOT GENHTML_PATH)
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
ENDIF() # NOT GENHTML_PATH
# Setup target
ADD_CUSTOM_TARGET(${_targetname}
# Cleanup lcov
${LCOV_PATH} --directory . --zerocounters
# Run tests
COMMAND ${_testrunner} ${ARGV3}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests
# Param _outputname cobertura output is generated as _outputname.xml
# Optional fourth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
IF(NOT PYTHON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
ENDIF() # NOT PYTHON_EXECUTABLE
IF(NOT GCOVR_PATH)
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
ENDIF() # NOT GCOVR_PATH
ADD_CUSTOM_TARGET(${_targetname}
# Run tests
${_testrunner} ${ARGV3}
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
cgreen-1.6.4/cmake/Modules/DefineCMakeDefaults.cmake 0000664 0000000 0000000 00000001577 14713245764 0022271 0 ustar 00root root 0000000 0000000 # Always include srcdir and builddir in include path
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
# about every subdir
# since cmake 2.4.0
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are prefered over the already installed ones
# since cmake 2.4.1
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Use colored output
# since cmake 2.4.0
set(CMAKE_COLOR_MAKEFILE ON)
# Define the generic version of the libraries here
set(GENERIC_LIB_VERSION "0.1.0")
set(GENERIC_LIB_SOVERSION "0")
# Set the default build type to release with debug info
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo
CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
)
endif (NOT CMAKE_BUILD_TYPE)
cgreen-1.6.4/cmake/Modules/DefineCPackConfig.cmake 0000664 0000000 0000000 00000004302 14713245764 0021715 0 ustar 00root root 0000000 0000000 include(InstallRequiredSystemLibraries)
# For help take a look at:
# http://www.cmake.org/Wiki/CMake:CPackConfiguration
### general settings
set(CPACK_PACKAGE_NAME ${APPLICATION_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The modern C/C++ unit testing/mocking framework")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_VENDOR "The CGreen Development Team")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
### versions
set(CPACK_PACKAGE_VERSION_MAJOR ${APPLICATION_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${APPLICATION_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${APPLICATION_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_STATUS ${APPLICATION_VERSION_STATUS})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_PACKAGE_VERSION_STATUS}")
### source generator
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-src")
### binary generator
if (WIN32)
### nsis generator
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_NSIS_COMPRESSOR "/SOLID zlib")
set(CPACK_NSIS_MENU_LINKS "http://cgreen.sourceforge.net" "Cgreen Homepage")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
endif()
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
set(PACKAGE_NAME ${APPLICATION_NAME})
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BITS 64)
else()
set(BITS 32)
endif()
set(CPACK_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}${BITS})
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
"Libraries used to build programs which use cgreen")
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
"C/C++ header files for use with cgreen")
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
include(CPack)
cgreen-1.6.4/cmake/Modules/DefineCompilerFlags.cmake 0000664 0000000 0000000 00000004614 14713245764 0022343 0 ustar 00root root 0000000 0000000 # define system dependent compiler flags
include(CheckCCompilerFlag)
set (COMPILER_IS_CLANG FALSE)
if (${CMAKE_C_COMPILER_ID} MATCHES "Clang")
set (COMPILER_IS_CLANG TRUE)
endif (${CMAKE_C_COMPILER_ID} MATCHES "Clang")
if (CGREEN_WITH_XML)
add_definitions(-DHAVE_XML_REPORTER=1)
endif (CGREEN_WITH_XML)
if (CGREEN_WITH_LIBXML2)
add_definitions(-DHAVE_LIBXML2_REPORTER=1)
endif (CGREEN_WITH_LIBXML2)
if (UNIX)
if (CMAKE_COMPILER_IS_GNUCC OR COMPILER_IS_CLANG)
# add_compile_options(-Wall -Wextra -Wunused) # only since CMake 2.8.12, so...
add_definitions(-Wall -Wextra -Wunused)
if (CGREEN_WITH_LIBXML2)
# libxml2 headers depend on ICU library for Unicode support,
# but ICU headers do not even compile with C++ 98.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
endif (CGREEN_WITH_LIBXML2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wstrict-prototypes")
if (CGREEN_INTERNAL_WITH_GCOV)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs")
endif (CGREEN_INTERNAL_WITH_GCOV)
add_definitions(-D_REENTRANT) # for gmtime_r()
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*OpenBSD.*")
add_definitions(-D_XOPEN_SOURCE) # for popen() and pclose()
add_definitions(-D_XOPEN_SOURCE_EXTENDED) # for strdup(), which isn't part of C99
endif()
add_definitions(-D__STDC_FORMAT_MACROS) # for PRI*PTR format macros, required by C99
if (NOT CYGWIN)
# with -fPIC
check_c_compiler_flag("-fPIC" WITH_FPIC)
if (WITH_FPIC)
# add_compile_options(-fPIC) # Only since CMake 2.8.12, so...
add_definitions(-fPIC)
endif (WITH_FPIC)
endif (NOT CYGWIN)
check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
if (WITH_FORTIFY_SOURCE)
add_definitions(-D_FORTIFY_SOURCE=2)
endif (WITH_FORTIFY_SOURCE)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-O)
endif ()
endif (CMAKE_COMPILER_IS_GNUCC OR COMPILER_IS_CLANG)
endif (UNIX)
if (WIN32)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
endif (MSVC)
endif (WIN32)
cgreen-1.6.4/cmake/Modules/DefineRelativeFilePaths.cmake 0000664 0000000 0000000 00000000703 14713245764 0023162 0 ustar 00root root 0000000 0000000 # Source: https://stackoverflow.com/questions/237542/getting-base-name-of-the-source-file-at-compile-time
function (cmake_define_relative_file_paths SOURCES)
foreach (SOURCE IN LISTS SOURCES)
file (
RELATIVE_PATH RELATIVE_SOURCE_PATH
${PROJECT_SOURCE_DIR} ${SOURCE}
)
set_source_files_properties (
${SOURCE} PROPERTIES
COMPILE_DEFINITIONS FILENAME="${RELATIVE_SOURCE_PATH}"
)
endforeach ()
endfunction ()
cgreen-1.6.4/cmake/Modules/FindAsciidoc.cmake 0000664 0000000 0000000 00000001705 14713245764 0021016 0 ustar 00root root 0000000 0000000 # - Find Asciidoc
# this module looks for asciidoc and a2x
#
# ASCIIDOC_EXECUTABLE - the full path to asciidoc
# ASCIIDOC_FOUND - If false, don't attempt to use asciidoc.
# A2X_EXECUTABLE - the full path to a2x
# A2X_FOUND - If false, don't attempt to use a2x.
FIND_PROGRAM(ASCIIDOC_EXECUTABLE
asciidoc
)
MARK_AS_ADVANCED(
ASCIIDOC_EXECUTABLE
)
IF (NOT ASCIIDOC_EXECUTABLE)
SET(ASCIIDOC_FOUND "NO")
ELSE (NOT ASCIIDOC_EXECUTABLE)
SET(ASCIIDOC_FOUND "YES")
ENDIF (NOT ASCIIDOC_EXECUTABLE)
IF (NOT ASCIIDOC_FOUND AND Asciidoc_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find asciidoc")
ENDIF (NOT ASCIIDOC_FOUND AND Asciidoc_FIND_REQUIRED)
FIND_PROGRAM(A2X_EXECUTABLE
a2x
)
MARK_AS_ADVANCED(
A2X_EXECUTABLE
)
IF (NOT A2X_EXECUTABLE)
SET(A2X_FOUND "NO")
ELSE (NOT A2X_EXECUTABLE)
SET(A2X_FOUND "YES")
ENDIF (NOT A2X_EXECUTABLE)
IF (NOT A2X_FOUND AND A2x_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find a2x")
ENDIF (NOT A2X_FOUND AND A2x_FIND_REQUIRED)
cgreen-1.6.4/cmake/Modules/FindAsciidoctor.cmake 0000664 0000000 0000000 00000001775 14713245764 0021552 0 ustar 00root root 0000000 0000000 # Find Asciidoctor - a better AsciiDoc
#
# ASCIIDOCTOR_FOUND
# ASCIIDOCTORPDF_FOUND
# ASCIIDOCTOR_EXECUTABLE
# ASCIIDOCTORPDF_EXECUTABLE
FIND_PROGRAM(ASCIIDOCTOR_EXECUTABLE asciidoctor)
FIND_PROGRAM(ASCIIDOCTORPDF_EXECUTABLE asciidoctor-pdf)
MARK_AS_ADVANCED(ASCIIDOCTOR_EXECUTABLE)
MARK_AS_ADVANCED(ASCIIDOCTORPDF_EXECUTABLE)
IF (NOT ASCIIDOCTOR_EXECUTABLE)
SET(ASCIIDOCTOR_FOUND "NO")
ELSE (NOT ASCIIDOCTOR_EXECUTABLE)
SET(ASCIIDOCTOR_FOUND "YES")
ENDIF (NOT ASCIIDOCTOR_EXECUTABLE)
IF (NOT ASCIIDOCTORPDF_EXECUTABLE)
SET(ASCIIDOCTORPDF_FOUND "NO")
ELSE (NOT ASCIIDOCTORPDF_EXECUTABLE)
SET(ASCIIDOCTORPDF_FOUND "YES")
ENDIF (NOT ASCIIDOCTORPDF_EXECUTABLE)
IF (NOT ASCIIDOCTOR_FOUND AND ASCIIDOCTOR_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find asciidoctor")
ENDIF (NOT ASCIIDOCTOR_FOUND AND ASCIIDOCTOR_FIND_REQUIRED)
IF (NOT ASCIIDOCTORPDF_FOUND AND ASCIIDOCTOR_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find asciidoctor-pdf")
ENDIF (NOT ASCIIDOCTORPDF_FOUND AND ASCIIDOCTOR_FIND_REQUIRED)
cgreen-1.6.4/cmake/Modules/FindNm.cmake 0000664 0000000 0000000 00000000120 14713245764 0017640 0 ustar 00root root 0000000 0000000 find_program(NM_EXECUTABLE nm)
if (NM_EXECUTABLE)
set(NM_FOUND TRUE)
endif()
cgreen-1.6.4/cmake/Modules/FindValgrind.cmake 0000664 0000000 0000000 00000000534 14713245764 0021045 0 ustar 00root root 0000000 0000000 if (NOT Valgrind_FOUND)
find_program(Valgrind_EXECUTABLE valgrind)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Valgrind DEFAULT_MSG Valgrind_EXECUTABLE)
set(Valgrind_FOUND ${Valgrind_FOUND} CACHE BOOL "Flag whether Valgrind package was found")
mark_as_advanced(Valgrind_FOUND Valgrind_EXECUTABLE)
endif()
cgreen-1.6.4/cmake/Modules/MacroAddCompileFlags.cmake 0000664 0000000 0000000 00000001167 14713245764 0022441 0 ustar 00root root 0000000 0000000 # - MACRO_ADD_COMPILE_FLAGS(target_name flag1 ... flagN)
# Copyright (c) 2006, Oswald Buddenhagen,
# Copyright (c) 2006, Andreas Schneider,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_COMPILE_FLAGS _target)
get_target_property(_flags ${_target} COMPILE_FLAGS)
if (_flags)
set(_flags ${_flags} ${ARGN})
else (_flags)
set(_flags ${ARGN})
endif (_flags)
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS ${_flags})
endmacro (MACRO_ADD_COMPILE_FLAGS)
cgreen-1.6.4/cmake/Modules/MacroAddLinkFlags.cmake 0000664 0000000 0000000 00000001155 14713245764 0021743 0 ustar 00root root 0000000 0000000 # - MACRO_ADD_LINK_FLAGS(target_name flag1 ... flagN)
# Copyright (c) 2006, Oswald Buddenhagen,
# Copyright (c) 2006, Andreas Schneider,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_LINK_FLAGS _target)
get_target_property(_flags ${_target} LINK_FLAGS)
if (_flags)
set(_flags "${_flags} ${ARGN}")
else (_flags)
set(_flags "${ARGN}")
endif (_flags)
set_target_properties(${_target} PROPERTIES LINK_FLAGS "${_flags}")
endmacro (MACRO_ADD_LINK_FLAGS)
cgreen-1.6.4/cmake/Modules/MacroAddPlugin.cmake 0000664 0000000 0000000 00000001741 14713245764 0021330 0 ustar 00root root 0000000 0000000 # - MACRO_ADD_PLUGIN(name [WITH_PREFIX] file1 .. fileN)
#
# Create a plugin from the given source files.
# If WITH_PREFIX is given, the resulting plugin will have the
# prefix "lib", otherwise it won't.
#
# Copyright (c) 2006, Alexander Neundorf,
# Copyright (c) 2006, Laurent Montel,
# Copyright (c) 2006, Andreas Schneider,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_PLUGIN _target_NAME _with_PREFIX)
if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
set(_first_SRC)
else (${_with_PREFIX} STREQUAL "WITH_PREFIX")
set(_first_SRC ${_with_PREFIX})
endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")
add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
if (_first_SRC)
set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
endif (_first_SRC)
endmacro (MACRO_ADD_PLUGIN _name _sources)
cgreen-1.6.4/cmake/Modules/MacroAddTest.cmake 0000664 0000000 0000000 00000000715 14713245764 0021011 0 ustar 00root root 0000000 0000000 # - MACRO_ADD_TEST()
#
# Calls add_test() with all the but if on Win32 or Cygwin also adds the
# directory where the Cgreen library is generated to the path so that it will
# be used when running the test
#
# @thoni56/Thomas Nilefalk 2015-09-13
macro (macro_add_test)
add_test(${ARGN})
if (CYGWIN OR WIN32)
set_tests_properties(${ARGV1} PROPERTIES ENVIRONMENT PATH=${PROJECT_BINARY_DIR}/src:$ENV{PATH})
endif ()
endmacro(macro_add_test)
cgreen-1.6.4/cmake/Modules/MacroAddUnitTest.cmake 0000664 0000000 0000000 00000002422 14713245764 0021646 0 ustar 00root root 0000000 0000000 # - MACRO_ADD_UNIT_TEST(test_name test_source linklib1 ... linklibN)
# Copyright (c) 2007, Daniel Gollub,
# Copyright (c) 2007, Andreas Schneider,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
enable_testing()
include(CTest)
#set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags")
#set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
#set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
#set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
# custom options
configure_file(tests/CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTestCustom.cmake COPYONLY)
macro (MACRO_ADD_UNIT_TEST _testName _testSource)
add_executable(${_testName} ${_testSource})
target_link_libraries(${_testName} ${ARGN})
macro_add_test(NAME ${_testName} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${_testName})
endmacro (MACRO_ADD_UNIT_TEST)
cgreen-1.6.4/cmake/Modules/MacroAddValgrindTest.cmake 0000664 0000000 0000000 00000001736 14713245764 0022504 0 ustar 00root root 0000000 0000000 # - MACRO_ADD_VALGRIND_TEST()
#
# Calls add_test() with all the but if on Win32 or Cygwin also adds the
# directory where the Cgreen library is generated to the path so that it will
# be used when running the test
#
# @thoni56/Thomas Nilefalk 2015-09-13
macro (macro_add_valgrind_test)
if (Valgrind_FOUND)
set(
libname
${CMAKE_FIND_LIBRARY_PREFIXES}${ARGN}${CMAKE_SHARED_LIBRARY_SUFFIX}
)
add_test(
NAME valgrind_${libname}
COMMAND sh -c "LD_LIBRARY_PATH=build/src valgrind --leak-check=full tools/cgreen-runner ${CMAKE_CURRENT_BINARY_DIR}/${libname} 2>1&"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
set_tests_properties(
valgrind_${libname} PROPERTIES
FAIL_REGULAR_EXPRESSION "(definitely|indirectly|possibly) lost: [1-9]"
)
if (CYGWIN OR WIN32)
set_tests_properties(${ARGV1} PROPERTIES ENVIRONMENT PATH=${PROJECT_BINARY_DIR}/src:$ENV{PATH})
endif ()
endif ()
endmacro(macro_add_valgrind_test)
cgreen-1.6.4/cmake/Modules/MacroCopyFile.cmake 0000664 0000000 0000000 00000002157 14713245764 0021175 0 ustar 00root root 0000000 0000000 # - macro_copy_file(_src _dst)
# Copies a file to ${_dst} only if ${_src} is different (newer) than ${_dst}
#
# Example:
# macro_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/.)
# Copies file icon.png to ${CMAKE_CURRENT_BINARY_DIR} directory
#
# Copyright (c) 2006-2007 Wengo
# Copyright (c) 2006-2008 Andreas Schneider
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING file.
macro (macro_copy_file _src _dst)
# Removes all path containing .svn or CVS or CMakeLists.txt during the copy
if (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
if (CMAKE_VERBOSE_MAKEFILE)
message(STATUS "Copy file from ${_src} to ${_dst}")
endif (CMAKE_VERBOSE_MAKEFILE)
# Creates directory if necessary
get_filename_component(_path ${_dst} PATH)
file(MAKE_DIRECTORY ${_path})
execute_process(
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${_src} ${_dst}
OUTPUT_QUIET
)
endif (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
endmacro (macro_copy_file)
cgreen-1.6.4/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake 0000664 0000000 0000000 00000001235 14713245764 0024036 0 ustar 00root root 0000000 0000000 # - MACRO_ENSURE_OUT_OF_SOURCE_BUILD()
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD()
# Copyright (c) 2006, Alexander Neundorf,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}" _insource)
if (_insource)
message(SEND_ERROR "${_errorMessage}")
message(FATAL_ERROR "Remove the file CMakeCache.txt in ${PROJECT_SOURCE_DIR} first.")
endif (_insource)
endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
cgreen-1.6.4/cmake/Modules/UseDoxygen.cmake 0000664 0000000 0000000 00000012714 14713245764 0020573 0 ustar 00root root 0000000 0000000 # -helper macro to add a "doc" target with CMake build system.
# and configure doxy.config.in to doxy.config
#
# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
# Creates .chm windows help file if MS HTML help workshop
# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
# is installed with its DLLs in PATH.
#
#
# Please note, that the tools, e.g.:
# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
# must be in path.
#
# Note about Visual Studio Projects:
# MSVS has its own path environment which may differ from the shell.
# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
#
# author Jan Woetzel 2004-2006
# www.mip.informatik.uni-kiel.de/~jw
FIND_PACKAGE(Doxygen)
IF (DOXYGEN_FOUND)
# click+jump in Emacs and Visual Studio (for doxy.config) (jw)
IF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
ELSE (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
ENDIF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
# we need latex for doxygen because of the formulas
FIND_PACKAGE(LATEX)
IF (NOT LATEX_COMPILER)
MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
ENDIF (NOT LATEX_COMPILER)
IF (NOT MAKEINDEX_COMPILER)
MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
ENDIF (NOT MAKEINDEX_COMPILER)
IF (NOT DVIPS_CONVERTER)
MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
ENDIF (NOT DVIPS_CONVERTER)
FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE_PATH NAMES dot)
IF (DOXYGEN_DOT_EXECUTABLE_PATH)
SET(DOXYGEN_DOT_FOUND "YES")
ENDIF (DOXYGEN_DOT_EXECUTABLE_PATH)
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
MESSAGE(STATUS "Generate ${CMAKE_CURRENT_BINARY_DIR}/doxy.config from doxy.config.in")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in
${CMAKE_CURRENT_BINARY_DIR}/doxy.config
@ONLY )
# use (configured) doxy.config from (out of place) BUILD tree:
SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
# use static hand-edited doxy.config from SOURCE tree:
SET(DOXY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
MESSAGE(STATUS "WARNING: using existing ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config instead of configuring from doxy.config.in file.")
ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
IF (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
# using template doxy.config.in
MESSAGE(STATUS "Generate ${CMAKE_CURRENT_BINARY_DIR}/doxy.config from doxy.config.in")
CONFIGURE_FILE(${CMAKE_MODULE_PATH}/doxy.config.in
${CMAKE_CURRENT_BINARY_DIR}/doxy.config
@ONLY )
SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
ELSE (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
# failed completely...
MESSAGE(SEND_ERROR "Please create ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in (or doxy.config as fallback)")
ENDIF(EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
# create a windows help .chm file using hhc.exe
# HTMLHelp DLL must be in path!
# fallback: use hhw.exe interactively
IF (WIN32)
FIND_PACKAGE(HTMLHelp)
IF (HTML_HELP_COMPILER)
SET (TMP "${CMAKE_CURRENT_BINARY_DIR}\\doc\\html\\index.hhp")
STRING(REGEX REPLACE "[/]" "\\\\" HHP_FILE ${TMP} )
# MESSAGE(SEND_ERROR "DBG HHP_FILE=${HHP_FILE}")
ADD_CUSTOM_TARGET(winhelp ${HTML_HELP_COMPILER} ${HHP_FILE})
ADD_DEPENDENCIES (winhelp doc)
IF (NOT TARGET_DOC_SKIP_INSTALL)
# install windows help?
# determine useful name for output file
# should be project and version unique to allow installing
# multiple projects into one global directory
IF (EXISTS "${PROJECT_BINARY_DIR}/doc/html/index.chm")
IF (PROJECT_NAME)
SET(OUT "${PROJECT_NAME}")
ELSE (PROJECT_NAME)
SET(OUT "Documentation") # default
ENDIF(PROJECT_NAME)
IF (${PROJECT_NAME}_VERSION_MAJOR)
SET(OUT "${OUT}-${${PROJECT_NAME}_VERSION_MAJOR}")
IF (${PROJECT_NAME}_VERSION_MINOR)
SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_MINOR}")
IF (${PROJECT_NAME}_VERSION_PATCH)
SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_PATCH}")
ENDIF(${PROJECT_NAME}_VERSION_PATCH)
ENDIF(${PROJECT_NAME}_VERSION_MINOR)
ENDIF(${PROJECT_NAME}_VERSION_MAJOR)
# keep suffix
SET(OUT "${OUT}.chm")
#MESSAGE("DBG ${PROJECT_BINARY_DIR}/doc/html/index.chm \n${OUT}")
# create target used by install and package commands
INSTALL(FILES "${PROJECT_BINARY_DIR}/doc/html/index.chm"
DESTINATION "doc"
RENAME "${OUT}"
)
ENDIF(EXISTS "${PROJECT_BINARY_DIR}/doc/html/index.chm")
ENDIF(NOT TARGET_DOC_SKIP_INSTALL)
ENDIF(HTML_HELP_COMPILER)
# MESSAGE(SEND_ERROR "HTML_HELP_COMPILER=${HTML_HELP_COMPILER}")
ENDIF (WIN32)
ENDIF(DOXYGEN_FOUND)
cgreen-1.6.4/config.h.cmake 0000664 0000000 0000000 00000001303 14713245764 0015474 0 ustar 00root root 0000000 0000000 /* Name of package */
#cmakedefine PACKAGE "${APPLICATION_NAME}"
/* Version number of package */
#cmakedefine VERSION "${APPLICATION_VERSION}"
#cmakedefine LOCALEDIR "${LOCALE_INSTALL_DIR}"
#cmakedefine DATADIR "${DATADIR}"
#cmakedefine LIBDIR "${LIBDIR}"
#cmakedefine PLUGINDIR "${PLUGINDIR}"
#cmakedefine SYSCONFDIR "${SYSCONFDIR}"
/************************** HEADER FILES *************************/
/*************************** FUNCTIONS ***************************/
/*************************** LIBRARIES ***************************/
/**************************** OPTIONS ****************************/
/* Define if building with gcov instrumentation */
#cmakedefine CGREEN_INTERNAL_WITH_GCOV
cgreen-1.6.4/contrib/ 0000775 0000000 0000000 00000000000 14713245764 0014442 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/contrib/README.contrib 0000664 0000000 0000000 00000000614 14713245764 0016762 0 ustar 00root root 0000000 0000000 All files under this contrib directory are UNSUPPORTED. There were
provided by users of Cgreen and were not tested by the authors of Cgreen.
Use at your own risk.
SCons/ by Kevin Fitch
Add a sample demonstrating using cgreen with SCons
http://www.scons.org/
upgrade/ by Thomas Nilsson and Colm Dougan
Will upgrade a pre-beta version of tests to newer API
cgreen-1.6.4/contrib/SCons/ 0000775 0000000 0000000 00000000000 14713245764 0015467 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/contrib/SCons/SConstruct 0000664 0000000 0000000 00000002357 14713245764 0017530 0 ustar 00root root 0000000 0000000 env = Environment()
# Add the cgreen headers to the include path
env.Append(CPPPATH=['../../include', ])
# Build the cgreen library
cgreendir = '../../src/'
cgreenfiles = """unit.c messaging.c breadcrumb.c reporter.c
assertions.c vector.c mocks.c constraint.c
parameters.c text_reporter.c""".split()
cgreensources = ['../../src/'+f for f in cgreenfiles]
cgreenlib = env.StaticLibrary('cgreen', cgreensources)
#Build our code to be tested
env.Append(CPPPATH=['include'])
mainlib = env.StaticLibrary('main', env.Glob('src/*.c'))
for test in env.Glob('tests/*.c'):
testprog = env.Program(test, LIBS=[cgreenlib, mainlib])
# This is a nasty little hack here.
# We run the test twice, the first time is so we can see the output on the
# console, and get the results logged. Unfortunately it will not cause the
# build to stop on test failures since the result of the command is the
# return value of tee, not the tests. So we run it again to catch the
# possibly failed return value ... those tests better be repeatable!
env.Command(testprog[0].path+'.results', testprog,
'$SOURCE 2>&1 | tee $TARGET')
env.Command(testprog[0].path+'.results_', testprog,
'$SOURCE > $TARGET 2>&1 ')
cgreen-1.6.4/contrib/android/ 0000775 0000000 0000000 00000000000 14713245764 0016062 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/contrib/android/Android.mk 0000664 0000000 0000000 00000004304 14713245764 0017774 0 ustar 00root root 0000000 0000000 #======================================================================#
# Android.mk for CGgreen C++ unit test framework
#
# (Suggest building as .so and only including lib for debug builds
# when running e.g. android instrumented tests)
#
# Steve Madsen, 10 Aug 2016
#======================================================================#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cgreen
MY_CGREEN_BASE_PATH := ../..
MY_CGREEN_BASE_PATH_ABS := $(LOCAL_PATH)/$(MY_CGREEN_BASE_PATH)
MY_CGREEN_SRC_PATH := $(MY_CGREEN_BASE_PATH)/src
LOCAL_SRC_FILES := \
$(MY_CGREEN_SRC_PATH)/cpp_assertions.cpp \
$(MY_CGREEN_SRC_PATH)/cpp_constraint.cpp \
$(MY_CGREEN_SRC_PATH)/local_messaging.cpp
LOCAL_SRC_FILES += \
$(MY_CGREEN_SRC_PATH)/assertions.c \
$(MY_CGREEN_SRC_PATH)/boxed_double.c \
$(MY_CGREEN_SRC_PATH)/breadcrumb.c \
$(MY_CGREEN_SRC_PATH)/cdash_reporter.c \
$(MY_CGREEN_SRC_PATH)/cgreen_time.c \
$(MY_CGREEN_SRC_PATH)/constraint.c \
$(MY_CGREEN_SRC_PATH)/constraint_syntax_helpers.c \
$(MY_CGREEN_SRC_PATH)/cute_reporter.c \
$(MY_CGREEN_SRC_PATH)/memory.c \
$(MY_CGREEN_SRC_PATH)/message_formatting.c \
$(MY_CGREEN_SRC_PATH)/mocks.c \
$(MY_CGREEN_SRC_PATH)/parameters.c \
$(MY_CGREEN_SRC_PATH)/posix_cgreen_pipe.c \
$(MY_CGREEN_SRC_PATH)/posix_cgreen_time.c \
$(MY_CGREEN_SRC_PATH)/posix_runner_platform.c \
$(MY_CGREEN_SRC_PATH)/reporter.c \
$(MY_CGREEN_SRC_PATH)/runner.c \
$(MY_CGREEN_SRC_PATH)/string_comparison.c \
$(MY_CGREEN_SRC_PATH)/suite.c \
$(MY_CGREEN_SRC_PATH)/text_reporter.c \
$(MY_CGREEN_SRC_PATH)/utils.c \
$(MY_CGREEN_SRC_PATH)/vector.c \
$(MY_CGREEN_SRC_PATH)/xml_reporter.c
LOCAL_C_INCLUDES := \
$(MY_CGREEN_BASE_PATH_ABS)/include \
$(MY_CGREEN_BASE_PATH_ABS)/src
LOCAL_EXPORT_C_INCLUDES := \
$(MY_CGREEN_BASE_PATH_ABS) \
$(MY_CGREEN_BASE_PATH_ABS)/include \
$(MY_CGREEN_BASE_PATH_ABS)/src
LOCAL_CFLAGS += -O3 -DVERSION="\"OnAndroid\""
# DO_MAKE_DYNAMIC_LIB: boolean-as-int
# 0: build .a (static) lib
# 1: build .so ("dynamic"/"shared") lib
DO_MAKE_DYNAMIC_LIB := 0
ifeq ($(DO_MAKE_DYNAMIC_LIB),1)
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
else
include $(BUILD_STATIC_LIBRARY)
endif
cgreen-1.6.4/contrib/cgreen-mocker/ 0000775 0000000 0000000 00000000000 14713245764 0017163 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/contrib/cgreen-mocker/.gitignore 0000664 0000000 0000000 00000000070 14713245764 0021150 0 ustar 00root root 0000000 0000000 double.mock
complex_types.mock
pycparser
.vscode
*.mock
cgreen-1.6.4/contrib/cgreen-mocker/Makefile 0000664 0000000 0000000 00000001641 14713245764 0020625 0 ustar 00root root 0000000 0000000 all:
@echo "Testing..."
@echo -n "double... "
@./cgreen-mocker.py double.h > double.mock
@diff double.mock double.mock.expected
@if [ "$$?" -eq 0 ] ; then echo "Ok" ; fi
@echo -n "complex_types... "
@./cgreen-mocker.py complex_types.h > complex_types.mock
@diff complex_types.mock complex_types.mock.expected
@if [ "$$?" -eq 0 ] ; then echo "Ok" ; fi
@echo -n "simple_types... "
@./cgreen-mocker.py simple_types.h > simple_types.mock
@diff simple_types.mock simple_types.mock.expected
@if [ "$$?" -eq 0 ] ; then echo "Ok" ; fi
@echo -n "multiple_types... "
@./cgreen-mocker.py multiple_types.h > multiple_types.mock
@diff multiple_types.mock multiple_types.mock.expected
@if [ "$$?" -eq 0 ] ; then echo "Ok" ; fi
@echo -n "multiple_args... "
@./cgreen-mocker.py -Da=b -Dc=d multiple_types.h > multiple_args.mock
@diff multiple_args.mock multiple_types.mock.expected
@if [ "$$?" -eq 0 ] ; then echo "Ok" ; fi
cgreen-1.6.4/contrib/cgreen-mocker/cgreen-mocker.py 0000775 0000000 0000000 00000022761 14713245764 0022271 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
# -----------------------------------------------------------------
# cgreen-mocker.py
#
# Create Cgreen mocks from extern declarations of functions,
# typically in a header file.
#
# Usage:
# cgreen-mocker.py { }
#
# : any 'cpp' directive but most useful is e.g.
# "-I " to ensure cpp finds files.
#
# : file with function declarations that you want
# to mock
#
# Simplistically adapted from pycparser example: func_defs.py
#
# Since it uses pycparser it will only handle C functions and you will
# probably need the pycparsers "fake_libc_include" to avoid parsing
# the whole world of libc headers. To use it, make a soft link with
# the name 'pycparser' in the directory you are running this from, or
# in the directory of 'cgreen-mocker' itself, to the top directory of
# the pycparser source, and cgreen-mocker will pick it up
# automatically. Or you can point to it using a command line
# 'cpp_directive' arg.
#
# Thanks to @gardenia for the pointer to pycparser!
#
# https://github.com/eliben/pycparser
#
# (C) 2016, Thomas Nilefalk
#
# Using pycparser for printing out all the functions defined in a
# C file.
#
# PyCParser - Copyright (C) 2008-2015, Eli Bendersky
# License: BSD
# -----------------------------------------------------------------
from __future__ import print_function
from pycparser.plyparser import ParseError
from pycparser import c_parser, c_ast, parse_file, c_generator
from functools import reduce
from packaging import version
import sys
import os
import pycparser
# This is not required if you've installed pycparser into
# your site-packages/ with setup.py
sys.path.extend(['.', '..'])
# Print on stderr
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# A visitor for FuncDef nodes that prints the
# Cgreen mock equivalent of the function
class FuncDefVisitor(c_ast.NodeVisitor):
def __init__(self, filename):
self._types = {}
self.filename = filename
def visit_FuncDecl(self, node):
if node.coord.file == self.filename:
# Only consider definitions that are in the processed file
generator = c_generator.CGenerator()
try:
print(generator.visit(node), end="")
print(" { ")
self.should_return(node)
print("mock(%s);" % ", ".join(arg_list(node.args)))
print("}")
print()
except Exception as e:
print("ERROR: {} - Unexpected AST @ {}:{}:{}:".format(e, node.coord.file,
node.coord.line, node.coord.column))
node.show()
return
def visit_Typedef(self, node):
self._types[node.name] = {
'is_pointer': isinstance(node.type, c_ast.PtrDecl),
}
if self._types[node.name]['is_pointer']:
self._types[node.name]['to_class'] = node.type.type.type.names
else:
self._types[node.name]['to_class'] = None
def should_return(self, node):
generator = c_generator.CGenerator()
type = node.type
if is_double_decl(node):
print(" return unbox_double(", end="")
elif not is_void_decl(node):
print(" return %s(" %
("*" if self.is_return_struct_by_value(node) else ""), end="")
print(generator.visit(node.type), end="")
if version.parse(pycparser.__version__) <= version.parse('2.19') \
and isinstance(node.type, c_ast.PtrDecl) \
or self.is_return_struct_by_value(node):
print(" *", end="")
print(") ", end="")
else:
print(" ", end="")
def is_return_struct_by_value(self, node):
type = node.type
return not isinstance(type, c_ast.PtrDecl) and type.type.names[0] in self._types and not self._types[type.type.names[0]]['is_pointer']
def is_return_by_value_pointer(self, node):
type = node.type
return not isinstance(type, c_ast.PtrDecl) and self._types[type.type.names[0]]['is_pointer']
def arg_list(args):
if args != None and len(args.params) > 0:
return [el for el in map(parameter_name_or_box_double,
filter(lambda x: not is_ellipsis_param(x),
args.params))
if el is not None]
else:
return []
def parameter_name_or_box_double(node):
if is_double_decl(node):
return "box_double({})".format(node.name)
else:
return node.name
def is_void_decl(node):
type = node.type
return isinstance(type, c_ast.TypeDecl) and type.type.names == ['void']
def is_double_decl(node):
type = node.type
return isinstance(type, c_ast.TypeDecl) and type.type.names == ['double']
def is_ellipsis_param(node):
return isinstance(node, c_ast.EllipsisParam)
def show_func_defs(args):
# Note that cpp is used. Provide a path to your own cpp or
# make sure one exists in PATH.
pycparser_path = None
# Try to find a fake_libc
# In current directory?
if verbose:
eprint("Called in {0}".format(
os.path.abspath(os.path.dirname(sys.argv[0]))))
eprint("Looking for fake_lib in current directory...")
if os.path.isdir('pycparser'):
pycparser_path = r'./pycparser'
else:
this_script = os.path.abspath(__file__)
if verbose:
eprint(
"Looking for fake_lib in directory of script ({0})...".format(this_script))
# Look in the directory of this script
while os.path.islink(this_script):
# If the script is a symlink, resolve it first, recursively...
# Note: can only handle absolute symlinks?
this_script = os.readlink(this_script)
if verbose:
eprint(
"Script was a symlink, resolving it to '{0}'...".format(this_script))
if os.path.isdir(os.path.join(os.path.dirname(this_script),
'pycparser')):
# Yes, there is a pycparser symlink here
pycparser_path = os.path.join(os.path.dirname(this_script),
'pycparser')
if pycparser_path:
pycparser_lib = reduce(
os.path.join, [pycparser_path, 'utils', 'fake_libc_include'])
if verbose:
print("/* Generated with cgreen-mocker and pycparser's fake_libc from %s */" %
(pycparser_path))
elif verbose:
eprint("Not found")
try:
options = [
'-I'+pycparser_lib] if pycparser_path else []
if add_gnuisms:
# And add some common GNUisms
options = options + [
r'-D__gnuc_va_list(c)=',
r'-D__attribute__(x)=',
r'-D__extension__=',
r'-D__restrict=',
r'-D__inline='
]
if verbose:
eprint("Parsing with options = {0}".format(options))
cpp_args = list(filter(None, options))
ast = parse_file(args[-1], use_cpp=True,
cpp_args=cpp_args + args[0:-1])
except ParseError as e:
print("ERROR: {} - C99 parse error".format(e))
return
print('/* -*- c -*-*/') # Suggest c-mode for Emacs
print('#include "%s"' % args[len(args)-1])
print('#include ')
print()
v = FuncDefVisitor(args[-1])
v.visit(ast)
def usage():
print("""
Usage:
cgreen-mocker.py { }
: any 'cpp' directive but most useful are e.g.
"-I " to ensure cpp finds files and
"-D " to create an inline define
: file with function declarations that you want
to mock
Cgreen-mocker takes a header file and generates cgreen mocks for
all functions in it. It will print the generated mocks to standard
output so you can inspect it, or pipe it to a file that can be
compiled and linked with your tests.
The mocker will only handle functions that are declared in the
header file you provide. This is based on the presumtion that the
header file represents functions in a unit. Aggregating functions
from multiple units into a single header for convenience is not
supported. Also the mocker cannot handle data declarations (yet?).
If your header does not name some arguments you will not be able
to use those arguments in 'expect when' statements, of course.
Cgreen-mocker will only generate mocks for the external functions
in the file you give as an argument, not those in included files.
If cgreen-mocker encounters parse errors and they look like
gnu-isms you should get a copy of the source for pycparser (on
which cgreen-mocker is built). In it you will find a
'fake_libc_include' which help. Create a symbolic link named
'pycparser' that links to the root of pycparser source and
cgreen-mocker will find it itself.
You can find pycparser at https://github.com/eliben/pycparser
""")
if __name__ == "__main__":
if len(sys.argv) <= 1:
usage()
exit(-1)
if '-v' in sys.argv:
verbose = True
sys.argv.remove('-v')
else:
verbose = False
if '-gnu' in sys.argv:
add_gnuisms = True
sys.argv.remove('-gnu')
else:
add_gnuisms = False
show_func_defs(sys.argv[1:])
cgreen-1.6.4/contrib/cgreen-mocker/complex_types.h 0000664 0000000 0000000 00000000375 14713245764 0022234 0 ustar 00root root 0000000 0000000 typedef struct BasicStruct {
int someValue;
} BasicStruct;
typedef BasicStruct* BasicStructPtr;
BasicStruct return_struct_by_value(int i);
BasicStructPtr return_pointer_to_struct(char string[]);
BasicStruct* direct_return_pointer_to_struct(void);
cgreen-1.6.4/contrib/cgreen-mocker/complex_types.mock.expected 0000664 0000000 0000000 00000000527 14713245764 0024535 0 ustar 00root root 0000000 0000000 /* -*- c -*-*/
#include "complex_types.h"
#include
BasicStruct return_struct_by_value(int i) {
return *(BasicStruct *) mock(i);
}
BasicStructPtr return_pointer_to_struct(char string[]) {
return (BasicStructPtr) mock(string);
}
BasicStruct *direct_return_pointer_to_struct(void) {
return (BasicStruct *) mock();
}
cgreen-1.6.4/contrib/cgreen-mocker/double.h 0000664 0000000 0000000 00000000047 14713245764 0020607 0 ustar 00root root 0000000 0000000 double return_double(double d, int i);
cgreen-1.6.4/contrib/cgreen-mocker/double.mock.expected 0000664 0000000 0000000 00000000230 14713245764 0023103 0 ustar 00root root 0000000 0000000 /* -*- c -*-*/
#include "double.h"
#include
double return_double(double d, int i) {
return unbox_double(mock(box_double(d), i);
}
cgreen-1.6.4/contrib/cgreen-mocker/multiple_types.h 0000664 0000000 0000000 00000001017 14713245764 0022412 0 ustar 00root root 0000000 0000000 typedef struct Struct1 {
int someValue;
} Struct1;
typedef Struct1* Struct1Ptr;
Struct1 return_struct1_by_value(int i);
Struct1Ptr return_pointer_to_struct1(char string[]);
Struct1* direct_return_pointer_to_struct1(void);
typedef struct Struct2 {
int someValue;
} Struct2;
typedef Struct2* Struct2Ptr;
Struct2 return_struct2_by_value(int i);
Struct2Ptr return_pointer_to_struct2(char string[]);
Struct2* direct_return_pointer_to_struct2(void);
extern void return_nothing(void);
extern int return_int(int ints[]);
cgreen-1.6.4/contrib/cgreen-mocker/multiple_types.mock.expected 0000664 0000000 0000000 00000001246 14713245764 0024720 0 ustar 00root root 0000000 0000000 /* -*- c -*-*/
#include "multiple_types.h"
#include
Struct1 return_struct1_by_value(int i) {
return *(Struct1 *) mock(i);
}
Struct1Ptr return_pointer_to_struct1(char string[]) {
return (Struct1Ptr) mock(string);
}
Struct1 *direct_return_pointer_to_struct1(void) {
return (Struct1 *) mock();
}
Struct2 return_struct2_by_value(int i) {
return *(Struct2 *) mock(i);
}
Struct2Ptr return_pointer_to_struct2(char string[]) {
return (Struct2Ptr) mock(string);
}
Struct2 *direct_return_pointer_to_struct2(void) {
return (Struct2 *) mock();
}
void return_nothing(void) {
mock();
}
int return_int(int ints[]) {
return (int) mock(ints);
}
cgreen-1.6.4/contrib/cgreen-mocker/requirements.txt 0000664 0000000 0000000 00000000025 14713245764 0022444 0 ustar 00root root 0000000 0000000 pycparser
packaging
cgreen-1.6.4/contrib/cgreen-mocker/simple_types.h 0000664 0000000 0000000 00000000134 14713245764 0022047 0 ustar 00root root 0000000 0000000 int return_int(void);
char return_char(char c);
char* return_pointer_to_char(char *string);
cgreen-1.6.4/contrib/cgreen-mocker/simple_types.mock.expected 0000664 0000000 0000000 00000000377 14713245764 0024362 0 ustar 00root root 0000000 0000000 /* -*- c -*-*/
#include "simple_types.h"
#include
int return_int(void) {
return (int) mock();
}
char return_char(char c) {
return (char) mock(c);
}
char *return_pointer_to_char(char *string) {
return (char *) mock(string);
}
cgreen-1.6.4/contrib/rpm/ 0000775 0000000 0000000 00000000000 14713245764 0015240 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/contrib/rpm/cgreen.spec 0000664 0000000 0000000 00000006202 14713245764 0017357 0 ustar 00root root 0000000 0000000 # Mini-HOWTO:
#
# 1. Update gitcommit, gitncommits and gitversion in this file with
# data from "git describe --tags". (See below).
#
# 2. Fetch the latest source archive from github:
#
# curl -Lo ~/rpmbuild/SOURCES/cgreen-master.zip https://github.com/cgreen-devs/cgreen/archive/master.zip
#
# 3. Build the source and binary RPMs:
#
# mock $(rpmbuild -bs cgreen.spec | cut -d" " -f2)
#
# You could also provide your own source archive if that's what you're
# looking for. Make sure to adjust Source0: and the %prep phase
# accordingly.
# $ git describe --tags
# 1.0.0-387-g8130aa7
# | | +--v
%define gitcommit g8130aa7
# | +----------v
%define gitncommits 387
# +--------------v
%define gitversion 1.0.0
Summary: Cgreen is a modern unit test and mocking framework for C and C++.
Name: cgreen
Version: %{gitversion}
Release: %{gitncommits}.%{gitcommit}
License: ISC
URL: https://github.com/cgreen-devs/cgreen
Source0: %{name}-master.zip
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: cmake
%description
A modern, portable, cross-language unit testing and mocking framework for C and C++
%prep
%setup -q -n cgreen-master
%build
%cmake .
%install
rm -rf $RPM_BUILD_ROOT
# Don't put things into /usr/lib/cmake on 64-bit systems
%if "%{?_lib}" == "lib64"
sed -i -e "s@/lib/cmake/cgreen@/lib64/cmake/cgreen@g" cmake_install.cmake
%endif
%make_install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/cgreen-runner
%dir %{_includedir}/cgreen
%{_includedir}/cgreen/assertions.h
%{_includedir}/cgreen/boxed_double.h
%{_includedir}/cgreen/breadcrumb.h
%{_includedir}/cgreen/cdash_reporter.h
%{_includedir}/cgreen/cgreen.h
%{_includedir}/cgreen/cgreen_value.h
%{_includedir}/cgreen/constraint.h
%{_includedir}/cgreen/constraint_syntax_helpers.h
%{_includedir}/cgreen/cpp_assertions.h
%{_includedir}/cgreen/cpp_constraint.h
%{_includedir}/cgreen/cute_reporter.h
%{_includedir}/cgreen/internal/assertions_internal.h
%{_includedir}/cgreen/internal/c_assertions.h
%{_includedir}/cgreen/internal/cgreen_pipe.h
%{_includedir}/cgreen/internal/cgreen_time.h
%{_includedir}/cgreen/internal/cpp_assertions.h
%{_includedir}/cgreen/internal/function_macro.h
%{_includedir}/cgreen/internal/mock_table.h
%{_includedir}/cgreen/internal/mocks_internal.h
%{_includedir}/cgreen/internal/runner_platform.h
%{_includedir}/cgreen/internal/stringify_token.h
%{_includedir}/cgreen/internal/suite_internal.h
%{_includedir}/cgreen/internal/unit_implementation.h
%{_includedir}/cgreen/legacy.h
%{_includedir}/cgreen/mocks.h
%{_includedir}/cgreen/reporter.h
%{_includedir}/cgreen/runner.h
%{_includedir}/cgreen/string_comparison.h
%{_includedir}/cgreen/suite.h
%{_includedir}/cgreen/text_reporter.h
%{_includedir}/cgreen/unit.h
%{_includedir}/cgreen/vector.h
%dir %{_libdir}/cmake/cgreen
%{_libdir}/cmake/cgreen/cgreen-config-version.cmake
%{_libdir}/cmake/cgreen/cgreen-config.cmake
%{_libdir}/libcgreen.so
%{_libdir}/libcgreen.so.1
%{_libdir}/libcgreen.so.1.1.0
%{_mandir}/man1/cgreen-runner.1.gz
%{_mandir}/man5/cgreen.5.gz
%changelog
* Tue Feb 6 2018 Karl Mikaelsson - 1.0.0-387.g8130aa7
- Initial build of git master.
cgreen-1.6.4/contrib/upgrade/ 0000775 0000000 0000000 00000000000 14713245764 0016071 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/contrib/upgrade/upgrade.sh 0000775 0000000 0000000 00000001401 14713245764 0020053 0 ustar 00root root 0000000 0000000 # Perl-script to upgrade from pre-beta versions
# Initial version by Colm Dougan, contributed by Thomas Nilsson
perl -pi -e 's/\bEnsure\s+(\w+)\s*\(\)/Ensure($1)/' $@
perl -pi -e 's/\bEnsure\s+(\w+)\s*\(void\)/Ensure($1)/' $@
perl -pi -e 's/\bfail\(\)/fail("expected exception")/' $@
perl -pi -e 's/\bexpect_call/expect/' $@
perl -pi -e 's/\bwant\((\w+), ([^)]+)/when($1, is_equal_to($2)/' $@
perl -pi -e 's/\bwill_respond\((\w+),\ ([^,\)]+)/expect($1, will_return($2)/' $@
perl -pi -e 's/\bwill_return\((\w+),\ ([^,\)]+)/expect($1, will_return($2)/' $@
perl -pi -e 's/\bwant_non_null_?\(\"(\w+)\"\)/when($1, is_non_null)/' $@
perl -pi -e 's/\bsetup\(/set_setup(/g' $@
perl -pi -e 's/\bteardown\(/set_teardown(/g' $@
perl -pi -e 's/\bexpect_never\(/never_expect(/g' $@
cgreen-1.6.4/debian/ 0000775 0000000 0000000 00000000000 14713245764 0014224 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/debian/README.deb 0000664 0000000 0000000 00000003670 14713245764 0015643 0 ustar 00root root 0000000 0000000 # How to create a quick and dirty .deb
Sometimes you need a .deb with a recent version of Cgreen to install
for your development. And you don't want, or can't, wait for the
package maintainer to keep up...
## Build a package
You can build a simple .tar.gz using `make package`. Depending on how
`CMake` is configured you will get a couple of tar/zip file that you
can start from.
Once created they are located in the build directory. Pick one.
NB: It seems this does not build the library and `cgreen-runner`
correctly wrt. options set. Particularly it does not manage to create
a `cgreen-runner` and a library that agrees on support for `libxml2`
even if the normal build does. I solved this by simply copying the
library and the `cgreen-runner` from a normal build into the packaging
directory.
## Prepare a packaging directory
Create a separate directory somewhere, say `cgreen-deb`, and extract
the selected package there. You should now have a directory like
`cgreen-1.6.1_amd64`.
Create a new subdirectory `DEBIAN` inside it. Copy the file
`debian/control` from the repo to `DEBIAN/control`.
Update the `Architecture:` field and ensure that the version is
correct.
Depending on the packaging the lib-files might have been stored in a
subdirectory rather than directly in /lib. For Ubuntu they
should be in `/lib/x86_64-linux-gnu`.
## Make the .deb
In the examples below `1.6.1` is of course just an example...
In the directory where you now have your unpacked package content (in
the example above `cgreen-deb`) run
$ dpkg-deb --build --root-owner-group cgreen-1.6.1-x86_64-linux-gnu
That should create `cgreen-1.6.1_amd64.deb`.
## Test it
You can run
$ lintian cgreen-1.6.1-x86_64-linux-gnu.deb
and try to fix most of the errors and warnings.
NOTE we are not making a real distro packaging!
Verify that
$ sudo dpkg -i cgreen-1.6.1_amd64.deb
installs the files correctly. And that
$ sudo dpkg -r cgreen
removes them.
cgreen-1.6.4/debian/control 0000664 0000000 0000000 00000001141 14713245764 0015624 0 ustar 00root root 0000000 0000000 Source: cgreen
Section: devel
Priority: optional
Maintainer: Thomas Nilefalk
Depends: libc6
Homepage: https://github.com/cgreen-devs/cgreen
Package: cgreen1
Version: 1.6.2
Architecture: amd64
Description: Unit tests and mocking framework for C and C++
A modern unit test and mocking framework for C and C++. Cgreen features
- fast build, clean code, highly portable
- simple auto-discovery of tests
- fluent, expressive and readable API
- each test runs in isolation to prevent cross-test dependencies
- built-in mocking for C, compatible other C++ mocking libraries
cgreen-1.6.4/debian/triggers 0000664 0000000 0000000 00000000032 14713245764 0015770 0 ustar 00root root 0000000 0000000 activate-noawait ldconfig
cgreen-1.6.4/doc/ 0000775 0000000 0000000 00000000000 14713245764 0013547 5 ustar 00root root 0000000 0000000 cgreen-1.6.4/doc/.gitignore 0000664 0000000 0000000 00000000041 14713245764 0015532 0 ustar 00root root 0000000 0000000 cgreen-guide-en.html
html_chunks
cgreen-1.6.4/doc/CMakeLists.txt 0000664 0000000 0000000 00000003414 14713245764 0016311 0 ustar 00root root 0000000 0000000 FIND_PACKAGE(Asciidoctor)
SET(ASCIIDOC_CONFFILE "${PROJECT_SOURCE_DIR}/doc/cgreen_asciidoc.conf")
OPTION(CGREEN_WITH_HTML_DOCS "with HTML output" FALSE)
OPTION(CGREEN_WITH_PDF_DOCS "with PDF output" FALSE)
IF (CGREEN_WITH_HTML_DOCS AND NOT ASCIIDOCTOR_FOUND)
MESSAGE(FATAL_ERROR "Can't produce HTML without 'asciidoctor'")
ENDIF (CGREEN_WITH_HTML_DOCS AND NOT ASCIIDOCTOR_FOUND)
IF (CGREEN_WITH_PDF_DOCS AND NOT ASCIIDOCTORPDF_FOUND)
MESSAGE(FATAL_ERROR "Can't produce PDF without 'asciidoctor-pdf'")
ENDIF (CGREEN_WITH_PDF_DOCS AND NOT ASCIIDOCTORPDF_FOUND)
IF(CGREEN_WITH_HTML_DOCS OR CGREEN_WITH_PDF_DOCS)
FILE(GLOB _docfiles *.asciidoc)
FOREACH(_file ${_docfiles})
GET_FILENAME_COMPONENT(_file_we ${_file} NAME_WE)
SET(_in "${_file_we}")
IF (CGREEN_WITH_HTML_DOCS)
SET(_out "${_file_we}.html")
ADD_CUSTOM_COMMAND(
OUTPUT "${_out}-html"
COMMAND ${ASCIIDOCTOR_EXECUTABLE}
-a VERSION=${APPLICATION_VERSION}
-o ${_out} ${_file}
DEPENDS ${_file}
COMMENT "asciidoctor ${_in}"
)
ADD_CUSTOM_TARGET(${_in}-html ALL echo
DEPENDS "${_out}-html"
)
ENDIF (CGREEN_WITH_HTML_DOCS)
IF (CGREEN_WITH_PDF_DOCS)
SET(_out "${_file_we}.pdf")
ADD_CUSTOM_COMMAND(
OUTPUT "${_out}-pdf"
COMMAND ${ASCIIDOCTORPDF_EXECUTABLE}
-a toc
-a VERSION=${APPLICATION_VERSION}
-a docinfo -o ${_out} ${_file}
DEPENDS ${_file}
COMMENT "asciidoctor-pdf ${_in}"
)
ADD_CUSTOM_TARGET(${_in}-pdf ALL echo
DEPENDS "${_out}-pdf"
)
ENDIF (CGREEN_WITH_PDF_DOCS)
ENDFOREACH(_file)
ENDIF(CGREEN_WITH_HTML_DOCS OR CGREEN_WITH_PDF_DOCS)
IF(UNIX)
set(MANPAGES man)
INSTALL(DIRECTORY ${MANPAGES} DESTINATION share)
ENDIF(UNIX)
cgreen-1.6.4/doc/README 0000664 0000000 0000000 00000003550 14713245764 0014432 0 ustar 00root root 0000000 0000000 HOW-TO: Compiling the Cgreen Guide
===================================
The Cgreen Guide Book is written using Asciidoctor. Asciidoctor builds
upon the asciidoc format, is 100 times faster than the Python asciidoc
toolchain and can generate PDF in the same step. Writing in
asciidoc(tor) is a wonderful way to write textual docs. Please visit
http://www.asciidoctor.org for more information.
You also need a source-highlighter as described in
(http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#source-code)
There are a number of source examples in the documentation that are
automatically included from the `tutorial_src` subdirectory. They are
kept separate so that they can be compiled to ensure that they
actually are correct. Then all, or a part of, the file can be
included. To do that, go to the subdirectory, ensure you have the
correct version of cgreen in your path and do `make`.
The one drawback of this strategy is that you cannot read the source
of the examples in a raw asciidoc-conversion, like on github, since it
requires including other files, which is not allowed for security
reasons. So we need to generate the documentation and upload it to
`cgreen-devs.github.io`. Ensure you have *asciidoctor* installed
(`sudo apt install asciidoctor` or similar).
It is preferred to generate multi-page HTML, which currently
asciidoctor does not do natively yet. There is an extension in the
asciidoctor-extension-lab, which I have not
tried. [asciidoctor-chunker](https://github.com/wshito/asciidoctor-chunker)
works well, but requires installing Roswell (a Common Lisp
environment). If you use asciidoctor-chunker, first generate the HTML with asciidoctor
asciidoctor cgreen-guide-en.asciidoc -o html/cgreen-guide-en.html
then chunk it using asciidoctor-chunker (assuming some convenience
links in your path...)
asciidoctor-chunker html/cgreen-guide-en.html
cgreen-1.6.4/doc/README.asciidoc 0000664 0000000 0000000 00000000246 14713245764 0016206 0 ustar 00root root 0000000 0000000 // Converted to index.html by asciidoctor-ghpages GitHub Action
= Cgreen documentation
- link:cgreen-guide-en.html[The Guide]
- link:cheat-sheet.html[Cheat Sheet]
cgreen-1.6.4/doc/avtar.png 0000664 0000000 0000000 00000260154 14713245764 0015402 0 ustar 00root root 0000000 0000000 PNG
IHDR F F Jl gAMA a cHRM z&