From 00cb422334f1c10e81bc5eea0a01f43f84f726d0 Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Mon, 31 Oct 2016 18:03:41 +0200
Subject: [PATCH] Fix usability problems with --enable-tests.
---
configure.ac | 5 ++---
m4.include/mc-tests.m4 | 11 +++++++++--
tests/Makefile.am | 2 +-
tests/README | 22 ++++++++++++++++++++++
4 files changed, 34 insertions(+), 6 deletions(-)
create mode 100644 tests/README
diff --git a/configure.ac b/configure.ac
index 3554598..b98c9df 100644
a
|
b
|
intl/Makefile |
624 | 624 | po/Makefile.in |
625 | 625 | ]) |
626 | 626 | |
627 | | if test x$enable_tests != xno; then |
628 | | AC_CONFIG_FILES([ |
| 627 | AC_CONFIG_FILES([ |
629 | 628 | tests/Makefile |
630 | 629 | tests/lib/Makefile |
631 | 630 | tests/lib/mcconfig/Makefile |
… |
… |
tests/src/filemanager/Makefile |
638 | 637 | tests/src/editor/Makefile |
639 | 638 | tests/src/editor/test-data.txt |
640 | 639 | ]) |
641 | | fi |
642 | 640 | |
643 | 641 | AC_OUTPUT |
644 | 642 | |
… |
… |
Configuration: |
649 | 647 | Source code location: ${srcdir} |
650 | 648 | Compiler: ${CC} |
651 | 649 | Compiler flags: ${CFLAGS} |
| 650 | Unit tests: ${tests_msg} |
652 | 651 | File system: ${vfs_type} |
653 | 652 | ${vfs_flags} |
654 | 653 | Screen library: ${screen_msg} |
diff --git a/m4.include/mc-tests.m4 b/m4.include/mc-tests.m4
index c991fbb..8b3ae90 100644
a
|
b
|
AC_DEFUN([mc_UNIT_TESTS],[ |
11 | 11 | |
12 | 12 | AC_ARG_ENABLE( |
13 | 13 | [tests], |
14 | | AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://check.sourceforge.net/)]) |
| 14 | AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://check.sourceforge.net/)]), |
| 15 | , |
| 16 | [enable_tests=no] dnl Coerce empty value to "no", for easier coding. |
15 | 17 | ) |
16 | 18 | |
| 19 | tests_msg=$enable_tests |
| 20 | |
17 | 21 | if test x$enable_tests != xno; then |
18 | 22 | PKG_CHECK_MODULES( |
19 | 23 | CHECK, |
20 | 24 | [check >= 0.9.8], |
21 | 25 | [have_check=yes], |
22 | | [AC_MSG_WARN(['Check' utility not found. Check your environment])]) |
| 26 | [ |
| 27 | AC_MSG_WARN(['Check' utility not found. Check your environment]) |
| 28 | tests_msg="no ('Check' utility not found)" |
| 29 | ]) |
23 | 30 | AC_SUBST(CHECK_CFLAGS) |
24 | 31 | AC_SUBST(CHECK_LIBS) |
25 | 32 | fi |
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fc16371..de3ff6c 100644
a
|
b
|
|
1 | 1 | SUBDIRS = lib src |
2 | 2 | |
3 | | EXTRA_DIST = mctest.h |
| 3 | EXTRA_DIST = mctest.h README |
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..d139fb0
-
|
+
|
|
| 1 | Overview |
| 2 | -------- |
| 3 | |
| 4 | This tree contains unit tests. |
| 5 | |
| 6 | To enable these tests, run 'configure' with '--enable-tests'. You need to |
| 7 | have the "Check" unit testing framework[1] installed.[2] You should then |
| 8 | see "Unit tests: yes" in configure's summary message. |
| 9 | |
| 10 | To compile the tests, run 'make check'. |
| 11 | |
| 12 | |
| 13 | Tips and tricks |
| 14 | --------------- |
| 15 | |
| 16 | * To be able to step with the debugger into test code, see [3]. E.g., do: |
| 17 | |
| 18 | $ export CK_FORK=no |
| 19 | |
| 20 | [1]: http://check.sourceforge.net/ |
| 21 | [2]: Your package manager likely has it. |
| 22 | [3]: http://stackoverflow.com/questions/1649814/debugging-unit-test-in-c-using-check |