diff --git a/.travis.yml b/.travis.yml index 6a5d1fb2..3c17c888 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,3 +38,23 @@ script: 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 + diff --git a/Makefile.in b/Makefile.in index dd332ea6..b3290a09 100644 --- a/Makefile.in +++ b/Makefile.in @@ -230,6 +230,7 @@ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ diff --git a/build.sh b/build.sh index 5dd1c71a..6d493a03 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,9 @@ #CXX="clang++" PREFIX="/usr" +RED="\\033[0;31m" +GREEN="\\033[0;32m" +NORMAL="\\033[m" # Get number of logical processor cores if command -v getconf >/dev/null 2>&1 @@ -22,27 +25,51 @@ test "$CPU_COUNT" -eq 0 && CPU_COUNT=1 # Build commands case "$1" in "--release"|"release") - ./configure --prefix="$PREFIX" + if ! ./configure --prefix="$PREFIX" + then + echo "${RED}Configure failed!${NORMAL}" 1>&2 + exit -1 + fi ;; "--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") - ./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") - ./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") - ./configure --prefix="$PREFIX" --with-profiler + if ! ./configure --prefix="$PREFIX" --with-profiler + then + echo "${RED}Configure failed!${NORMAL}" 1>&2 + exit -1 + fi ;; - "--gcov"|"gcov") - ./configure --prefix="$PREFIX" CXXFLAGS="-fprofile-arcs -ftest-coverage" + "--coverage"|"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"|*) @@ -55,13 +82,21 @@ case "$1" in echo " fulldebug Compile with all warning options" echo " profile Compile with profile option (analysis with gprof)" 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" - exit 1 + exit ;; esac JOBS="$((CPU_COUNT/2))" 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 diff --git a/configure b/configure index a1267d93..94a7162b 100755 --- a/configure +++ b/configure @@ -633,6 +633,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +AM_CXXFLAGS LIBTOOL_DEPS SO_VERSION CXXCPP @@ -769,6 +770,7 @@ with_sysroot enable_libtool_lock with_gpm with_profiler +with_gcov ' ac_precious_vars='build_alias host_alias @@ -1434,6 +1436,7 @@ Optional Packages: (or the compiler's sysroot if not specified). --without-gpm Disable GPM mouse support --with-profiler build extra google profiler binaries + --with-gcov build for code coverage testing Some influential environment variables: CC C compiler command @@ -17084,6 +17087,55 @@ 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 # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/configure.ac b/configure.ac index 9b36d4fb..e2b6c6bb 100644 --- a/configure.ac +++ b/configure.ac @@ -81,4 +81,18 @@ then [LIBS="$LIBS -lprofiler"]) 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 diff --git a/doc/Makefile.in b/doc/Makefile.in index c7657eba..6219f685 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -147,6 +147,7 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -319,9 +320,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu doc/Makefile + $(AUTOMAKE) --foreign doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/examples/Makefile.am b/examples/Makefile.am index 24f852ac..962428e4 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -51,3 +51,6 @@ scrollview_SOURCES = scrollview.cpp windows_SOURCES = windows.cpp menu_SOURCES = menu.cpp ui_SOURCES = ui.cpp + +clean-local: + -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete diff --git a/examples/Makefile.clang b/examples/Makefile.clang index e64b4a51..7b13e387 100644 --- a/examples/Makefile.clang +++ b/examples/Makefile.clang @@ -36,5 +36,5 @@ profile: .PHONY: clean clean: - $(RM) $(SRCS:%.cpp=%) *.gch *.plist *~ + $(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *.gch *.plist *~ diff --git a/examples/Makefile.gcc b/examples/Makefile.gcc index a6d4e45b..fe1afa1b 100644 --- a/examples/Makefile.gcc +++ b/examples/Makefile.gcc @@ -36,5 +36,5 @@ profile: .PHONY: clean clean: - $(RM) $(SRCS:%.cpp=%) *~ + $(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *~ diff --git a/examples/Makefile.in b/examples/Makefile.in index 690572b5..16b396a9 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -253,6 +253,7 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -410,9 +411,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu examples/Makefile + $(AUTOMAKE) --foreign examples/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -703,7 +704,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am @@ -775,8 +776,8 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ + clean-libtool clean-local clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -789,6 +790,9 @@ 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. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/fonts/Makefile.in b/fonts/Makefile.in index 796238f3..4200e618 100644 --- a/fonts/Makefile.in +++ b/fonts/Makefile.in @@ -117,6 +117,7 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -263,9 +264,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fonts/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign fonts/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu fonts/Makefile + $(AUTOMAKE) --foreign fonts/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/Makefile.am b/src/Makefile.am index d58abcf1..fdb08749 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -100,6 +100,9 @@ finalcutinclude_HEADERS = \ ../include/final/fwidget.h \ ../include/final/fwindow.h +clean-local: + -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete + #uninstall: # rm -R -f $(includedir)/final diff --git a/src/Makefile.clang b/src/Makefile.clang index 8629038b..cebfa9b5 100644 --- a/src/Makefile.clang +++ b/src/Makefile.clang @@ -150,7 +150,7 @@ uninstall: $(OBJS) .PHONY: clean dep clean: - $(RM) $(LIB)* $(OBJS) .depend *.gch *.plist *~ + $(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.gch *.plist *~ dep: $(CXX) $(INCLUDES) -DCOMPILE_FINAL_CUT -MM *.cpp >.depend diff --git a/src/Makefile.gcc b/src/Makefile.gcc index 5cfff17d..401cb33f 100644 --- a/src/Makefile.gcc +++ b/src/Makefile.gcc @@ -150,7 +150,7 @@ uninstall: $(OBJS) .PHONY: clean dep clean: - $(RM) $(LIB)* $(OBJS) .depend *.prof *~ + $(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.prof *~ dep: $(CXX) $(INCLUDES) -MM -DCOMPILE_FINAL_CUT *.cpp >.depend diff --git a/src/Makefile.in b/src/Makefile.in index f38120b1..a2ff4116 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -210,6 +210,7 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -437,9 +438,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile + $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -712,7 +713,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ mostlyclean-am distclean: distclean-am @@ -785,8 +786,8 @@ uninstall-am: uninstall-finalcutincludeHEADERS \ .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ + clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -801,6 +802,9 @@ uninstall-am: uninstall-finalcutincludeHEADERS \ uninstall-finalcutincludeHEADERS uninstall-libLTLIBRARIES +clean-local: + -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete + #uninstall: # rm -R -f $(includedir)/final