bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extra test module categories


From: Bruno Haible
Subject: extra test module categories
Date: Sun, 28 Mar 2010 17:03:46 +0100
User-agent: KMail/1.9.9

Jim Meyering suggested:

> > Rather than lumping them all into one "-extratests" category
> > that is tied to the module file name, have you considered
> > adding new module attributes?
> > 
> > Then, we could give any module one or more attributes,
> > and eventually exclude based on those attributes.
> > For example, if a package maintainer wants to avoid C++ tests,
> > they could do that without unnecessarily excluding long-running
> > ones as well.
> 
> So, gnulib-tool would have command-line options
>   --with[out]-long-running-tests
>   --with[out]-unportable-tests     [for tests that fail on some platforms,
>                                     e.g. flock, unlink, poll]
>   --with[out]-c++-tests
> ?

This proposal is now implemented, without the --without-* options (who
needs to exclude some tests when he creates a testdir?).


2010-03-28  Bruno Haible  <address@hidden>

        gnulib-tool: Add support for special categories of tests.
        * gnulib-tool: New options --with-c++-tests, --with-longrunning-tests,
        --with-privileged-tests, --with-unportable-tests, --with-all-tests.
        (func_usage): Document them.
        (inc_cxx_tests, inc_longrunning_tests, inc_privileged_tests,
        inc_unportable_tests, inc_all_tests): New variables.
        (func_acceptable): Consider these variables.
        (func_modules_transitive_closure): Make it work when the 'Status' field
        consists of multiple words.
        (func_import): Store and restore the values of inc_cxx_tests,
        inc_longrunning_tests, inc_privileged_tests, inc_unportable_tests,
        inc_all_tests in gnulib-comp.m4.
        (func_create_testdir): Set inc_all_tests to true.
        * doc/gnulib.texi (Extra tests modules): New section.
        Suggested by Jim Meyering.

*** doc/gnulib.texi.orig        Sun Mar 28 17:53:32 2010
--- doc/gnulib.texi     Sun Mar 28 17:51:54 2010
***************
*** 614,619 ****
--- 614,620 ----
  @menu
  * Out of memory handling::
  * Obsolete modules::
+ * Extra tests modules::
  * A C++ namespace for gnulib::      A different way of using Gnulib in C++
  * Library version handling::
  * Windows sockets::
***************
*** 689,694 ****
--- 690,756 ----
  @end example
  
  
+ @node Extra tests modules
+ @section Extra tests modules
+ 
+ @cindex Extra tests modules
+ @cindex C++ tests modules
+ @cindex tests modules, C++
+ @cindex long-running tests modules
+ @cindex tests modules, long-running
+ @cindex privileged tests modules
+ @cindex tests modules, privileged
+ @cindex unportable tests modules
+ @cindex tests modules, unportable
+ Test modules can be marked with some special status attributes.  When a
+ test module has such an attribute, @code{gnulib-tool --import} will not
+ include it by default.
+ 
+ The supported status attributes are:
+ 
+ @table @code
+ @item c++-test
+ Indicates that the test is testing C++ interoperability.  Such a test is
+ useful in a C++ or mixed C/C++ package, but is useless in a C package.
+ 
+ @item longrunning-test
+ Indicates that the test takes a long time to compile or execute (more
+ than five minutes or so).  Such a test is better avoided in a release
+ that is made for the general public.
+ 
+ @item privileged-test
+ Indicates that the test will request special privileges, for example,
+ ask for the superuser password.  Such a test may hang when run
+ non-interactively and is therefore better avoided in a release that is
+ made for the general public.
+ 
+ @item unportable-test
+ Indicates that the test is known to fail on some systems, and that
+ there is no workaround about it.  Such a test is better avoided in a
+ release that is made for the general public.
+ @end table
+ 
+ @code{gnulib-tool --import} will not include tests marked with these
+ attributes by default.  When @code{gnulib-tool} is invoked with one
+ of the options @code{--with-c++-tests}, @code{--with-longrunning-tests},
+ @code{--with-privileged-tests}, @code{--with-unportable-tests}, it
+ will include tests despite the corresponding special status attribute.
+ When @code{gnulib-tool} receives the option @code{--with-all-tests},
+ it will include all tests regardless of their status attributes.
+ 
+ @code{gnulib-tool --create-testdir} and
+ @code{gnulib-tool --create-megatestdir} always include all tests
+ regardless of their status attributes.
+ 
+ In order to mark a module with a status attribute, you need to add it
+ to the module description, like this:
+ 
+ @example
+ Status:
+ longrunning-test
+ @end example
+ 
+ 
  @node A C++ namespace for gnulib
  @section A C++ namespace for gnulib
  
*** gnulib-tool.orig    Sun Mar 28 17:53:32 2010
--- gnulib-tool Sun Mar 28 17:17:35 2010
***************
*** 165,171 ****
                              (recommended to use CC=\"gcc -Wall\" here)
        --extract-description        extract the description
        --extract-comment            extract the comment
!       --extract-status             extract the status (obsolete or not)
        --extract-notice             extract the notice or banner
        --extract-applicability      extract the applicability
        --extract-filelist           extract the list of files
--- 165,171 ----
                              (recommended to use CC=\"gcc -Wall\" here)
        --extract-description        extract the description
        --extract-comment            extract the comment
!       --extract-status             extract the status (obsolete etc.)
        --extract-notice             extract the notice or banner
        --extract-applicability      extract the applicability
        --extract-filelist           extract the list of files
***************
*** 233,238 ****
--- 233,247 ----
                              'gl_INIT'. Default is 'gl'.
        --po-domain=NAME      Specify the prefix of the i18n domain. Usually use
                              the package name. A suffix '-gnulib' is appended.
+       --with-c++-tests      Include even unit tests for C++ interoperability.
+       --with-longrunning-tests
+                             Include even unit tests that are long-runners.
+       --with-privileged-tests
+                             Include even unit tests that require root
+                             privileges.
+       --with-unportable-tests
+                             Include even unit tests that fail on some 
platforms.
+       --with-all-tests      Include all kinds of problematic unit tests.
        --vc-files            Update version control related files.
        --no-vc-files         Don't update version control related files
                              (.gitignore and/or .cvsignore).
***************
*** 858,863 ****
--- 867,880 ----
  # - auxdir          from --aux-dir
  # - inctests        true if --with-tests was given, blank otherwise
  # - incobsolete     true if --with-obsolete was given, blank otherwise
+ # - inc_cxx_tests   true if --with-c++-tests was given, blank otherwise
+ # - inc_longrunning_tests  true if --with-longrunning-tests was given, blank
+ #                          otherwise
+ # - inc_privileged_tests  true if --with-privileged-tests was given, blank
+ #                         otherwise
+ # - inc_unportable_tests  true if --with-unportable-tests was given, blank
+ #                         otherwise
+ # - inc_all_tests   true if --with-all-tests was given, blank otherwise
  # - avoidlist       list of modules to avoid, from --avoid
  # - lgpl            yes or a number if --lgpl was given, blank otherwise
  # - makefile_name   from --makefile-name
***************
*** 890,895 ****
--- 907,917 ----
    auxdir=
    inctests=
    incobsolete=
+   inc_cxx_tests=
+   inc_longrunning_tests=
+   inc_privileged_tests=
+   inc_unportable_tests=
+   inc_all_tests=
    avoidlist=
    lgpl=
    makefile_name=
***************
*** 1041,1052 ****
        --aux-dir=* )
          auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
          shift ;;
!       --with-tests )
          inctests=true
          shift ;;
!       --with-obsolete )
          incobsolete=true
          shift ;;
        --avoid )
          shift
          if test $# = 0; then
--- 1063,1089 ----
        --aux-dir=* )
          auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
          shift ;;
!       --with-tests | --with-test | --with-tes | --with-te | --with-t)
          inctests=true
          shift ;;
