1
1

Ticket #3708: fix usability problems with --enable-tests

Signed-off-by: Mooffie <mooffie@gmail.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Этот коммит содержится в:
Mooffie 2016-10-31 18:03:41 +02:00 коммит произвёл Yury V. Zaytsev
родитель f40caa3e71
Коммит 4a559344fb
4 изменённых файлов: 49 добавлений и 8 удалений

Просмотреть файл

@ -628,8 +628,7 @@ intl/Makefile
po/Makefile.in
])
if test x$enable_tests != xno; then
AC_CONFIG_FILES([
AC_CONFIG_FILES([
tests/Makefile
tests/lib/Makefile
tests/lib/mcconfig/Makefile
@ -645,7 +644,6 @@ tests/src/vfs/Makefile
tests/src/vfs/extfs/Makefile
tests/src/vfs/extfs/helpers-list/Makefile
])
fi
AC_OUTPUT
@ -657,6 +655,7 @@ Configuration:
Compiler: ${CC}
Compiler flags: ${CFLAGS}
Assertions: ${enable_assert}
Unit tests: ${tests_msg}
File system: ${vfs_type}
${vfs_flags}
Screen library: ${screen_msg}

Просмотреть файл

@ -11,15 +11,32 @@ AC_DEFUN([mc_UNIT_TESTS],[
AC_ARG_ENABLE(
[tests],
AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://check.sourceforge.net/)])
AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://libcheck.github.io/check/) @<:@auto@:>@])
)
if test x$enable_tests != xno; then
dnl 'tests_msg' holds the human-readable message to show in configure's summary text.
if test x$enable_tests == xno; then
dnl The user explicitly specified '--disable-tests'.
tests_msg="no"
else
PKG_CHECK_MODULES(
CHECK,
[check >= 0.9.8],
[have_check=yes],
[AC_MSG_WARN(['Check' utility not found. Check your environment])])
[
have_check=yes
tests_msg="yes"
],
[
AC_MSG_WARN(['Check' testing framework not found. Check your environment])
tests_msg="no ('Check' testing framework not found)"
dnl The following behavior, of "exit if feature requested but not found", is just a
dnl preference and can be safely removed.
if test x$enable_tests == xyes; then
AC_MSG_ERROR([You explicitly specified '--enable-tests', but this requirement cannot be met.])
fi
])
AC_SUBST(CHECK_CFLAGS)
AC_SUBST(CHECK_LIBS)
fi

Просмотреть файл

@ -1,3 +1,3 @@
SUBDIRS = lib src
EXTRA_DIST = mctest.h
EXTRA_DIST = mctest.h README

25
tests/README Обычный файл
Просмотреть файл

@ -0,0 +1,25 @@
Overview
--------
This tree contains unit tests.
To compile and run the tests, do 'make check' (either in the top folder,
or just in the folder containing the tests you're interested in).
IMPORTANT: To compile the tests, you need to have the "Check" unit
testing framework[1] installed.[2] If you have it installed, you will see
"Unit tests: yes" in configure's summary message; if you don't see this
message, you won't be able to compile the tests.[3]
Tips and tricks
---------------
* To be able to step with the debugger into test code, see [4]. E.g., do:
$ export CK_FORK=no
[1]: http://libcheck.github.io/check/
[2]: Your package manager likely has it.
[3]: Actually, some tests (like src/vfs/extfs/helpers-list) don't use
this framework and will compile just fine. But that's the exception.
[4]: http://stackoverflow.com/questions/1649814/debugging-unit-test-in-c-using-check