Commit 53b2acde authored by ulrich_y's avatar ulrich_y
Browse files

Merge branch 'reportcoverage'

parents 50b6f943 457fefc5
......@@ -2,6 +2,12 @@
!/**/
!*.*
makefile
# gcc coverage testing tool files
*.gcno
*.gcda
*.gcov
report/
checks/*.f90
checks/stats.txt
### Vim ###
......
......@@ -6,6 +6,7 @@ before_script:
- whoami
- export PATH=/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/8.2.0/bin/:/afs/psi.ch/sys/psi.x86_64_slp6/Programming/mathematica/11.0/Executables/:$PATH
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/8.2.0/lib64/:/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/8.2.0/lib
- export PERL5LIB=/scratch/ulrich/usr/lib64/perl5/:/scratch/ulrich/usr/share/perl5/
- gfortran -v
cache:
......@@ -23,7 +24,7 @@ configure:
stage: configure
script:
- mkdir usr/
- ./configure --with-mcc
- ./configure --with-mcc --coverage
compile:
stage: build
......@@ -50,3 +51,10 @@ test:
- pwd
- ls
- make check
- make coverage
- cat report/lcov.report
coverage: '/Total:\|(\d+\.?\d+\%)/'
artifacts:
paths:
- report/
expire_in: 1 month
......@@ -95,6 +95,7 @@ fi
allargs="$@"
NATIVE=false
DEBUG=false
COVERAGE=false
for arg in "$@" ; do
case "$arg" in
--debug)
......@@ -115,6 +116,8 @@ for arg in "$@" ; do
CONF_BITS="-m32" ;;
--64)
CONF_BITS="-m64" ;;
--coverage)
COVERAGE=true ;;
--help )
printhelp ;;
-*)
......@@ -133,6 +136,10 @@ test=test$$
trap "rm -fr $test* =." 0 1 2 3 15
if $COVERAGE ; then
$DEBUG || echo "Warning: --coverage implies --debug!" 1>&3
DEBUG=true
fi
## look for some programs
findprog() {
......@@ -214,6 +221,10 @@ case "$1,$2,$3" in
eval addflag FFLAGS -DRELEASE
$NATIVE && eval addflag FFLAGS -march=native -mtune=native
fi
if $COVERAGE ; then
echo "Coverage analytics is currently only supported for gcc"
exit 1
fi
;;
GNU,Fortran,*)
gnuflags
......@@ -229,6 +240,10 @@ case "$1,$2,$3" in
eval addflag FFLAGS -DRELEASE -O3
$NATIVE && eval addflag FFLAGS -march=native -mtune=native
fi
if $COVERAGE ; then
eval addflag FFLAGS --coverage
eval addflag LFLAGS -lgcov
fi
;;
ifort*)
eval addflag FFLAGS -autodouble
......@@ -251,6 +266,10 @@ case "$1,$2,$3" in
echo "Option --with-mcc is incompatible with ifort, disabling" 1>&3
HAVE_MCC=false
fi
if $COVERAGE ; then
echo "Coverage analytics is currently only supported for gcc"
exit 1
fi
;;
*)
echo "Unknown compiler" 1>&3
......@@ -553,6 +572,26 @@ EOF
fi
if $COVERAGE ; then
findprog gcov GCOV gcov gcov-7 gcov-6 gcov-5 gcov-34 || exit 1
if ! findlib gcov LGCOV ; then
echo "can't perform coverage tests without libgcov. Please specify using \$LFLAGS" 1>&3
exit 1
fi
if ! findprog lcov LCOV lcov ; then
echo "graphical coverage report won't be supported" 1>&3
HAVE_LCOV=false
else
if ! findprog genhtml GENHTML genhtml ; then
echo "graphical coverage report won't be supported" 1>&3
HAVE_LCOV=false
else
HAVE_LCOV=true
fi
fi
fi
echo "creating makefile" 1>&3
......@@ -566,6 +605,9 @@ CXX=$CONF_CXX
LD=$CONF_LD
MPREP=$CONF_MPREP
MATH=$CONF_MATH
GCOV=$CONF_GCOV
LCOV=$CONF_LCOV
GENHTML=$CONF_GENHTML
FFLAGS=$CONF_FFLAGS
CFLAGS=$CONF_CFLAGS
......@@ -698,13 +740,52 @@ cat >> makefile <<EOF
check: test
./$<
EOF
if $COVERAGE ; then
cat >> makefile <<EOF
report/report.txt: test
mkdir -p report
./test -verb 1000 > /dev/null
echo "Report generated on \`date\` by `whoami`." > \$@
EOF
for i in gpl_module ieps maths_functions mpl_module shuffle utils test
do
echo -e "\t\t\$(GCOV) build/$i.gcno >> \$@" >> makefile
echo -e "\t\tmv $i.f90.gcov report/" >> makefile
done
$HAVE_LCOV && cat >> makefile <<EOF
report/coverage.info: report/report.txt
\$(LCOV) --capture --directory build/ --output-file \$@
report/lcov.report: report/coverage.info
\$(LCOV) --list \$< > \$@
cat \$@
report/index.html: report/coverage.info
\$(GENHTML) \$< --output-directory report
EOF
#cat \$@ | perl -nle "print \\\$\$1 if /Total:\\|(\\d+\\.?\\d+\\%)/"
echo -n "coverage: report/report.txt" >> makefile
$HAVE_LCOV && echo -n " report/coverage.info report/lcov.report report/index.html" >> makefile
echo >> makefile
fi
cat >> makefile <<EOF
clean:
@rm -f build/*.gcda build/*.gcno build/*.gcov
@rm -rf report/
@rm -f build/*.o build/*.mod build/*.c build/mcc.internals*
@rm -f test geval libhandyg.a handyg
@rm -f test geval libhandyg.a handyG handyg.mod
@rm -f checks/test-chen.f90 checks/test-muone.f90 checks/test-muoneNP.f90
distclean:
@rm -f build/*.gcda build/*.gcno build/*.gcov
@rm -rf report/
@rm -f build/*.o build/*.mod build/*.c build/mcc.internals*
@rm -f test geval libhandyg.a handyg
@rm -f checks/test-chen.f90 checks/test-muone.f90 checks/test-muoneNP.f90
......
......@@ -352,11 +352,6 @@ CONTAINS
#ifdef DEBUG
if(verb >= 70) print*, 'is just a logarithm'
#endif
if(abs(z_flat(1)) <= zero) then
! This shouldn't happen!
res = gpl_zero_zi(1,y)
return
end if
res = plog1(y,z_flat(1)) ! log((z_flat(1) - y)/z_flat(1))
return
end if
......@@ -378,10 +373,7 @@ CONTAINS
k = size(z_flat)
kminusj = find_amount_trailing_zeros(z_flat)
j = k - kminusj
if(all(abs(z_flat) < zero)) then
res = GPL_zero_zi(k,y)
return
else if(kminusj > 0) then
if(kminusj > 0) then
#ifdef DEBUG
if(verb >= 30) print*, 'need to remove trailing zeroes'
#endif
......
......@@ -104,7 +104,7 @@ CONTAINS
end subroutine test_one_flat
subroutine do_GPL_tests()
complex(kind=prec) :: ref
complex(kind=prec) :: ref, res
real(kind=prec) :: z, xchen
print*, 'doing GPL tests...'
......@@ -191,6 +191,51 @@ CONTAINS
ref = (-0.012539108315054982, -0.015414250168437678)
call test_one_flat(cmplx([0.01, 199.99499987499374, 0.01, 1.]),ref,'4.11')
! Increase test coverage
ref = (-1.2039728043259361, pi)
call test_one_flat(cmplx([0., -0.3]),ref,'5.1')
ref = (-0.5394048306859651, 1.0303768265243125)
call test_one_flat([(0.,0.), (0.3, 0.5)],ref,'5.2')
ref = (0.00003794895846844715,0.)
print*, ' ', 'testing GPL ', '5.3', ' ...'
res = G((/100., 100., 1., 0., 1./))
call check(res,ref)
print*, ' ', 'testing GPL ', '5.4', ' ...'
res = G((/100,100,1,0,1/))
call check(res,ref)
print*, ' ', 'testing GPL ', '5.5', ' ...'
res = G_superflatn(toinum((/100,100,1,0,1/)), 5)
call check(res,ref)
print*, ' ', 'testing GPL ', '5.6', ' ...'
res = G((/100.,100.,1.,0./), 1.)
call check(res,ref)
print*, ' ', 'testing GPL ', '5.7', ' ...'
res = G(cmplx((/100.,100.,1.,0./)), cmplx(1.))
call check(res,ref)
print*, ' ', 'testing GPL ', '5.8', ' ...'
res = G( (/1,1,1,1/) , (/ 100., 100., 1., 0. /), 1.)
call check(res,ref)
!ref = cmplx(0.01592795952537145)
ref = cmplx(0.048503553116818435, - 2.8232688511893116)
print*, ' ', 'testing GPL ', '5.9', ' ...'
res = G( (/ 3, 2 /), toinum((/ 1.3, 1.1 /)), toinum(4.) )
call check(res,ref)
print*, ' ', 'testing GPL ', '5.10', ' ...'
res = G( (/ 3, 2 /), (/ 1.3, 1.1 /), 4. )
call check(res,ref)
print*, ' ', 'testing GPL ', '5.11', ' ...'
res = G( (/ 3, 2 /), cmplx((/ 1.3, 1.1 /)), cmplx(4.) )
call check(res,ref)
end subroutine do_GPL_tests
......
......@@ -133,26 +133,6 @@ CONTAINS
end do
END FUNCTION shuffle_with_zero
#ifdef DEBUG
SUBROUTINE print_matrix(m)
complex(kind=prec) :: m(:,:)
integer :: s(2), i
s = shape(m)
do i = 1,s(1)
print*, abs(m(i,:))
end do
END SUBROUTINE print_matrix
SUBROUTINE print_logical_matrix(m)
logical :: m(:,:)
integer :: s(2), i
s = shape(m)
do i = 1,s(1)
print*, m(i,:)
end do
END SUBROUTINE print_logical_matrix
#endif
! subroutine print(s1,s2,s3,s4,s5)
! character(len = *), intent(in), optional :: s1, s2, s3, s4, s5
! if(print_enabled) then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment