Ralf Wildenhues [Fri, 11 Jun 2010 17:03:33 +0000 (19:03 +0200)]
init.sh: change framework_failure_ to fail with status 99, not 1
* tests/init.sh (framework_failure_): Exit 99, not 1. This informs
automake's parallel-tests rule that this is an unexpected failure,
even if the test is listed in XFAIL_TESTS.
Jim Meyering [Fri, 11 Jun 2010 15:31:04 +0000 (17:31 +0200)]
test-inttostr: avoid warnings about 4-6KB literal strings
* tests/test-inttostr.c: Don't use <assert.h>. Instead, ...
Include "macros.h", for its definition of ASSERT.
(CK): s/assert/ASSERT/
* modules/inttostr-tests (Files): Add macros.h.
Jim Meyering [Fri, 11 Jun 2010 11:41:31 +0000 (13:41 +0200)]
init.sh: don't use $ME_ or skip_ before they are defined
* tests/init.sh: Hoist definitions of $ME_ and skip_ to precede
their first uses. Also hoist their companions: warn_, fail_,
framework_failure_, $stderr_fileno. Prompted by a patch from
Stefano Lattarini.
Jim Meyering [Fri, 11 Jun 2010 09:03:54 +0000 (11:03 +0200)]
test-xvasprintf: avoid 'const' discard warnings
* tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Use
"const" when assigning from literal strings.
(test_xasprintf): Add "void" in function argument list to placate
-Wstrict-prototypes and to be consistent with test_xvasprintf above.
Jim Meyering [Fri, 11 Jun 2010 07:50:29 +0000 (09:50 +0200)]
tests: avoid compilation warnings in argmatch and exclude tests...
in packages that define ARGMATCH_DIE_DECL, like coreutils.
* tests/test-exclude.c [ARGMATCH_DIE_DECL]: Also declare the function.
Since it always exits, declare with the "noreturn" attribute.
* tests/test-argmatch.c: Likewise.
Jim Meyering [Fri, 11 Jun 2010 06:50:08 +0000 (08:50 +0200)]
test-linkat: avoid failed assertion on "other" architectures
* tests/test-linkat.c: Include <sys/stat.h>, for declarations of stat,
lstat, mkdir. Patch by John Rigby, to fix FTBFS on armel, powerpc,
sparc: https://bugs.launchpad.net/bugs/591968
Jim Meyering [Thu, 10 Jun 2010 13:21:09 +0000 (15:21 +0200)]
printf.m4: avoid autoconf's "Expanded Before Required" warning
* m4/printf.m4 (gl_SNPRINTF_RETVAL_C99): Define using AC_DEFUN_ONCE,
rather than AC_DEFUN, to avoid the classic "Expanded Before Required"
autoconf warning.
Jim Meyering [Thu, 10 Jun 2010 16:35:59 +0000 (18:35 +0200)]
inttostr-tests: depend on snprintf, not snprintf-posix
* modules/inttostr-tests (Depends-on): Depend on snprintf, not
snprintf-posix, to avoid this aclocal failure:
missing file gnulib-tests/vasnprintf.c
configure.ac:45: error: expected source file, required through \
AC_LIBSOURCES, not found
Jim Meyering [Wed, 9 Jun 2010 16:22:25 +0000 (18:22 +0200)]
inttostr: add a new function, inttostr, and tests
The namesake function was not available. The existence of the
template file, inttostr.c makes its addition nontrivial.
* lib/anytostr.c: Rename from inttostr.c.
(anytostr): Rename from inttostr.
* lib/inttostr.c: New file.
* modules/inttostr (Files): Add anytostr.c.
(Makefile.am): Set lib_SOURCES instead of ...
* m4/inttostr.m4: Remove uses of AC_LIBOBJ.
* lib/imaxtostr.c: Update use. s/inttostr/anytostr/
* lib/offtostr.c: Likewise.
* lib/uinttostr.c: Likewise.
* lib/umaxtostr.c: Likewise.
* modules/inttostr-tests: New file.
* tests/test-inttostr.c: New file. Test these functions.
Ben Pfaff [Thu, 10 Jun 2010 03:53:13 +0000 (20:53 -0700)]
Add "Extending Gnulib" chapter to manual.
* doc/gnulib.texi (Writing Modules): Add cross-reference to new chapter.
(Extending Gnulib): New chapter.
* doc/gnulib-intro.texi (Openness): Add cross-reference to new chapter.
Eric Blake [Wed, 2 Jun 2010 17:08:06 +0000 (11:08 -0600)]
time: work with mingw + pthreads-win32 library
When using the pthreads-win32 library with mingw, struct timespec
is available in <pthread.h>. Meanwhile, that header has some
rather buggy macros for localtime_r and gmtime_r that interfere
with proper gnulib replacement header actions.
Tested in a cross-compilation environment: Fedora 13 with mingw32-gcc
and mingw32-pthreads installed.
* m4/time_h.m4 (gl_CHECK_TYPE_STRUCT_TIMESPEC): Set new variable
if timespec is defined only in pthread.h.
* modules/time (Makefile.am): Substitute it.
* lib/time.in.h (!TIME_H_DEFINES_STRUCT_TIMESPEC): Include
<pthread.h>, when needed.
(GNULIB_TIME_R): Undefine broken localtime_r and gmtime_r macros
from the library.
Ludovic Courtès [Fri, 28 May 2010 10:15:23 +0000 (12:15 +0200)]
git-version-gen: take a sed script to transform the git tag
* build-aux/git-version-gen (tag_sed_script): New variable. Use it to
transform the output of "git describe" to the canonical form.
* top/GNUmakefile (_curr-ver): Pass $(git-version-gen-tag-sed-script) as
a second argument to `git-version-gen'.
Jim Meyering [Thu, 27 May 2010 11:33:04 +0000 (13:33 +0200)]
maint.mk: also prohibit "#undef" of always-defined symbols
* top/maint.mk (def_sym_regex): Handle #undef as well as #define.
Allow more than one space before the symbol name.
(sc_prohibit_always-defined_macros): Use grep's -E, now that
the regexp uses alternation.
Eric Blake [Wed, 26 May 2010 17:47:22 +0000 (11:47 -0600)]
maint.mk: avoid echo -e
There are still other potentially non-portable uses of echo
throughout this file, if $(ME) contains \ or starts with -,
but this patch is a trivial step in the right direction.
* top/maint.mk (gzip_rsyncable): Convert all uses of echo -* to
printf.
Reported by Matthias Bolte.
Jim Meyering [Sun, 23 May 2010 08:32:12 +0000 (10:32 +0200)]
test-pwrite: do not leave behind a test file named "out"
Revert commit d8fa18472a54c1cb2674c296b3d82443f234d5f7.
The trivial-looking use of init.sh is really necessary.
It ensures that the temporary file, "out", is created in
a temporary directory, and removed upon termination.
* tests/test-pwrite.sh: Re-add file.
* modules/pwrite-tests: Reference it.
bootstrap: fix an error when gnulib is not used as a git submodule
* build-aux/bootstrap (gnulib_path): If its length is zero then
assign "gnulib" to it.
* build-aux/bootstrap: Redirect "git clone -h" stderr to stdout.
Jim Meyering [Sun, 16 May 2010 20:30:00 +0000 (22:30 +0200)]
init.sh: fix an error in the previous change; add more comments
* tests/init.sh: Compare exit code in loop against 9, not 2.
Patch by Bruno Haible.
Make the two tests more similar by adding an empty "then" clause.
Add comments.
Jim Meyering [Sun, 16 May 2010 16:34:08 +0000 (18:34 +0200)]
init.sh: avoid unnecessary shell re-exec
* tests/init.sh: Improve the re-exec-required check to first test the
current shell. If it passes the test, do not search for a shell that
does pass, and do not re-exec. This test is particularly contorted to
avoid triggering misbehavior in Solaris 10's /bin/sh whereby any use
of $(...) evokes a syntax error and causes immediate shell exit with
status 2. Bruno Haible reported that the re-exec made it impossible
to single-step through any init.sh-using script.
Jim Meyering [Tue, 11 May 2010 16:49:29 +0000 (18:49 +0200)]
maint.mk: tweak preceding change
* top/maint.mk (gl_extract_significant_defines_): Make exclusion
regexps tighter by anchoring at EOL, and make the new group "shy"
for slightly decreased overhead.
Eric Blake [Tue, 11 May 2010 14:52:39 +0000 (08:52 -0600)]
maint.mk: gnulib doesn't guarantee NSIG
Gnulib conditionally defines NSIG to 32 for some platforms. But since
NSIG is not mandated by standards, and there are platforms with 64
signals, we should not promise that NSIG is guaranteed.
Jim Meyering [Mon, 10 May 2010 07:29:09 +0000 (09:29 +0200)]
maint.mk: avoid using a temporary file in the always-defined-macros check
* top/maint.mk (.re-defmac): Remove rule.
(gl_trap_): Remove definition.
(sc_prohibit_always-defined_macros): Rewrite not to create and
depend on a temporary file. Instead, depend on GNU grep's ability
to read a list of regular expressions from stdin when given "-f -".
With my recent change in init.sh from the two-line form:
-# : ${srcdir=.}
-# . "$srcdir/init.sh"; path_prepend_ .
+# . "${srcdir=.}/init.sh"; path_prepend_ .
I noticed that using the one-line form would cause this test
to fail with a false-positive, or to stop working altogether,
depending on whether help-version changed or all the tests did.
* top/maint.mk (_hv_regex): Remove this definition.
(_hv_regex_weak): Use a weak regex to select all init.sh-sourcing files.
(_hv_regex_strong): Use a stronger regex to check for conformance.
(sc_cross_check_PATH_usage_in_tests): Rewrite to use the above.
Give a separate diagnostic for lack of conforming use.
Jim Meyering [Fri, 7 May 2010 07:19:41 +0000 (09:19 +0200)]
init.sh: improve comments
* tests/init.sh: Recommend the one-line init.sh-sourcing idiom:
. "${srcdir=.}/init.sh"; path_prepend_ .
Add a note about path_prepend_ and the alternative of using
TESTS_ENVIRONMENT.
exclude: Unescape hashed patterns in wildcard mode.
* lib/exclude.c (add_exclude): Unescape the pattern before adding it
to the hash list.
* tests/test-exclude8.sh: New test case.
* modules/exclude-tests: Add new test.
Eric Blake [Wed, 5 May 2010 22:19:18 +0000 (16:19 -0600)]
verify: automate tests
Had we automated this sooner, we would have caught the issue
with gcc -Werror -Wredundant-decls sooner.
* modules/verify-tests: New module.
* tests/test-verify.sh: New file.
* tests/test-verify.c: Guard each negative test with a unique id.
Also avoid warning about unused left hand of comma expressions.
Paul Eggert [Wed, 5 May 2010 20:57:26 +0000 (13:57 -0700)]
Further improvements to verify.h, suggested by Eric Blake.
* lib/verify.h (_GL_CONCAT, _GL_CONCAT0, _GL_GENSYM): Renamed from
the GL_* versions, to avoid collision with OpenGL.
(_GL_COUNTER): New macro, so that we can fall back on __LINE__ if
__COUNTER__ doesn't work. Test that __COUNTER__ increments rather
than testing merely whether it's defined.
Paul Eggert [Wed, 5 May 2010 19:50:00 +0000 (12:50 -0700)]
Modify verify.h to pacify gcc -Wredundant_decls.
* lib/verify.h (GL_CONCAT, GL_CONCAT0, GL_GENSYM): New macros.
These use the prefix "GL_" since they're likely to be useful elsewhere.
We may need to break them out into a different .h file.
(__COUNTER__): Define to 0 if the compiler doesn't support it.
(verify) [!defined __cplusplus]: Use them to avoid duplicate decls
of verify_function__.