Improved code coverage tests

This commit is contained in:
Markus Gans 2017-11-11 14:52:33 +01:00
parent c9b346f419
commit a5de52b7a5
15 changed files with 166 additions and 28 deletions

View File

@ -38,3 +38,23 @@ script:
sudo: required sudo: required
#
# Coveralls
#
- os: linux
env:
- TEST="Coveralls"
before_install:
- pip install --user cpp-coveralls
script:
- ./build.sh coverage
- make V=1 -j10
after_success:
- coveralls --gcov-options '\-lp' \
-exclude debian \
-exclude doc \
-exclude icon \
-exclude logo \
-exclude m4 \
-exclude scripts

View File

@ -230,6 +230,7 @@ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
distcleancheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_CXXFLAGS = @AM_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@ AR = @AR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@

View File

@ -2,6 +2,9 @@
#CXX="clang++" #CXX="clang++"
PREFIX="/usr" PREFIX="/usr"
RED="\\033[0;31m"
GREEN="\\033[0;32m"
NORMAL="\\033[m"
# Get number of logical processor cores # Get number of logical processor cores
if command -v getconf >/dev/null 2>&1 if command -v getconf >/dev/null 2>&1
@ -22,27 +25,51 @@ test "$CPU_COUNT" -eq 0 && CPU_COUNT=1
# Build commands # Build commands
case "$1" in case "$1" in
"--release"|"release") "--release"|"release")
./configure --prefix="$PREFIX" if ! ./configure --prefix="$PREFIX"
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1
fi
;; ;;
"--debug"|"debug") "--debug"|"debug")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic" if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1
fi
;; ;;
"--fulldebug"|"fulldebug") "--fulldebug"|"fulldebug")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy" if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy"
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1
fi
;; ;;
"--profile"|"profile") "--profile"|"profile")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -pg -O0 -DDEBUG -W -Wall -pedantic" if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -pg -O0 -DDEBUG -W -Wall -pedantic"
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1
fi
;; ;;
"--cpu-profiler"|"cpu-profiler") "--cpu-profiler"|"cpu-profiler")
./configure --prefix="$PREFIX" --with-profiler if ! ./configure --prefix="$PREFIX" --with-profiler
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1
fi
;; ;;
"--gcov"|"gcov") "--coverage"|"coverage")
./configure --prefix="$PREFIX" CXXFLAGS="-fprofile-arcs -ftest-coverage" if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-gcov
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1
fi
;; ;;
"--help"|"help"|*) "--help"|"help"|*)
@ -55,13 +82,21 @@ case "$1" in
echo " fulldebug Compile with all warning options" echo " fulldebug Compile with all warning options"
echo " profile Compile with profile option (analysis with gprof)" echo " profile Compile with profile option (analysis with gprof)"
echo " cpu-profiler Link with Google cpu performance profiler" echo " cpu-profiler Link with Google cpu performance profiler"
echo " gcov Compile with options for coverage analysis with gcov" echo " coverage Compile with options for coverage analysis with gcov"
echo " help Show this help" echo " help Show this help"
exit 1 exit
;; ;;
esac esac
JOBS="$((CPU_COUNT/2))" JOBS="$((CPU_COUNT/2))"
test "$JOBS" -eq 0 && JOBS=1 test "$JOBS" -eq 0 && JOBS=1
make V=1 -j$JOBS
if make V=1 -j$JOBS
then
echo "${GREEN}Successful compiled${NORMAL}"
else
echo "${RED}Error on compile!${NORMAL}" 1>&2
exit 1
fi
# make install # make install

52
configure vendored
View File

@ -633,6 +633,7 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE am__EXEEXT_TRUE
LTLIBOBJS LTLIBOBJS
LIBOBJS LIBOBJS
AM_CXXFLAGS
LIBTOOL_DEPS LIBTOOL_DEPS
SO_VERSION SO_VERSION
CXXCPP CXXCPP
@ -769,6 +770,7 @@ with_sysroot
enable_libtool_lock enable_libtool_lock
with_gpm with_gpm
with_profiler with_profiler
with_gcov
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -1434,6 +1436,7 @@ Optional Packages:
(or the compiler's sysroot if not specified). (or the compiler's sysroot if not specified).
--without-gpm Disable GPM mouse support --without-gpm Disable GPM mouse support
--with-profiler build extra google profiler binaries --with-profiler build extra google profiler binaries
--with-gcov build for code coverage testing
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@ -17084,6 +17087,55 @@ fi
fi fi
# code coverage
# Check whether --with-gcov was given.
if test "${with_gcov+set}" = set; then :
withval=$with_gcov; with_gcov=yes
else
with_gcov=no
fi
if test "x$with_gcov" = "xyes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgcov" >&5
$as_echo_n "checking for main in -lgcov... " >&6; }
if ${ac_cv_lib_gcov_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lgcov $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_gcov_main=yes
else
ac_cv_lib_gcov_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcov_main" >&5
$as_echo "$ac_cv_lib_gcov_main" >&6; }
if test "x$ac_cv_lib_gcov_main" = xyes; then :
LIBS="$LIBS -lgcov"
fi
AM_CXXFLAGS="-fprofile-arcs -ftest-coverage $AM_CXXFLAGS"
fi
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure # tests run on this system so they can be shared between configure