!       --with-obsolete | --with-obsolet | --with-obsole | --with-obsol | 
--with-obso | --with-obs | --with-ob | --with-o)
          incobsolete=true
          shift ;;
+       --with-c++-tests | --with-c++-test | --with-c++-tes | --with-c++-te | 
--with-c++-t | --with-c++- | --with-c++ | --with-c+ | --with-c)
+         inc_cxx_tests=true
+         shift ;;
+       --with-longrunning-tests | --with-longrunning-test | 
--with-longrunning-tes | --with-longrunning-te | --with-longrunning-t | 
--with-longrunning- | --with-longrunning | --with-longrunnin | --with-longrunni 
| --with-longrunn | --with-longrun | --with-longru | --with-longr | --with-long 
| --with-lon | --with-lo | --with-l)
+         inc_longrunning_tests=true
+         shift ;;
+       --with-privileged-tests | --with-privileged-test | 
--with-privileged-tes | --with-privileged-te | --with-privileged-t | 
--with-privileged- | --with-privileged | --with-privilege | --with-privileg | 
--with-privile | --with-privil | --with-privi | --with-priv | --with-pri | 
--with-pr | --with-p)
+         inc_privileged_tests=true
+         shift ;;
+       --with-unportable-tests | --with-unportable-test | 
--with-unportable-tes | --with-unportable-te | --with-unportable-t | 
--with-unportable- | --with-unportable | --with-unportabl | --with-unportab | 
--with-unporta | --with-unport | --with-unpor | --with-unpo | --with-unp | 
--with-un | --with-u)
+         inc_unportable_tests=true
+         shift ;;
+       --with-all-tests | --with-all-test | --with-all-tes | --with-all-te | 
--with-all-t | --with-all- | --with-all | --with-al | --with-a)
+         inc_all_tests=true
+         shift ;;
        --avoid )
          shift
          if test $# = 0; then
***************
*** 1158,1163 ****
--- 1195,1203 ----
         || test -n "$sourcebase" || test -n "$m4base" || test -n "$pobase" \
         || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
         || test -n "$inctests" || test -n "$incobsolete" \
+        || test -n "$inc_cxx_tests" || test -n "$inc_longrunning_tests" \
+        || test -n "$inc_privileged_tests" || test -n "$inc_unportable_tests" \
+        || test -n "$inc_all_tests" \
         || test -n "$avoidlist" || test -n "$lgpl" || test -n "$makefile_name" 
\
         || test -n "$macro_prefix" || test -n "$po_domain" \
         || test -n "$vc_files"; then
***************
*** 2235,2240 ****
--- 2275,2290 ----
  # func_acceptable module
  # tests whether a module is acceptable.
  # Input:
+ # - inc_cxx_tests   true if C++ interoperability tests should be included,
+ #                   blank otherwise
+ # - inc_longrunning_tests  true if long-runnings tests should be included,
+ #                          blank otherwise
+ # - inc_privileged_tests  true if tests that require root privileges should be
+ #                         included, blank otherwise
+ # - inc_unportable_tests  true if tests that fail on some platforms should be
+ #                         included, blank otherwise
+ # - inc_all_tests   true if all kinds of problematic unit tests should be
+ #                   included, blank otherwise
  # - avoidlist       list of modules to avoid
  func_acceptable ()
  {
***************
*** 2243,2248 ****
--- 2293,2330 ----
        return 1
      fi
    done
+   case "$1" in
+     *-tests)
+       inc=true
+       for word in `func_get_status "$1"`; do
+         case "$word" in
+           c++-test)
+             test -n "$inc_all_tests" || test -n "$inc_cxx_tests" \
+               || inc=false
+             ;;
+           longrunning-test)
+             test -n "$inc_all_tests" || test -n "$inc_longrunning_tests" \
+               || inc=false
+             ;;
+           privileged-test)
+             test -n "$inc_all_tests" || test -n "$inc_privileged_tests" \
+               || inc=false
+             ;;
+           unportable-test)
+             test -n "$inc_all_tests" || test -n "$inc_unportable_tests" \
+               || inc=false
+             ;;
+           *-test)
+             test -n "$inc_all_tests" \
+               || inc=false
+             ;;
+         esac
+       done
+       if ! $inc; then
+         return 1
+       fi
+       ;;
+   esac
    return 0
  }
  
