Skip to content

Commit aff2d85

Browse files
committed
Merge pull request #72 from zbeekman/coveralls-issue-63
Added coveralls support for json_module.f90
2 parents 07b1a4d + 3ac7f33 commit aff2d85

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

.travis.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,34 @@ cache: apt
88
# Build matrix: Run the three build systems and tests in parallel
99
env:
1010
global:
11-
- DEPENDS="gfortran-4.9 binutils"
11+
- DEPENDS="gfortran-4.9"
1212
- CHECK_README_PROGS="yes"
1313
matrix:
14-
# CMake build with unit tests, no documentation
14+
# CMake build with unit tests, no documentation, no coverage analysis
1515
# Allow to fail for now until tests are fixed
16-
- BUILD_SCRIPT="mkdir cmake-build && cd cmake-build && cmake -DENABLE_CODE_COVERAGE:BOOL=TRUE -DSKIP_DOC_GEN:BOOL=TRUE .. && make -j 4 && make test"
16+
- BUILD_SCRIPT="mkdir cmake-build && cd cmake-build && cmake -DSKIP_DOC_GEN:BOOL=TRUE .. && make -j 4 && make test"
1717
SPECIFIC_DEPENDS="cmake nodejs"
1818
JLINT="yes"
1919
DOCS="no"
2020
FoBiS="no"
2121

22-
# build with build.sh, make documentation, and do sniff test
22+
# build with build.sh, make documentation, run unit tests and perform coverage analysis
2323
- BUILD_SCRIPT="./build.sh"
24-
SPECIFIC_DEPENDS=""
24+
SPECIFIC_DEPENDS="binutils"
2525
JLINT="no"
2626
DOCS="yes"
2727
FoBiS="yes"
2828
CODE_COVERAGE="yes"
2929

30-
# test scons build, no documentation or jsonlint, sniff test
30+
# test scons build, no documentation or jsonlint, run unit tests
3131
- BUILD_SCRIPT="scons && scons test"
3232
SPECIFIC_DEPENDS=""
3333
JLINT="no"
3434
DOCS="no"
3535
FoBiS="no"
3636

3737
before_install:
38+
- ulimit -s unlimited
3839
- if [[ $CHECK_README_PROGS == [yY]* ]]; then wget http://people.sc.fsu.edu/~jburkardt/f_src/f90split/f90split.f90; fi
3940
- if [[ $DOCS == [yY]* ]]; then export DEPENDS="$DEPENDS exuberant-ctags"; fi
4041
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
@@ -46,7 +47,9 @@ install:
4647
- sudo apt-get install -y $SPECIFIC_DEPENDS $DEPENDS
4748
- if [[ $JLINT == [yY]* ]]; then sudo npm install -g jsonlint; fi
4849
- sudo ln -fs /usr/bin/gfortran-4.9 /usr/bin/gfortran && gfortran --version
49-
- if [[ $FoBiS == [yY]* ]]; then sudo -H pip install FoBiS.py==1.5.5 && FoBiS.py --version; fi
50+
- sudo ln -fs /usr/bin/gcov-4.9 /usr/bin/gcov && gcov --version
51+
- if [[ $FoBiS == [yY]* ]]; then sudo -H pip install FoBiS.py && FoBiS.py --version; fi
52+
- if [[ $CODE_COVERAGE == [yY]* ]]; then sudo -H pip install cpp-coveralls; fi
5053
- if [[ $DOCS == [yY]* ]]; then sudo dpkg -i robodoc_4.99.41-1_amd64.deb && robodoc --version; fi
5154
- if [[ $CHECK_README_PROGS == [yY]* ]]; then gfortran -o f90split f90split.f90 && ./f90split README.md && shopt -s extglob && for f in !(README|CONTRIBUTING).md; do mv $f src/tests/jf_test_${f%.md}.f90; done; rm f90split.f90 f90split; fi
5255

