From 747fccb8695804a030a2f6809486ff2be5662d07 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 | 1 +
m4.include/mc-tests.m4 | 12 ++++++++++--
tests/Makefile.am | 2 +-
tests/README | 22 ++++++++++++++++++++++
4 files changed, 34 insertions(+), 3 deletions(-)
create mode 100644 tests/README
diff --git a/configure.ac b/configure.ac
index 3554598..26d18d2 100644
a
|
b
|
Configuration: |
649 | 649 | Source code location: ${srcdir} |
650 | 650 | Compiler: ${CC} |
651 | 651 | Compiler flags: ${CFLAGS} |
| 652 | Unit tests: ${tests_msg} |
652 | 653 | File system: ${vfs_type} |
653 | 654 | ${vfs_flags} |
654 | 655 | Screen library: ${screen_msg} |
diff --git a/m4.include/mc-tests.m4 b/m4.include/mc-tests.m4
index c991fbb..e56972f 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 | enable_tests=no dnl Prevents makefiles under 'tests' folder from being generated later on (not mandatory, but nice to have) |
| 30 | ]) |
23 | 31 | AC_SUBST(CHECK_CFLAGS) |
24 | 32 | AC_SUBST(CHECK_LIBS) |
25 | 33 | 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 |