summaryrefslogtreecommitdiff
path: root/tests/init.sh
Commit message (Collapse)AuthorAgeFilesLines
...
* init.sh: make "compare /dev/null FILE" output more readableJim Meyering2011-11-221-8/+20
| | | | | | | * tests/init.sh (compare_): Document the preferred order of arguments. (emit_diff_u_header_): New function. (compare_dev_null_): Emit a simulated diff, rather than just the contents of the unexpected file. Suggestion from Bruno Haible.
* init.sh: work around OSF/1 5.1's mishandling of /dev/nullJim Meyering2011-11-221-6/+41
| | | | | | | * tests/init.sh: Make our compare function slightly more portable. Reported by Bruno Haible in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020 Much improved by Eric Blake.
* Silence successful tests that use 'compare' on AIX, HP-UX, Solaris.Bruno Haible2011-11-131-4/+37
| | | | | * tests/init.sh (compare): Remove "No differences encountered" or synonymous output from the 'diff' program.
* tests: use printf, not echo in init.sh's warn_ functionJim Meyering2011-09-191-1/+14
| | | | | | * tests/init.sh (warn_): Use printf, not echo. The latter would misbehave when given strings containing a backslash or starting with e.g., -n. James Youngman suggested setting IFS.
* tests: init.sh: Support any non-GNU diff.Bruno Haible2011-09-021-0/+2
| | | | | | * tests/init.sh (compare): If "diff -c" is supported but "diff -u" is not, use "diff -c". Useful on AIX 6.1, HP-UX 11.31, OSF/1 5.1, Solaris 8.
* tests: init.sh: work also with any non-GNU diff that supports -uBruno Haible2011-09-021-1/+1
| | | | | | | * tests/init.sh: Relax check for diff -u support. Rather than checking for GNU diff via --version, simply check for support for -u itself. Useful at least on OpenBSD 4.9, AIX 7.1, IRIX 6.5 and Solaris 10.
* init.sh: give more portable redirection-related advice in a commentJim Meyering2011-06-141-2/+2
| | | | | | | * tests/init.sh (stderr_fileno_): Update the advice in comments. See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488 for lots of discussion. Stefano Lattarini suggested the solution of putting "9>&2" after the command. Reported by Bruno Haible.
* tests: fix usage message in 'mktempd_'Stefano Lattarini2011-06-071-1/+1
| | | | | | * tests/init.sh (mktempd_): In the usage message, use literal 'mktempd_', not '$ME' (which is even undefined), as the name of the subroutine.
* tests init: new function 'fatal_', for hard errorsStefano Lattarini2011-06-071-0/+1
| | | | | | | | | | | | Before this patch, the only way offered by tests/init.sh to properly signal a hard error was the `framework_failure_' function. But the error message issued by that function, as its name would suggest, refers to a set-up failure in the testsuite, while hard errors can obviously also be due to other reasons. The best way to fix this inconsistency is to introduce a new function with a more general error message. * tests/init.sh (fatal_): New function.
* tests: fix logic bug in init.shEric Blake2011-05-241-1/+4
| | | | | | | | | | | If the shell test loop first finds a marginal then a good shell, the variable $gl_set_x_corrupts_stderr is still set to true and needlessly drops $VERBOSE logging. * tests/init.sh: (gl_set_x_corrupts_stderr_): Clear for successful shell. Signed-off-by: Eric Blake <eblake@redhat.com>
* test-malloca: unset MALLOC_PERTURB_ to speed up testPádraig Brady2011-01-211-1/+1
| | | | | | | * tests/test-malloca.c (main): Unset the environment variable to greatly speed up the test. * tests/init.sh: Don't say that MALLOC_PERTURB_ is cheap. * modules/malloca-tests: Depend on unsetenv.
* init.sh: insert space between each function name and "()"Jim Meyering2011-01-201-16/+16
| | | | | | * tests/init.sh: Make it a little easier to see that a function's name is "warn_", and not "warn" when looking at the first part of its definition: "warn_ ()". Suggested by Ralf Wildenhues.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* tests: avoid failing coreutils tests on cygwinEric Blake2010-12-311-1/+4
| | | | | | | * tests/init.sh (find_exe_basenames_): Exempt [.exe. (create_exe_shims_): Return 0 when skipping. Signed-off-by: Eric Blake <eblake@redhat.com>
* tests: minor indenting changePaul Eggert2010-12-281-2/+3
| | | | | | * tests/init.sh: Sync from coreutils housekeeping patch <http://lists.gnu.org/archive/html/coreutils/2010-12/msg00116.html> to keep lines within 80 columns.
* tests: set fail=0 at startPaul Eggert2010-12-181-2/+1
| | | | | | | * tests/init.sh (setup_): Move fail=0 initialization here ... (mktempd_): ... from here, so that tests can rely on fail being set to 0 initially. This fixes a problem in coreutils; see: http://lists.gnu.org/archive/html/coreutils/2010-12/msg00083.html
* init.sh: ensure that IFS is defined, just in case...Jim Meyering2010-11-131-0/+6
| | | | | | | | * tests/init.sh (setup_): Ensure that IFS is defined, so that saving and restoring it works as expected. This appears to be useful at least for an old version of dash from a long time ago (RH 6). See here for details: http://thread.gmane.org/gmane.comp.gnu.coreutils.general/436/focus=455
* init.sh: correct an outdated commentJim Meyering2010-09-181-1/+1
| | | | * tests/init.sh (create_exe_shims_): s/function/alias/
* init.sh: don't let an ephemeral "*.exe" make us skip all dir entriesJim Meyering2010-09-181-3/+5
| | | | | | | | | | | Not that it's likely to happen, but if I were to remove from a PATH directory a file named "*.exe" (yes, starting with an asterisk), at just the right moment, it would have made init.sh ignore all remaining .exe-suffixed names in that directory. * tests/init.sh (find_exe_basenames_): Don't give up on a directory if a file named "*.exe" is removed between the glob expansion and the processing of that oddly named file.
* init.sh: accomodate directory with no .exesEric Blake2010-09-171-0/+3
| | | | | | | | | | | | | | Cygwin was failing test-vc-list-files-{cvs,git}.sh, because of spurious output on stderr. ../../tests/test-vc-list-files-cvs.sh (exe_shim): skipping directory: /home/eblake/m4-branch/build-aux All because build-aux was a directory containing just scripts, and no .exe extensions. This fixes it. * tests/init.sh: Accomodate directory containing only scripts. Signed-off-by: Eric Blake <eblake@redhat.com>
* init.sh: penalize a set-x-impaired shell; don't disqualify itJim Meyering2010-09-091-29/+76
| | | | | | | | | | | | | | * tests/init.sh: Too many shells corrupt application stderr when you set -x, so we can't afford to disqualify them, since at least on Irix-6.5, that would disqualify all bourne shells. Instead, use a more discerning approach. When iterating through candidate shells, give each a score of 10 for perfect, 9 if corrupts stderr upon set -x but passes all other tests, and some other value if it is unacceptable. Use the first shell that gets a score of 10. If no shell scores 10, use the first that scored 9. Finally, when VERBOSE=yes is requested and set -x might cause trouble, simply issue a warning and refrain from enabling debug output.
* init.sh: disqualify shells for which set -x corrupts stderrJim Meyering2010-09-081-0/+4
| | | | | | | | * tests/init.sh: Add a test to disqualify /bin/sh from SunOS 5.11 and OpenBSD 4.7. They make it so with "set -x", environment settings appear in stderr output. For example, this command: /bin/sh -c 'set -x; P=1 true 2> err' 2>/dev/null; cat err prints "P=1" on those two systems:
* tests: init.sh improvements for re-exec'ing with zshEric Blake2010-09-021-2/+21
| | | | | | | | | | | | Tom's IRIX setup had a broken bash, and proceeded to run zsh outside of POSIX mode. But trying to trace that setup proved difficult, since the re-exec lost tracing. * tests/init.sh: Borrow autoconf POSIX-mode sanitization. Pass -vx through shell re-exec. Reported by Tom G. Christensen. Signed-off-by: Eric Blake <eblake@redhat.com>
* init.sh: work around trap limitation of some shellsPeter O'Gorman2010-07-291-3/+6
| | | | | | | | This limitation is already documented in the Autoconf manual. * tests/init.sh (setup_): Move exit trap outside of shell function. Signed-off-by: Eric Blake <eblake@redhat.com>
* init.sh: change framework_failure_ to fail with status 99, not 1Ralf Wildenhues2010-06-111-1/+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.
* init.sh: don't use $ME_ or skip_ before they are definedJim Meyering2010-06-111-21/+22
| | | | | | | * 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.
* Fix output redirection buglet in init.sh.Ralf Wildenhues2010-05-231-2/+2
| | | | * tests/init.sh: Fix redirection of stderr.
* init.sh: fix an error in the previous change; add more commentsJim Meyering2010-05-161-2/+6
| | | | | | | * 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.
* init.sh: avoid unnecessary shell re-execJim Meyering2010-05-161-14/+27
| | | | | | | | | | * 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.
* init.sh: fix a typoPeter O'Gorman2010-05-101-1/+1
| | | | * tests/init.sh: Correct typo in MALLOC_PERTURB_ initialization.
* init.sh: enable MALLOC_PERTURB_Jim Meyering2010-05-091-0/+7
| | | | * tests/init.sh: Enable glibc's malloc-perturbing option.
* init.sh: improve commentsJim Meyering2010-05-071-2/+7
| | | | | | | * 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.
* init.sh: ensure a more reliable exit status when exiting via trapJim Meyering2010-04-281-3/+5
| | | | | | * tests/init.sh (setup_): Don't rely on $? in signal handler. Inspired by patches from Dmitry V. Levin. Also trap on signal 3 (SIGQUIT).
* init.sh: run tr in the "C" locale to avoid multibyte interpretationJim Meyering2010-04-091-2/+2
| | | | | | | | * tests/init.sh (rand_bytes_): Run tr in the "C" locale so it does not try to interpret its random input bytes. Jarno Rajahalme reported that ./test-xalloc-die.sh would fail with "tr: Illegal byte sequence" on Darwin 10.3.0 with LC_CTYPE=UTF-8. (mktempd_): Likewise, just in case.
* init.sh: simply unset TMPDIR rather than risking env -iJim Meyering2010-04-061-1/+1
| | | | | | | | | * tests/init.sh (mktempd_): Using env -i is rather harsh, and although it probably works fine on all Unix-based systems, some systems (Cygwin?) cannot tolerate a totally cleared environment. Suggestion from Eric Blake. 2010-04-06 Jim Meyering <meyering@redhat.com>
* init.sh: portability fix: use env's POSIX-specified -i option not -uJim Meyering2010-04-061-1/+1
| | | | | * tests/init.sh (mktempd_): Use env -i and set PATH explicitly rather than unportable env -u. Solaris 5.11's env lacks support for -u.
* init.sh: fix typoJim Meyering2010-04-051-1/+1
| | | | * tests/init.sh: Restore omitted ":" before stderr_fileno_ initialization.
* init.sh: make it easier for a test script to write to the tty, ...Jim Meyering2010-04-051-2/+12
| | | | | | | when using automake's parallel-tests mode. * tests/init.sh (stderr_fileno_): Define overridable variable. (warn_): New function, to use it. (fail_, skip_, framework_failure_): Use warn_.
* init.sh: fix EXEEXT shims to work also for names like test-progJim Meyering2010-02-211-7/+43
| | | | | | | | | * tests/init.sh: Re-exec a better shell, when needed. If the current shell lacks support for posix $(...), an init.sh-using test will now try to find a shell that supports that. If EXEEXT is nonempty, we also require support for hyphen-in-alias-name and shell substitutions like ${var#glob}. Failure to find such a shell results in a skipped test.
* init.sh: don't use $(...) just yetJim Meyering2010-02-181-1/+1
| | | | | * tests/init.sh (create_exe_shim_functions_): Use `...`, not $(...), to accommodate e.g., Solaris' /bin/sh.
* init.sh: improve portability and efficiencyJim Meyering2010-02-161-6/+7
| | | | | | | | | * tests/init.sh (find_exe_basenames_): Remove unnecessary use of "dummy" in a for loop. Use '!', not '^' to select the complement of a character set used in a "case" statement. Use shell variable manipulation, a la ${...%.exe}, rather than sed. Suggestions from Eric Blake.
* init.sh: automatically accommodate programs with the .exe suffixJim Meyering2010-02-161-1/+54
| | | | | | | | | | | | Automatically arrange for an invocation of "prog" to execute the program named "prog$EXEEXT" (usually prog.exe). Thus, all invocations may use the simpler "prog", yet still work when built on a system that requires specifying the added suffix. Do this by constructing a function named "prog" that invokes "prog.exe" for each .exe file in selected directories. * tests/init.sh (find_exe_basenames_): New function. (create_exe_shim_functions_): New function. (path_prepend_): Use it.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* init.sh: avoid Solaris 10 /bin/sh portability problemJim Meyering2009-12-081-20/+22
| | | | | | | | | | | | | | | | | Solaris 10's /bin/sh does not pass '.' arguments 2..N to the sourced script: $ printf 'echo "$@"\n' > f; /bin/sh -c '. ./f bar' $ printf 'echo "$@"\n' > f; bash -c '. ./f bar' bar tests/init.sh relied on that, accepting a --set-path=DIR argument, and two tests used that idiom. * tests/init.sh: Update suggested usage comments. (path_prepend_): New function, to be used in place of the --src-path=DIR option. Disallow empty strings and strings containing ":". (setup_): Move PATH-prepending code into path_prepend_. * tests/test-pread.sh: Adapt to new usage. * tests/test-xalloc-die.sh: Likewise.
* init.sh: suggest to use skip_ and fail_ functions in commentsEric Blake2009-11-261-0/+1
| | | | * tests/init.sh: Add a sentence.
* init.sh: add documentation in commentsBruno Haible2009-11-261-0/+36
| | | | * tests/init.sh: Add some developer and user documentation.
* init.sh: accommodate even those who specify bogus srcdir manuallyJim Meyering2009-11-261-2/+2
| | | | | | | | | | | * tests/init.sh: Normally, srcdir is guaranteed by automake and configure-time tests to be sanitized, so that there is no need to use "$srcdir" in Makefile rules and shell scripts. Using $srcdir (with no double quotes) suffices. However, since tests may be invoked manually, and since you may explicitly set srcdir to the name of a directory containing spaces, do quote its uses here. * tests/test-pread.sh: Likewise. Suggested by Bruno Haible.
* tests/init.sh: new file to be used via most *.sh testsJim Meyering2009-11-251-0/+216
* tests/init.sh: New file.