@@ -56,6 +59,7 @@ script:
5659

5760
after_success:
5861
- cd $TRAVIS_BUILD_DIR
62+
- if [[ $CODE_COVERAGE == [yY]* ]]; then gcov -o lib/ src/json_module.f90 && coveralls -n -b . ; fi
5963
- git config --global user.name "TRAVIS-CI-for-$(git --no-pager show -s --format='%cn' $TRAVIS_COMMIT)"
6064
- git config --global user.email "$(git --no-pager show -s --format='%ce' $TRAVIS_COMMIT)"
6165
- ./deploy.sh #handles updating documentation for master branch as well as tags

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A Fortran 2008 JSON API
66
Status
77
------
88
[![Build Status](https://img.shields.io/travis/jacobwilliams/json-fortran/master.svg?style=plastic)](https://travis-ci.org/jacobwilliams/json-fortran)
9+
[![Coveralls branch](https://img.shields.io/coveralls/jacobwilliams/json-fortran/master.svg?style=plastic)](https://coveralls.io/r/jacobwilliams/json-fortran) <br/>
910
[![GitHub issues](https://img.shields.io/github/issues/jacobwilliams/json-fortran.png?style=plastic)](https://github.com/jacobwilliams/json-fortran/issues)
1011
[![Blocked by Vendor Bug](https://badge.waffle.io/jacobwilliams/json-fortran.png?label=vendor%20bug&title=Blocked%20by%20Vendor%20Bug)](https://waffle.io/jacobwilliams/json-fortran)
1112
[![Ready in backlog](https://badge.waffle.io/jacobwilliams/json-fortran.png?label=Ready&title=Ready)](https://github.com/jacobwilliams/json-fortran/#contributing-)
@@ -102,8 +103,11 @@ for more examples. The source files may be found in `src/tests/`.
102103
! extract data from the file
103104
! [found can be used to check if the data was really there]
104105
call json%get('version.major', i, found)
106+
if ( .not. found ) stop 1
105107
call json%get('version.minor', j, found)
108+
if ( .not. found ) stop 1
106109
call json%get('data(1).number', k, found)
110+
if ( .not. found ) stop 1
107111
108112
! clean up
109113
call json%destroy()
@@ -155,7 +159,6 @@ of `json_value` pointers. For more examples see unit tests 2, 4 and 7 in `src/t
155159
use json_module
156160
157161
type(json_value),pointer :: p, inp
158-
logical :: found
159162
160163
! initialize the module
161164
call json_initialize()

build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ fi
5656

5757
#build the stand-alone library:
5858
echo ""
59-
echo "${LFLAGS}"
6059
echo "Building library..."
6160
FoBiS.py build -compiler ${FCOMPILER} -cflags "${FCOMPILERFLAGS}" ${COVERAGE} -dbld ${LIBDIR} -s ${SRCDIR} -dmod ./ -dobj ./ -t ${MODCODE} -o ${LIBOUT} -mklib static -colors
6261

@@ -87,7 +86,6 @@ echo ""
8786
if [[ $JF_SKIP_TESTS != [yY]* ]] ; then
8887
echo "Running tests..."
8988
cd "$BINDIR"
90-
rm jf_test*.o jf_test*.mod || true
9189
OLD_IGNORES="$GLOBIGNORE"
9290
GLOBIGNORE='*.*'
9391
#

cmake/pickFortranCompilerFlags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if ( NOT Fortran_FLAGS_INIT )
2626
set ( ENABLE_CODE_COVERAGE FALSE CACHE BOOL
2727
"Compile with code coverage output enabled using gcov. May not work on Mac.")
2828
if ( ENABLE_CODE_COVERAGE )
29-
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} --coverage" )
29+
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fprofile-arcs -ftest-coverage" )
3030
endif ()
3131
if ( ENABLE_BACK_TRACE )
3232
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbacktrace" )

0 commit comments

Comments
 (0)