summaryrefslogtreecommitdiff
path: root/tests/test-lib.sh
AgeCommit message (Collapse)Author
2010-11-17tests: remove test-lib.sh; now all tests use gnulib's init.shJim Meyering
* tests/test-lib.sh: Remove file. No longer used. * tests/Makefile.am (EXTRA_DIST): Remove it here, too. * tests/sample-test: Correct a comment.
2010-06-30tests: move most helper functions from test-lib.sh to new init.cfgJim Meyering
From there, they will be used by both test-lib.sh (as we phase it out) and the newer init.sh, to which all tests will migrate. * tests/test-lib.sh: Move most functions from here, ... * tests/init.cfg: ...to here. New file. * tests/Makefile.am (EXTRA_DIST): Add init.cfg.
2010-04-29sort: use long doubles for general numeric modePádraig Brady
* src/sort.c (general_numcompare): Use long doubles unconditionally, and strtold when available, to convert numbers with greater range and precision. Performance was seen to be on par with standard doubles. * doc/coreutils.texi (sort invocation): Amend the -g description to mention long double rather than double, and strtold rather than strtod. * src/getlimits.c (main): Output floating point limits for use in tests. * tests/misc/sort-float: A new test to ensure sort is using long doubles when possible, and that locale specific floats are handled. * tests/Makefile.am: Reference the new test. * tests/test-lib.sh (getlimits_): Normalize indenting. * NEWS: Mention the new behaviour. Reported by Nelson Beebe.
2010-04-24tests: clean up also upon SIGQUITJim Meyering
* tests/test-lib.sh: Also trap on SIGQUIT. Spotted by Dmitry V. Levin.
2010-04-23tests: fix exit status of signal handlers in shell scriptsDmitry V. Levin
The value of `$?' on entrance to signal handlers in shell scripts cannot be relied upon, so set the exit code explicitly. * cfg.mk (sc_always_defined_macros, sc_system_h_headers): Set the exit code in signal handler explicitly to 128 + SIG<SIGNAL>. * src/Makefile.am (sc_tight_scope): Likewise. * tests/test-lib.sh: Likewise.
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-12-03tests: fix a bug in sanitize_path_ that inhibited verbose outputJim Meyering
* tests/test-lib.sh (sanitize_path_): Use "set -- ...", not "set - ...", since the latter turns off the -x setting we rely on for VERBOSE=yes output.
2009-11-23tests: avoid test failures when PATH contains an unsearchable directoryJim Meyering
* tests/test-lib.sh (sanitize_path_): New function. Always call it.
2009-10-30tests: factor 350 fail=0 initializations into test-lib.shJim Meyering
Run this command to remove the factored-out "fail=0" lines. perl -ni -e '/^fail=0$/ or print' $(g grep -l '^fail=0$') * tests/test-lib.sh: Initialize fail=0 here, not in 300+ scripts. * tests/...: nearly all bourne shell scripts Suggested by Eric Blake.
2009-08-26tests: mkdir/selinux: avoid spurious failure on some SELinux systemsJim Meyering
* tests/test-lib.sh (require_selinux_enforcing_): New function. * tests/mkdir/selinux: Use it. Otherwise, this test would fail on Rawhide with SELinux disabled.
2009-08-25maint: remove Local Variables: indent-tabs-mode: nil from all sourcesJim Meyering
* src/getlimits.c: Likewise. * src/group-list.c: Likewise. * src/groups.c: Likewise. * src/mktemp.c: Likewise. * src/setuidgid.c: Likewise. * src/stdbuf.c: Likewise. * src/timeout.c: Likewise. * src/truncate.c: Likewise. * gl/lib/mbsalign.c: Likewise. * tests/test-lib.sh: Likewise. * bootstrap: Likewise. * README-hacking: Likewise.
2009-07-30tests: new function: require_openat_support_Jim Meyering
* tests/rm/inaccessible: Factor out openat-support-detection code... * tests/test-lib.sh (require_openat_support_): ...into this new function.
2009-07-04tests: use the "nobody" user's group as the default group idGiuseppe Scrivano
* tests/chroot/credentials: Use the group id, not its name. * tests/test-lib.sh (NON_ROOT_GROUP): Use the "nobody" user's group in place of "nogroup".
2009-06-15maint: revert last change: we're not ready for "local" in scripts, yetJim Meyering
Revert "use a local var: more readable" This reverts commit c0d82452883a10911c9cbc69c84144d99b7e6b08.
2009-06-15use a local var: more readableJim Meyering
2009-06-15tail: use inotify if it is availableGiuseppe Scrivano
* NEWS: Document the new feature. * m4/jm-macros.m4: Check if inotify is present. * src/tail.c (tail_forever_inotify): New function. (main): Use the inotify-based function, if possible. * tests/Makefile.am: Add new tests for tail. * tests/test-lib.sh (require_proc_pid_status_, get_process_status_): New functions. * tests/tail-2/pid: New file. * tests/tail-2/wait: New file. * tests/tail-2/tail-n0f: Refactor code into the test-lib.sh require_proc_pid_status_ function.
2009-06-02tests: use "nobody" as the default group name in chroot testJim Meyering
* tests/test-lib.sh (NON_ROOT_GROUP): Use "nobody", not "nogroup".
2009-05-26chroot: accept new options --userspec=U:G and --groups=G1,G2,G3Giuseppe Scrivano
* NEWS: Note chroot's new options. * doc/coreutils.texi: Document them. * src/chroot.c (main): Add support for --userspec and --groups. * tests/Makefile.am (root-tests): Add chroot/credentials. * tests/chroot/credentials: New file. * tests/test-lib.sh: Define NON_ROOT_GROUP to a default value.
2009-03-27tests: migrate setgid-check into test-lib.shJim Meyering
* tests/test-lib.sh (skip_if_setgid_): New function. * tests/setgid-check: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove setgid-check. * tests/chmod/c-option: Use the new function rather than sourcing the separate file. * tests/cp/cp-parents: Likewise. * tests/install/install-C: Likewise. * tests/mkdir/parents: Likewise. * tests/mkdir/perm: Likewise.
2009-03-02tests: reflect the s/+/./ SELinux indicator changeJim Meyering
* tests/mkdir/perm: Now that this test is no longer always skipped, make it work independently of ls: use stat, not ls, to get perm string. * test-lib.sh (rwx_to_mode_): Use stat, not ls to get perm string This test was run only when RUN_VERY_EXPENSIVE_TESTS=yes was set.
2009-03-02tests: when skipping a test, say why on screen, not just in the logJim Meyering
* tests/test-lib.sh: Redirect also to descriptor 9. Better one-line why-skip diagnostics. * tests/check.mk (TESTS_ENVIRONMENT): Redirect 9 to stderr. * tests/misc/pwd-unreadable-parent: Remove redundant "skipping..." diag.
2009-02-18maint: add copyright noticesJim Meyering
* HACKING: Add copyright notice. * tests/test-lib.sh: Likewise.
2009-02-10* tests/test-lib.sh: Use skip_test_... in place of echo...;exit 77.Jim Meyering
2009-02-10tests: avoid skipping stty-* testsNix
* tests/test-lib.sh (require_controlling_input_terminal_): Check stdout, not stdin.
2009-01-03tests: refactor to use the new getlimits utilityPádraig Brady
* tests/Coreutils.pm: Add function to make limits available * tests/test-lib.sh: ditto * tests/misc/join: Check for both SIZE_OFLOW and UINTMAX_OFLOW rather than using arbitrary 2^128 * tests/misc/sort: ditto * tests/misc/uniq: ditto * tests/misc/printf: Check for both INT_OFLOW and INT_UFLOW rather than using arbitrary -2^31 * tests/misc/seq-long-double: Check for INTMAX_OFLOW rather than using arbitrary 2^63 * tests/misc/split-fail: Check --lines --bytes and --line-bytes options limits on all platforms. Note getlimits obviates the need to use expr to check if 32 bit integers are supported, which I think was invalid anyway as expr now supports bignum? * tests/misc/test: Check for UINTMAX_OFLOW rather than using arbitrary 2^64 and 2^128. Check for INTMAX_UFLOW rather than using arbitrary -2^64 * tests/misc/timeout-parameters: Check for UINT_OFLOW rather than using arbitrary 2^32 * tests/misc/truncate-overflow: Don't depend on truncate to determine if we're on a 32 or 64 bit platform and instead use the various OFF_T limits * tests/misc/sort-merge: Check for UINTMAX_OFLOW rather than using arbitrary 2^64+1 * tests/misc/unexpand: ditto
2008-09-10tests: don't use "local" in bourne shell scriptsJim Meyering
* tests/test-lib.sh (remove_tmp_, skip_if_mcstransd_is_running_): Avoid failure on Solaris 11, since their /bin/sh passes the tests in posix-shell.m4, yet does not support "local" (which is not POSIX).
2008-09-10tests: use "Exit $fail", not (exit $fail); exit $failJim Meyering
* tests/test-lib.sh (Exit): New function by Ralf Wildenhues in automake http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=20594c08f63 * tests/**: Convert all uses: This restrictive change converted the vast majority: git grep -l '^(exit \$fail); exit \$fail$' \ | xargs perl -pi -e 's/'^\(exit \$fail\); exit \$fail$/Exit \$fail/' And this did the rest, plus a few undesirable ones, so I manually backed out the changes to ChangeLog-* and build-aux/check.mk: git grep -l -E '\(exit [^)]+\); exit ' \ | xargs perl -pi -e 's/\(exit (.+?)\); exit \1/Exit $1/'
2008-09-08tests: move input-tty into a test-lib.sh functionJim Meyering
* tests/test-lib.sh (require_controlling_input_terminal_): New function, from * tests/input-tty: ...here. Remove file. * tests/Makefile.am (EXTRA_DIST): Remove input-tty. * tests/mv/i-3: Use the function, not the file. * tests/misc/stty: Likewise. * tests/misc/stty-row-col: Likewise. * tests/misc/stty-invalid: Likewise.
2008-07-22tests: do not run chmod on a prefix of space-embedded tmpdirJim Meyering
* TESTS/test-lib.sh (remove_tmp_): New function. (trap 0): Use it instead of open-coded (and misquoted) version.
2008-05-06tests: skip another test if mcstransd is runningJim Meyering
* tests/test-lib.sh (skip_if_mcstransd_is_running_): New function, extracted from... * tests/misc/chcon: ...here. Use function, not open-coded test. * tests/misc/selinux: Use the function here, too. Require root, not non-root. * tests/Makefile.am (root_tests): Add misc/selinux.
2008-05-06tests: move "sparse-file" into test-lib.shJim Meyering
* tests/sparse-file: Remove file Move contents into ... * tests/test-lib.sh (require_sparse_support_): ...here. New function. * tests/cp/sparse: Use the function, not the file. * tests/du/8gb: Likewise. * tests/Makefile.am (EXTRA_DIST): Remove sparse-file.
2008-05-06tests: move "group-names" into test-lib.shJim Meyering
* tests/group-names: Remove file Move contents into ... * tests/test-lib.sh (require_membership_in_two_groups_): ...here. New function. * tests/chgrp/basic: Use the function, not the file. * tests/chgrp/default-no-deref: Likewise. * tests/chgrp/deref: Likewise. * tests/chgrp/no-x: Likewise. * tests/chgrp/posix-H: Likewise. * tests/chgrp/recurse: Likewise. * tests/cp/existing-perm-race: Likewise. * tests/Makefile.am (EXTRA_DIST): Remove group-names.
2008-05-06tests: hoist envvar-check so it is run for every testJim Meyering
I.e., also for Perl-based tests; not just the ones using test-lib.sh. * tests/check.mk (TESTS_ENVIRONMENT): Source envvar-check here, ... * tests/test-lib.sh: ...not here.
2008-04-27tests: move another file (expensive) into test-lib.shJim Meyering
* tests/expensive: Remove file. Move contents into ... * tests/test-lib.sh (expensive_): ...here. New function. * tests/du/fd-leak: Update caller to use the new function. * tests/mv/leak-fd: Likewise. * tests/rm/hash: Likewise. * tests/tail-2/big-4gb: Likewise. * tests/Makefile.am (EXTRA_DIST): Remove its name.
2008-04-21tests: convert umask-check to a functionJim Meyering
* tests/test-lib.sh (working_umask_or_skip_): New function, from... * tests/umask-check: ...here. Remove file. * tests/Makefile.am (EXTRA_DIST): Remove umask-check. * tests/mkdir/perm: Use the function rather than sourcing the file. * tests/cp/cp-parents: Likewise. * tests/cp/parent-perm: Likewise. Bruno Haible reported that parent-perm was failing to run umask-check.
2008-04-21Revamp test-related Makefiles.Jim Meyering
One side-effect of this change is that "make check" now works even if you put "." early in your shell's search PATH (don't do that!). Remove all test-related Makefile.am files, except those generated by mk-script. Instead, tests/Makefile.am now lists not only the tests directly under tests/, but also those in tests/*/ that are not generated by mk-script, e.g., cp/abuse, cp/acl, mv/i-1, etc. A lot of these changes are like this: -. $srcdir/../lang-default +. $top_srcdir/tests/lang-default -. $srcdir/../test-lib.sh +. $top_srcdir/tests/test-lib.sh * configure.ac (AC_CONFIG_FILES): Remove corresponding Makefiles. * tests/check.mk (vc_exe_in_TESTS): Relax syntax requirements. * tests/rwx-to-mode: Remove file. Rewritten as... * tests/test-lib.sh (rwx_to_mode_): ...this new function. * tests/Makefile.am (EXTRA_DIST): Remove rwx-to-mode. (SUBDIRS): Remove each dir with a removed Makefile.am. (EXTRA_DIST): Add $(TESTS). (TESTS): Add over 300 entries.
2008-04-14tests: don't fail on systems without a "stat" syscallJim Meyering
* tests/test-lib.sh (require_strace_): Add a syscall parameter. * tests/ls/stat-free-symlinks: Update caller. * tests/mv/atomic: Likewise. * tests/mv/atomic2: Likewise. Reported by Mike Frysinger in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13222
2008-04-01root tests: Set NON_ROOT_USERNAME if not set already.Jim Meyering
* tests/test-lib.sh (require_root_): This avoids failure of a couple of root-only tests that require a value for that envvar.
2008-03-28tests: Factor out code that's going to be reused.Pádraig Brady
* tests/test-lib.sh (mkfifo_or_skip_): New function, factored out of... * tests/touch/fifo: ...here.
2008-02-23Avoid test failures when root (/) is not readable.Jim Meyering
* tests/test-lib.sh (require_readable_root_): New function. * tests/misc/pwd-long: Skip this test when / is unreadable. * tests/du/slash: Likewise. This is required at least for Mandrake/Mandriva in "secure" mode. Reported by Theodoros V. Kalamatianos in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12800
2008-02-11tests: Migrate sourced strace file into a function, require_strace_.Jim Meyering
* tests/strace: Remove file. * tests/test-lib.sh (require_strace_): New function. * tests/mv/atomic: Use require_strace_, rather than ". strace". * tests/ls/stat-free-symlinks: Likewise. Peter Fales reported that stat-free-symlinks failed without strace.
2008-02-09tests: Remove priv-check. Use new require_root_ function instead.Jim Meyering
* tests/priv-check: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove priv-check. * tests/test-lib.sh (require_root_): New function. Use this function rather than sourcing the priv-check file. * tests/sample-test: Use require_root_ rather than priv-check. * tests/chown/basic: Likewise. * tests/cp/cp-a-selinux: Likewise. * tests/cp/preserve-gid: Likewise. * tests/cp/special-bits: Likewise. * tests/ls/nameless-uid: Likewise. * tests/misc/chcon: Likewise. * tests/mkdir/writable-under-readonly: Likewise. * tests/mv/sticky-to-xpart: Likewise. * tests/rm/fail-2eperm: Likewise. * tests/rm/no-give-up: Likewise. * tests/rm/one-file-system: Likewise. * tests/tail-2/append-only: Likewise. * tests/touch/now-owned-by-other: Likewise. * tests/rm/fail-eperm: Use skip_if_root_ rather than priv-check. * Makefile.maint (sc_root_tests): Reflect this change: search for the new function name.
2008-02-09tests: move the very-expensive file into test-lib.shJim Meyering
* tests/very-expensive: Remove file. * tests/test-lib.sh (very_expensive_): New function. * tests/Makefile.am (EXTRA_DIST): Remove very-expensive. * tests/cp/perm: Call the new function, rather than sourcing the file. * tests/tail-2/assert: Likewise. * tests/tail-2/assert-2: Likewise. * tests/du/2g: Likewise.
2008-02-09tests: start migrating sourced-file function-like tests into test-lib.sh.Jim Meyering
* tests/acl: Remove file. * tests/test-lib.sh (require_acl_): New function. * tests/cp/acl: Use require_acl_ instead. * tests/mv/acl: Likewise. * tests/Makefile.am (EXTRA_DIST): Remove acl.
2007-12-20Avoid another "make check" failure due to omitted programs.Jim Meyering
* tests/test-lib.sh (require_built_): New function. * tests/misc/groups-version: Use it to skip this test if either groups or id is not built.
2007-11-30Add quotes to protect against white space in build dir name.Ralf Wildenhues
* tests/check.mk (TESTS_ENVIRONMENT): Quote $(abs_srcdir). * tests/chmod/setgid: Quote absolute names. * tests/misc/help-version: Likewise. * tests/misc/pwd-unreadable-parent: Likewise. * tests/rmdir/ignore: Likewise. * tests/test-lib.sh: Likewise.
2007-11-01Use mktemp, not mkdtemp, to create test directories.Jim Meyering
* tests/test-lib.sh: Use the mktemp binary we've just built, not the mkdtemp script. * tests/mkdtemp: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove mkdtemp.
2007-11-01Make the new printf-surprise test more precise.Jim Meyering
* tests/test-lib.sh (require_ulimit_): New function. * tests/misc/printf-surprise: Use ulimit -v to trigger the fixed bug, and rather than checking printf's exit status (which would go wrong on FreeBSD 6.1, since their printf(3) function doesn't require lots of memory in this case) simply test whether it outputs the first 10 bytes.
2007-10-09Skip the chcon test on a system with no SELinux support.Jim Meyering
* tests/test-lib.sh (require_selinux_): New function. * tests/misc/chcon: Use it. * tests/misc/selinux: Use it here, too. * tests/cp/cp-a-selinux: and here. * tests/selinux: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove selinux. Reported by Mike Frysinger and Bauke Jan Douma.
2007-09-15More misc, test-related changes. (some to allow running tests as root)Jim Meyering