Skip to content

Commit

Permalink
Merge 596b59f into 9aa3962
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreLouisCaron committed Dec 31, 2015
2 parents 9aa3962 + 596b59f commit 85f6cc9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
20 changes: 7 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,20 @@ addons:
- python2.7

before_script:
- pip install --user cpp-coveralls
- pip install --user sphinx
- mkdir build
- cd build
# See the following for reference instructions on how to get virtualenv
# without installing anything (which we can't do because we've disabled
# sudo):
# - http://stackoverflow.com/a/5177027
# - http://virtualenv.readthedocs.org/en/latest/installation.html
- curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz
- tar xvfz virtualenv-13.1.2.tar.gz
- python virtualenv-13.1.2/virtualenv.py env
- ./env/bin/pip install --upgrade pip
- ./env/bin/pip install -r ../doc_requirements.txt

script:
# Build without tests.
- cmake .. -DGREEN_TESTS=OFF
- make
# Build tests and run them.
- cmake .. -DGREEN_TESTS=ON
- cmake .. -DGREEN_TESTS=ON -DGREEN_GCOV=ON
- make
- make test
- CTEST_OUTPUT_ON_FAILURE=TRUE make test
# Build docs.
- ./env/bin/sphinx-build -b html ../docs/ docs/
- sphinx-build -b html ../docs/ docs/
# Send code coverage to coveralls.io.
- coveralls -r .. -b . -e build/env/ -E '.*CMakeCXXCompilerId\.cpp' -E '.*CMakeCCompilerId\.c' -E '.*feature_tests.c' -E '.*feature_tests.cxx'
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ cmake_minimum_required(VERSION 2.8)
project(green)

option(GREEN_TESTS "Compile the test suite." ON)
option(GREEN_GCOV "Compute code coverage." OFF)

if (GREEN_GCOV)
message(STATUS "Code coverage enabled.")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage")
set(CMAKE_STATIC_LINKER_FLAGS="--coverage")
set(CMAKE_MODULE_LINKER_FLAGS="--coverage")
set(CMAKE_EXE_LINKER_FLAGS="--coverage")
endif()

# Relative paths make __FILE__ more readable.
set(CMAKE_USE_RELATIVE_PATHS TRUE)

# Output everything nearby for convenience.
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})

include_directories("${PROJECT_SOURCE_DIR}/include")

add_library(green
Expand Down
1 change: 1 addition & 0 deletions doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sphinx
cpp-coveralls
2 changes: 2 additions & 0 deletions tests/test-init-term.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ int main()
{
check_eq(0, green_init());
check_eq(0, green_term());

return EXIT_SUCCESS;
}
1 change: 1 addition & 0 deletions tests/test-version.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ int main()
check_lt(GREEN_MAKE_VERSION(1, 1, 0),
GREEN_MAKE_VERSION(2, 0, 0));

return EXIT_SUCCESS;
}

0 comments on commit 85f6cc9

Please sign in to comment.