1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 06:46:38 +02:00

tests: add compilation of tests with autotools

This commit is contained in:
Sébastien Helleu
2014-07-21 21:25:43 +02:00
parent fe74ab8eff
commit 63add00da7
3 changed files with 104 additions and 2 deletions
+5 -1
View File
@@ -25,7 +25,11 @@ BUILT_SOURCES = build-config-git.h
build-config-git.h:
-$(abs_top_srcdir)/scripts/git-version.sh "$(abs_top_srcdir)" "$(VERSION)" config-git.h
SUBDIRS = po doc intl src
if TESTS
tests_dir = tests
endif
SUBDIRS = po doc intl src $(tests_dir)
EXTRA_DIST = AUTHORS.asciidoc \
ChangeLog.asciidoc \
+43 -1
View File
@@ -32,6 +32,7 @@ LICENSE="GPL3"
# Checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_GNU_SOURCE
AC_PROG_LN_S
@@ -118,6 +119,7 @@ AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL])
AH_VERBATIM([PLUGIN_GUILE], [#undef PLUGIN_GUILE])
AH_VERBATIM([PLUGIN_TRIGGER], [#undef PLUGIN_TRIGGER])
AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER])
AH_VERBATIM([TESTS], [#undef TESTS])
AH_VERBATIM([MAN], [#undef MAN])
AH_VERBATIM([DOC], [#undef DOC])
AH_VERBATIM([WEECHAT_HOME], [#define WEECHAT_HOME "~/.weechat"])
@@ -152,9 +154,10 @@ AC_ARG_WITH(lua-inc, [ --with-lua-inc=DIR, lua include files are in
AC_ARG_WITH(lua-lib, [ --with-lua-lib=DIR, lua library files are in DIR (default=autodetect)],lua_lib=$withval,lua_lib='')
AC_ARG_WITH(lua-suffix, [ --with-lua-suffix=ARG lua is suffixed with ARG (default=autodetect)],lua_suffix=$withval,lua_suffix='')
AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR directory containing tcl configuration (tclConfig.sh)],tclconfig=$withval,tclconfig='')
AC_ARG_WITH(debug, [ --with-debug debugging: 0=no debug, 1=debug compilation (default=1)],debug=$withval,debug=1)
AC_ARG_ENABLE(tests, [ --enable-tests turn on build of tests (default=not built)],enable_tests=$enableval,enable_tests=no)
AC_ARG_ENABLE(man, [ --enable-man turn on build of man page (default=not built)],enable_man=$enableval,enable_man=no)
AC_ARG_ENABLE(doc, [ --enable-doc turn on build of documentation (default=not built)],enable_doc=$enableval,enable_doc=no)
AC_ARG_WITH(debug, [ --with-debug debugging: 0=no debug, 1=debug compilation (default=1)],debug=$withval,debug=1)
AC_ARG_VAR(WEECHAT_HOME, [WeeChat home directory for config, logs, scripts.. (default is "~/.weechat")])
AC_ARG_VAR(CA_FILE, [File containing the certificate authorities (default is "/etc/ssl/certs/ca-certificates.crt"). This is the default value of option "weechat.network.gnutls_ca_file".])
@@ -902,6 +905,7 @@ fi
# ------------------------------------------------------------------------------
# large file support
# ------------------------------------------------------------------------------
if test "x$enable_largefile" = "xyes" ; then
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES"
else
@@ -983,6 +987,36 @@ CURL_LFLAGS=`$CURL_CONFIG --libs`
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LFLAGS)
# ------------------------------------------------------------------------------
# tests
# ------------------------------------------------------------------------------
if test "x$enable_tests" = "xyes" ; then
cpputest_found="no"
AC_MSG_CHECKING(for CppUTest headers and librairies)
echo
pkgconfig_cpputest_found=`$PKGCONFIG --exists cpputest 2>/dev/null`
if test "x$?" = "x0" ; then
CPPUTEST_VERSION=`$PKGCONFIG --modversion cpputest`
CPPUTEST_CFLAGS=`$PKGCONFIG --cflags cpputest`
CPPUTEST_LFLAGS=`$PKGCONFIG --libs cpputest`
else
AC_MSG_WARN([
*** CppUTest couldn't be found on your system.
*** WeeChat will be built without tests.])
enable_tests="no"
not_found="$not_found tests"
fi
else
not_asked="$not_asked tests"
fi
if test "x$enable_tests" = "xyes" ; then
AC_SUBST(CPPUTEST_CFLAGS)
AC_SUBST(CPPUTEST_LFLAGS)
AC_DEFINE(TESTS)
fi
# ------------------------------------------------------------------------------
# man page / documentation
# ------------------------------------------------------------------------------
@@ -1145,6 +1179,7 @@ AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
AM_CONDITIONAL(PLUGIN_GUILE, test "$enable_guile" = "yes")
AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes")
AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
AM_CONDITIONAL(TESTS, test "$enable_tests" = "yes")
AM_CONDITIONAL(MAN, test "$enable_man" = "yes")
AM_CONDITIONAL(DOC, test "$enable_doc" = "yes")
@@ -1180,6 +1215,7 @@ AC_OUTPUT([Makefile
src/plugins/xfer/Makefile
src/gui/Makefile
src/gui/curses/Makefile
tests/Makefile
intl/Makefile
po/Makefile.in])
@@ -1270,6 +1306,11 @@ if test "x$debug" != "x0"; then
msg_debug="yes"
fi
msg_tests="no"
if test "x$enable_tests" = "xyes"; then
msg_tests="yes"
fi
if test "x$msg_man" = "x"; then
msg_man="no"
else
@@ -1287,6 +1328,7 @@ echo " Interfaces............. :$listgui"
echo " Plugins................ :$listplugins"
echo " Optional features...... :$listoptional"
echo " Compile with debug..... : $msg_debug"
echo " Compile tests.......... : $msg_tests"
echo " Man page............... : $msg_man"
echo " Documentation.......... : $msg_doc"
echo " Certificate authorities : ${CA_FILE}"
+56
View File
@@ -0,0 +1,56 @@
#
# Copyright (C) 2014 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(CPPUTEST_CFLAGS)
noinst_LIBRARIES = lib_ncurses_fake.a lib_weechat_unit_tests.a
lib_ncurses_fake_a_SOURCES = ncurses-fake.c
lib_weechat_unit_tests_a_SOURCES = unit/core/test-eval.cpp \
unit/core/test-hashtable.cpp \
unit/core/test-hdata.cpp \
unit/core/test-infolist.cpp \
unit/core/test-list.cpp \
unit/core/test-string.cpp \
unit/core/test-url.cpp \
unit/core/test-utf8.cpp \
unit/core/test-util.cpp
bin_PROGRAMS = tests
# Because of a linker bug, we have to link 2 times with lib_weechat_core.a
# (and it must be 2 different path/names to be kept by linker)
tests_LDADD = ./../src/core/lib_weechat_core.a \
../src/plugins/lib_weechat_plugins.a \
../src/gui/lib_weechat_gui_common.a \
../src/gui/curses/lib_weechat_gui_curses.a \
../src/core/lib_weechat_core.a \
lib_ncurses_fake.a \
lib_weechat_unit_tests.a \
$(PLUGINS_LFLAGS) \
$(GCRYPT_LFLAGS) \
$(GNUTLS_LFLAGS) \
$(CURL_LFLAGS) \
$(CPPUTEST_LFLAGS) \
-lm
tests_SOURCES = tests.cpp
EXTRA_DIST = CMakeLists.txt