View File

@ -81,4 +81,18 @@ then
[LIBS="$LIBS -lprofiler"]) [LIBS="$LIBS -lprofiler"])
fi fi
# code coverage
AC_ARG_WITH([gcov],
[AS_HELP_STRING([--with-gcov], [build for code coverage testing])],
[with_gcov=yes],
[with_gcov=no])
if test "x$with_gcov" = "xyes"
then
AC_CHECK_LIB([gcov],
[main],
[LIBS="$LIBS -lgcov"])
AM_CXXFLAGS="-fprofile-arcs -ftest-coverage $AM_CXXFLAGS"
AC_SUBST([AM_CXXFLAGS])
fi
AC_OUTPUT AC_OUTPUT

View File

@ -147,6 +147,7 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_CXXFLAGS = @AM_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@ AR = @AR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
@ -319,9 +320,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile $(AUTOMAKE) --foreign doc/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \

View File

@ -51,3 +51,6 @@ scrollview_SOURCES = scrollview.cpp
windows_SOURCES = windows.cpp windows_SOURCES = windows.cpp
menu_SOURCES = menu.cpp menu_SOURCES = menu.cpp
ui_SOURCES = ui.cpp ui_SOURCES = ui.cpp
clean-local:
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete

View File

@ -36,5 +36,5 @@ profile:
.PHONY: clean .PHONY: clean
clean: clean:
$(RM) $(SRCS:%.cpp=%) *.gch *.plist *~ $(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *.gch *.plist *~

View File

@ -36,5 +36,5 @@ profile:
.PHONY: clean .PHONY: clean
clean: clean:
$(RM) $(SRCS:%.cpp=%) *~ $(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *~

View File

@ -253,6 +253,7 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_CXXFLAGS = @AM_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@ AR = @AR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
@ -410,9 +411,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/Makefile $(AUTOMAKE) --foreign examples/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
@ -703,7 +704,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \
mostlyclean-am mostlyclean-am
distclean: distclean-am distclean: distclean-am
@ -775,8 +776,8 @@ uninstall-am:
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ clean-libtool clean-local clean-noinstPROGRAMS cscopelist-am \
ctags-am distclean distclean-compile distclean-generic \ ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \ install-data-am install-dvi install-dvi-am install-exec \
@ -789,6 +790,9 @@ uninstall-am:
tags tags-am uninstall uninstall-am tags tags-am uninstall uninstall-am
clean-local:
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View File

@ -117,6 +117,7 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_CXXFLAGS = @AM_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@ AR = @AR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
@ -263,9 +264,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fonts/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign fonts/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu fonts/Makefile $(AUTOMAKE) --foreign fonts/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \

View File

@ -100,6 +100,9 @@ finalcutinclude_HEADERS = \
../include/final/fwidget.h \ ../include/final/fwidget.h \
../include/final/fwindow.h ../include/final/fwindow.h
clean-local:
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
#uninstall: #uninstall:
# rm -R -f $(includedir)/final # rm -R -f $(includedir)/final

View File

@ -150,7 +150,7 @@ uninstall: $(OBJS)
.PHONY: clean dep .PHONY: clean dep
clean: clean:
$(RM) $(LIB)* $(OBJS) .depend *.gch *.plist *~ $(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.gch *.plist *~
dep: dep:
$(CXX) $(INCLUDES) -DCOMPILE_FINAL_CUT -MM *.cpp >.depend $(CXX) $(INCLUDES) -DCOMPILE_FINAL_CUT -MM *.cpp >.depend

View File

@ -150,7 +150,7 @@ uninstall: $(OBJS)
.PHONY: clean dep .PHONY: clean dep
clean: clean:
$(RM) $(LIB)* $(OBJS) .depend *.prof *~ $(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.prof *~
dep: dep:
$(CXX) $(INCLUDES) -MM -DCOMPILE_FINAL_CUT *.cpp >.depend $(CXX) $(INCLUDES) -MM -DCOMPILE_FINAL_CUT *.cpp >.depend

View File

@ -210,6 +210,7 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_CXXFLAGS = @AM_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@ AR = @AR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
@ -437,9 +438,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile $(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
@ -712,7 +713,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
mostlyclean-am mostlyclean-am
distclean: distclean-am distclean: distclean-am
@ -785,8 +786,8 @@ uninstall-am: uninstall-finalcutincludeHEADERS \
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \
ctags-am distclean distclean-compile distclean-generic \ ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \ install-data-am install-dvi install-dvi-am install-exec \
@ -801,6 +802,9 @@ uninstall-am: uninstall-finalcutincludeHEADERS \
uninstall-finalcutincludeHEADERS uninstall-libLTLIBRARIES uninstall-finalcutincludeHEADERS uninstall-libLTLIBRARIES
clean-local:
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
#uninstall: #uninstall:
# rm -R -f $(includedir)/final # rm -R -f $(includedir)/final