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

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

    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 
    624624po/Makefile.in 
    625625]) 
    626626 
    627 if test x$enable_tests != xno; then 
    628     AC_CONFIG_FILES([ 
     627AC_CONFIG_FILES([ 
    629628tests/Makefile 
    630629tests/lib/Makefile 
    631630tests/lib/mcconfig/Makefile 
    tests/src/filemanager/Makefile 
    638637tests/src/editor/Makefile 
    639638tests/src/editor/test-data.txt 
    640639]) 
    641 fi 
    642640 
    643641AC_OUTPUT 
    644642 
    Configuration: 
    649647  Source code location:       ${srcdir} 
    650648  Compiler:                   ${CC} 
    651649  Compiler flags:             ${CFLAGS} 
     650  Unit tests:                 ${tests_msg} 
    652651  File system:                ${vfs_type} 
    653652                              ${vfs_flags} 
    654653  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..8b3ae90 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            ]) 
    2330        AC_SUBST(CHECK_CFLAGS) 
    2431        AC_SUBST(CHECK_LIBS) 
    2532    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