***************
*** 2254,2259 ****
--- 2336,2351 ----
  # - inctests        true if tests should be included, blank otherwise
  # - incobsolete     true if obsolete modules among dependencies should be
  #                   included, blank otherwise
+ # - inc_cxx_tests   true if C++ interoperability tests should be included,
+ #                   blank otherwise
+ # - inc_longrunning_tests  true if long-runnings tests should be included,
+ #                          blank otherwise
+ # - inc_privileged_tests  true if tests that require root privileges should be
+ #                         included, blank otherwise
+ # - inc_unportable_tests  true if tests that fail on some platforms should be
+ #                         included, blank otherwise
+ # - inc_all_tests   true if all kinds of problematic unit tests should be
+ #                   included, blank otherwise
  # - avoidlist       list of modules to avoid
  # - tmp             pathname of a temporary directory
  # Output:
***************
*** 2284,2290 ****
            fi
            for dep in $deps; do
              if test -n "$incobsolete" \
!                || { status=`func_get_status $dep`; test "$status" != 
obsolete; }; then
                func_append inmodules " $dep"
              fi
            done
--- 2376,2391 ----
            fi
            for dep in $deps; do
              if test -n "$incobsolete" \
!                || { inc=true
!                     for word in `func_get_status $dep`; do
!                       case "$word" in
!                         obsolete)
!                           inc=false
!                           ;;
!                       esac
!                     done
!                     $inc
!                   }; then
                func_append inmodules " $dep"
              fi
            done
***************
*** 3127,3132 ****
--- 3228,3241 ----
  # - auxdir          directory relative to destdir where to place build aux 
files
  # - inctests        true if --with-tests was given, blank otherwise
  # - incobsolete     true if --with-obsolete was given, blank otherwise
+ # - inc_cxx_tests   true if --with-c++-tests was given, blank otherwise
+ # - inc_longrunning_tests  true if --with-longrunning-tests was given, blank
+ #                          otherwise
+ # - inc_privileged_tests  true if --with-privileged-tests was given, blank
+ #                         otherwise
+ # - inc_unportable_tests  true if --with-unportable-tests was given, blank
+ #                         otherwise
+ # - inc_all_tests   true if --with-all-tests was given, blank otherwise
  # - avoidlist       list of modules to avoid, from --avoid
  # - lgpl            yes or a number if library's license shall be LGPL,
  #                   blank otherwise
***************
*** 3151,3156 ****
--- 3260,3270 ----
    cached_local_gnulib_dir=
    cached_specified_modules=
    cached_incobsolete=
+   cached_inc_cxx_tests=
+   cached_inc_longrunning_tests=
+   cached_inc_privileged_tests=
+   cached_inc_unportable_tests=
+   cached_inc_all_tests=
    cached_avoidlist=
    cached_sourcebase=
    cached_m4base=
***************
*** 3188,3193 ****
--- 3302,3322 ----
        /gl_WITH_OBSOLETE/ {
          s,^.*$,cached_incobsolete=true,p
        }
