diff --git a/configure.ac b/configure.ac index a8bf724ce..34b227401 100644 --- a/configure.ac +++ b/configure.ac @@ -602,6 +602,14 @@ intl/Makefile po/Makefile.in ]) +if test x$enable_tests != xno; then + AC_CONFIG_FILES([ +lib/tests/Makefile +]) + +fi + + AC_OUTPUT echo " diff --git a/lib/Makefile.am b/lib/Makefile.am index f57334b2c..d0f816b6f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,8 @@ -SUBDIRS = event filehighlight mcconfig search skin tty vfs strutil widget +SUBDIRS = event filehighlight mcconfig search skin tty vfs strutil widget . + +if HAVE_TESTS + SUBDIRS += tests +endif if ENABLE_MCLIB LIB_VERSION=`echo $(LIBMC_VERSION) | \ diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am new file mode 100644 index 000000000..cd64c9996 --- /dev/null +++ b/lib/tests/Makefile.am @@ -0,0 +1,10 @@ +AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) @CHECK_CFLAGS@ +LIBS=@CHECK_LIBS@ $(top_builddir)/lib/libmc.la + +TESTS = \ + library_independ + +check_PROGRAMS = $(TESTS) + +library_independ_SOURCES = \ + library_independ.c diff --git a/lib/tests/library_independ.c b/lib/tests/library_independ.c new file mode 100644 index 000000000..6f249179f --- /dev/null +++ b/lib/tests/library_independ.c @@ -0,0 +1,59 @@ +/* libmc - check if library is independ to $(topsrc)/src directory + + Copyright (C) 2011 Free Software Foundation, Inc. + + Written by: + Slava Zanko , 2011 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program 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 Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#define TEST_SUITE_NAME "lib/library_independ" + +#include + +#include "lib/global.h" + +/* --------------------------------------------------------------------------------------------- */ + +START_TEST (test_library_independ) +{ +} +END_TEST + +/* --------------------------------------------------------------------------------------------- */ + +int +main (void) +{ + int number_failed; + + Suite *s = suite_create (TEST_SUITE_NAME); + TCase *tc_core = tcase_create ("Core"); + SRunner *sr; + + /* Add new tests here: *************** */ + tcase_add_test (tc_core, test_library_independ); + /* *********************************** */ + + suite_add_tcase (s, tc_core); + sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + return (number_failed == 0) ? 0 : 1; +} + +/* --------------------------------------------------------------------------------------------- */