Ticket #3708: 3708-Fix-usability-problems-in-enable-tests.patch

File 3708-Fix-usability-problems-in-enable-tests.patch, 3.0 KB (added by mooffie, 7 years ago)
  • configure.ac

    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: 
    649649  Source code location:       ${srcdir} 
    650650  Compiler:                   ${CC} 
    651651  Compiler flags:             ${CFLAGS} 
     652  Unit tests:                 ${tests_msg} 
    652653  File system:                ${vfs_type} 
    653654                              ${vfs_flags} 
    654655  Screen library:             ${screen_msg} 
  • m4.include/mc-tests.m4

    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],[ 
    1111 
    1212    AC_ARG_ENABLE( 
    1313        [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. 
    1517    ) 
    1618 
     19    tests_msg=$enable_tests 
     20 
    1721    if test x$enable_tests != xno; then 
    1822        PKG_CHECK_MODULES( 
    1923            CHECK, 
    2024            [check >= 0.9.8], 
    2125            [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            ]) 
    2331        AC_SUBST(CHECK_CFLAGS) 
    2432        AC_SUBST(CHECK_LIBS) 
    2533    fi 
  • tests/Makefile.am

    diff --git a/tests/Makefile.am b/tests/Makefile.am
    index fc16371..de3ff6c 100644
    a b  
    11SUBDIRS = lib src 
    22 
    3 EXTRA_DIST = mctest.h 
     3EXTRA_DIST = mctest.h README 
  • new file tests/README

    diff --git a/tests/README b/tests/README
    new file mode 100644
    index 0000000..d139fb0
    - +  
     1Overview 
     2-------- 
     3 
     4This tree contains unit tests. 
     5 
     6To enable these tests, run 'configure' with '--enable-tests'. You need to 
     7have the "Check" unit testing framework[1] installed.[2] You should then 
     8see "Unit tests: yes" in configure's summary message. 
     9 
     10To compile the tests, run 'make check'. 
     11 
     12 
     13Tips 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