+       /gl_WITH_CXX_TESTS/ {
+         s,^.*$,cached_inc_cxx_tests=true,p
+       }
+       /gl_WITH_LONGRUNNING_TESTS/ {
+         s,^.*$,cached_inc_longrunning_tests=true,p
+       }
+       /gl_WITH_PRIVILEGED_TESTS/ {
+         s,^.*$,cached_inc_privileged_tests=true,p
+       }
+       /gl_WITH_UNPORTABLE_TESTS/ {
+         s,^.*$,cached_inc_unportable_tests=true,p
+       }
+       /gl_WITH_ALL_TESTS/ {
+         s,^.*$,cached_inc_all_tests=true,p
+       }
        /gl_AVOID(/ {
          s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
        }
***************
*** 3287,3292 ****
--- 3416,3438 ----
    if test -z "$incobsolete"; then
      incobsolete="$cached_incobsolete"
    fi
+   # Included special kinds of tests modules among the dependencies if 
specified
+   # either way.
+   if test -z "$inc_cxx_tests"; then
+     inc_cxx_tests="$cached_inc_cxx_tests"
+   fi
+   if test -z "$inc_longrunning_tests"; then
+     inc_longrunning_tests="$cached_inc_longrunning_tests"
+   fi
+   if test -z "$inc_privileged_tests"; then
+     inc_privileged_tests="$cached_inc_privileged_tests"
+   fi
+   if test -z "$inc_unportable_tests"; then
+     inc_unportable_tests="$cached_inc_unportable_tests"
+   fi
+   if test -z "$inc_all_tests"; then
+     inc_all_tests="$cached_inc_all_tests"
+   fi
    # Append the cached and the specified avoidlist. This is probably better
    # than dropping the cached one when --avoid is specified at least once.
    avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | 
LC_ALL=C sort -u`
***************
*** 3753,3758 ****
--- 3899,3919 ----
    if test -n "$incobsolete"; then
      func_append actioncmd " --with-obsolete"
    fi
+   if test -n "$inc_cxx_tests"; then
+     func_append actioncmd " --with-c++-tests"
+   fi
+   if test -n "$inc_longrunning_tests"; then
+     func_append actioncmd " --with-longrunning-tests"
+   fi
+   if test -n "$inc_privileged_tests"; then
+     func_append actioncmd " --with-privileged-tests"
+   fi
+   if test -n "$inc_unportable_tests"; then
+     func_append actioncmd " --with-unportable-tests"
+   fi
+   if test -n "$inc_all_tests"; then
+     func_append actioncmd " --with-all-tests"
+   fi
    for module in $avoidlist; do
      func_append actioncmd " --avoid=$module"
    done
***************
*** 4039,4044 ****
--- 4200,4210 ----
      echo "$specified_modules" | sed -e 's/^/  /g'
      echo "])"
      test -z "$incobsolete" || echo "gl_WITH_OBSOLETE"
+     test -z "$inc_cxx_tests" || echo "gl_WITH_CXX_TESTS"
+     test -z "$inc_longrunning_tests" || echo "gl_WITH_LONGRUNNING_TESTS"
+     test -z "$inc_privileged_tests" || echo "gl_WITH_PRIVILEGED_TESTS"
+     test -z "$inc_unportable_tests" || echo "gl_WITH_UNPORTABLE_TESTS"
+     test -z "$inc_all_tests" || echo "gl_WITH_ALL_TESTS"
      echo "gl_AVOID([$avoidlist])"
      echo "gl_SOURCE_BASE([$sourcebase])"
      echo "gl_M4_BASE([$m4base])"
***************
*** 4485,4490 ****
--- 4651,4659 ----
    fi
    modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
  
+   # Unlike in func_import, here we want to include all kinds of tests.
+   inc_all_tests=true
+ 
    # Check that the license of every module is consistent with the license of
    # its dependencies.
    saved_modules="$modules"
***************
*** 5228,5235 ****
              for m4base in $m4dirs; do
                # Perform func_import in a subshell, so that variable values
                # such as
!               #   local_gnulib_dir, incobsolete, avoidlist, sourcebase, 
m4base,
!               #   pobase, docbase, testsbase, inctests, libname, lgpl,
                #   makefile_name, libtool, macro_prefix, po_domain, vc_files
                # don't propagate from one directory to another.
                (func_import) || func_exit 1
--- 5397,5406 ----
              for m4base in $m4dirs; do
                # Perform func_import in a subshell, so that variable values
                # such as
!               #   local_gnulib_dir, incobsolete, inc_cxx_tests,
!               #   inc_longrunning_tests, inc_privileged_tests,
!               #   inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
!               #   m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
                #   makefile_name, libtool, macro_prefix, po_domain, vc_files
                # don't propagate from one directory to another.
                (func_import) || func_exit 1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]