41 Commits

Author SHA1 Message Date
Bernhard Voelker
04738593b4 find: add more -mount tests (check-root)
Add some more tests exercising bind mounts on the same device which
should not be affected by -mount or -xdev, and tests with a loopback
file system and a bind mount from there.

* tests/find/mount-vs-xdev-bind.sh: Add test.
* tests/find/mount-vs-xdev-other-fs.sh: Likewise.
* tests/local.mk (all_root_tests): Reference them.
2026-01-02 22:36:44 +01:00
Bernhard Voelker
0d8de87299 find: add -mount tests
* tests/find/mount-vs-xdev.sh: Add test.
* tests/local.mk (sh_tests): Reference it.
2026-01-02 22:36:42 +01:00
Bernhard Voelker
733bb9a054 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2026-01-02 11:46:15 +01:00
Bernhard Voelker
dc3365628e find: issue a warning for wrongly accepted operators like '-!'
In the current implementation, GNU find accepts the operators '!', ',',
'(' and ')' with a leading dash, e.g. '-!'.
Let's issue a warning to see if anyone relies on that odd behavior.
With a later release, let's fix the parser, and not accept these anymore.

* find/parser.c (find_parser): Issue a warning in the case one of the
above operators has been passed with a leading '-'.
* tests/find/operators-wrong-with-dash.sh: Add test.
* tests/local.mk (sh_tests): Reference it.
* NEWS (Changes in find): Mention the change in behavior.

Discussed at:
https://lists.gnu.org/r/bug-findutils/2025-03/msg00005.html
2025-03-23 23:47:15 +01:00
Bernhard Voelker
f1f6471ae8 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2025-01-04 11:43:53 +01:00
Bernhard Voelker
aff4e48c11 find: ignore more vanished subdirectories with -ignore_readdir_race
Similar to commit 889d001ab750 which handles vanished files better,
also fix the race for subdirectories (FTS_DNR).

Reproducer:
In average, the following produced 6-10 failures out of 1000 runs:
  $ mkdir testdir
  $ while :; do mkdir testdir/foo; rmdir testdir/foo; done &
  $ for f in $(seq 1000); do \
      find testdir -ignore_readdir_race -ls ; done >/dev/null
  find: 'testdir/foo': No such file or directory
  find: 'testdir/foo': No such file or directory

* find/ftsfind.c (consider_visiting): Return when FTS returned ENOENT
for FTS_DNR, i.e., unreadable directory, with -ignore_readdir_race.
* tests/find/readdir_race.sh: Add test.
* tests/local.mk (sh_tests): Reference it.
* NEWS (Bug Fixes): Amend and improve description of the previous fix.

See also https://savannah.gnu.org/bugs/?45930
2024-12-23 12:59:24 +01:00
James Youngman
1dcdf3de8e find: -exec is terminated by + only if the prior arg is exactly '{}'
A "+" only terminates -exec when it immediately follows an argument
which is exactly "{}" (and not, for example, "{}x").  This fixes
Savannah bug 66365.

* NEWS: explain this change.
* doc/find.texi: update one place which omitted the '{}' before '+'.
* find/parser.c (insert_exec_ok): consider + to be special ony if it
  follows an argument which is exactly '{}'.
* tests/find/sv-bug-66365-exec.sh: test for this bug.
* tests/local.mk: add the new test file.
2024-11-02 18:42:35 +00:00
James Youngman
457acfa06b Fix VPATH compilation failure for 'make check'
The libgnulib.a library isn't (necessarily) below $(top_srcdir), it's
below $(top_builddir).  This fixes a bug introduced in commit
85fc8966e5912390ad220d03b188dd319c85ed1e.
2024-10-31 15:29:07 +00:00
Collin Funk
85fc8966e5 tests: link binaries to gnulib
* tests/local.mk (AM_CPPFLAGS): Include gnulib headers.
(LDADD): Link to gnulib.

Copyright-paperwork-exempt: Yes
2024-06-24 14:35:55 +02:00
Bernhard Voelker
7daec5921e tests: re-introduce all_tests needed by syntax-check
The recent commit removed the variable 'all_tests' which is used by
sc_tests_list_consistency in cfg.mk.

* tests/local.mk (all_tests): Re-introduce and ...
(TESTS): ... use it here.
2024-06-01 17:04:21 +02:00
James Youngman
b25f15aad7 tests: don't distribute the tests/xargs/test-sigusr binary.
There is no NEWS item for this change since this test was introduced
since the previous release.
2024-05-30 20:24:34 +01:00
Bernhard Voelker
32132e9749 tests: avoid various syntax-check failures wrt/ test-sigusr
The syntax-check complains:
  $ make syntax-check -k
  ...
  maint.mk: the above files do not call bindtextdomain
  make: *** [maint.mk:869: sc_bindtextdomain] Error 1
  ...
  maint.mk: the above files do not include <config.h>
  make: *** [maint.mk:509: sc_require_config_h] Error 1
  ...
  maint.mk: use EXIT_* values rather than magic number
  make: *** [maint.mk:411: sc_prohibit_magic_number_exit] Error 1
  ...
  maint.mk: found unmarked diagnostic(s)
  make: *** [maint.mk:916: sc_unmarked_diagnostics] Error 1
  ...
  make: *** [cfg.mk:111: sc_tests_list_consistency] Error 1
  ...
  maint.mk: Please make test executable: tests/xargs/test-sigusr.c
  make: *** [cfg.mk:124: sc_tests_executable] Error 1

* cfg.mk (exclude_file_name_regexp--sc_bindtextdomain): Add test-sigusr.
(exclude_file_name_regexp--sc_unmarked_diagnostics): Define with the
pattern of the test-sigusr source file.
(sc_tests_list_consistency): Strip off ".c" suffix.
(sc_tests_executable): Exempt C source from this rule.
* tests/local.mk (TEST_EXTENSIONS): Add .c sources, needed also for
sc_tests_list_consistency to work.
* tests/xargs/test-sigusr.c (#include <config.h>): Add to avoid
sc_require_config_h failure.
(verify_signal_ignored): Call exit with EXIT_FAILURE instead of 1 to
avoid sc_prohibit_magic_number_exit failure.
(verify_signal_is_fatal): Likewise.
(verify_signal_is_nonfatal_with_p): Likewise.
* tests/.gitignore (/xargs/test-sigusr): While at it, add an entry
for the built test program here.
2024-05-20 13:57:53 +02:00
James Youngman
b560e3f911 [xargs] POSIX requires SIGUSR1/2 to be fatal if not blocked.
If the user uses -P we're not using only POSIX options, so in that
case it is OK to handle SIGUSR1/2.  Otherwise (without -P) don't
handle these signals, meaning that they could cause xargs to
terminate.

* xargs/xargs.c: set signal handlers for SIGUSR1 and SIGUSR2 only if
the -P option was used.  Warn if SIGUSR1 or SIGUSR2 is not defined.
* tests/xargs/test-sigusr: a new test for this.
* tests/local.mk: build and run the new test.
* NEWS: mention these changes.
2024-05-19 11:13:31 +01:00
Bernhard Voelker
ea1abfa968 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2024-01-02 09:13:29 +01:00
Bernhard Voelker
3008e19df8 find: allow -user,-group to accept larger integers beyond INT_MAX
The number parsing of integer arguments of the -user and -group option
was limited to INT_MAX, although the data types uid_t and gid_t are
larger on many systems, including x86_64 GNU/Linux.

* find/parser.c (UID_T_MAX, GID_T_MAX): Define.
(parse_group): Use xstrtoumax directly instead of safe_atoi, and check
the returned number vs. GID_T_MAX.  Simplify error handling.
While at it, fix the est_success_rate guessing.
(parse_user): Use xstrtoumax directly instead of safe_atoi, and check
the returned number vs. UID_T_MAX.
* find/getlimits.c: Add helper utility to determine platform-local
limits for uid_t and gid_t, based on 'getlimits' of GNU coreutils,
written by Padraig Brady.
* find/Makefile.am (noinst_PROGRAMS): Make 'getlimits' as such.
* cfg.mk (exclude_file_name_regexp--sc_bindtextdomain): Add getlimits.c.
* find/.gitignore (/getlimits): Add entry.
* tests/find/user-group-max.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* NEWS (Bug Fixes): Mention the fix.

Reported by Jocelyn Le Sage in
https://savannah.gnu.org/bugs/?64900
2023-12-30 21:01:15 +01:00
Bernhard Voelker
2841c3a82a find: diagnose NaN arguments better
The predicates -used, -amin, -cmin, -mmin, -atime, -ctime, and -mtime
dumped core via an assertion when passing a not-a-number argument.

* find/parser.c (isnan): Add define.
(get_relative_timestamp): Diagnose when the return value of xstrtod
is not-a-number.  Mention the missing parsers in the description of
the function.
* tests/find/arg-nan.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* NEWS (Improvements): Mention the improvement.

Reported by Jaehan Yoon in
https://savannah.gnu.org/bugs/?64717
2023-09-30 13:42:24 +02:00
Bernhard Voelker
4a72809272 find: fix error diagnostics of options with mandatory, numeric arguments
The error diagnostic for wrong invocations with option that require
numeric arguments (-inum, -links, -gid, -uid) was wrong and not helpful:
  $ find -gid
  find: invalid argument `-gid' to `-gid'

* find/parser.c (parse_gid): Remove changing back of the ARG_PTR in
the error case; thus simplify.
(parse_inum,parse_links,parse_uid): Likewise.
(get_num): While at it, mention -gid and -uid in the comment as well.
(insert_num): Also improve the error diagnostic in the case the user
has provided a non-numeric argument.  Previously, it was just "invalid
argument".
* tests/find/opt-numeric-arg.sh: Add test.
* tests/local.mk: Reference it.
* NEWS (Bug Fixes): Mention the fix.

Reported by Andreas Schwab <schwab@linux-m68k.org> in
<https://lists.gnu.org/r/bug-findutils/2023-01/msg00001.html>
2023-01-05 19:43:25 +01:00
Bernhard Voelker
73d020f472 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2023-01-01 23:51:15 +01:00
Shuiqing Zhou
3c2d824ef5 tests: add tests for the 'find -newer' family
* tests/find/newer.sh: Add to improve test coverage.
* tests/local.mk (all_tests): Reference the test.

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
Copyright-paperwork-exempt: Yes
2022-08-09 23:45:57 +02:00
Bernhard Voelker
6d2fa2c9a0 find: omit warning diagnostic for -name '/'
Although usually a pattern containing a directory separator does not match
anything, a pattern solely consisting of one '/' still does (and has to)
for the root directory "/".

* find/parser.c (check_name_arg): Omit the warning in the case the
given pattern equals "/".
find/find.1 (-name): Clarify better that the pattern "/" is valid to
match the "/" directory.
* init.cfg (find_emits_warnings_): Add utility function.
* tests/find/name-slash.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* MEWS (Bug Fixes): Mention the fix.

Fixes https://savannah.gnu.org/bugs/?62227
2022-04-24 13:35:49 +02:00
Bernhard Voelker
db5ec614a7 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
The format of the copyright year number range in Texinfo files is
"YEAR1--YEAR2" now, i.e., with 2x '-'.
* tests/sample-test: Adjust to use the single most recent year.
* All other files: Update copyright years via the above make run.
2022-01-02 18:42:35 +01:00
Bernhard Voelker
9290525c77 find: fix visiting of files with inode number Zero
On GNU/Hurd, the value 0 is a valid inode number, and is e.g. used
for /dev/console and /dev/tty.  The find(1) program aborted on this
platform when the user specified the -inum test and when the search
visited such a file.

  $ find /dev/null /dev/tty -inum 40799 -printf '%i:%p\n'
  40799:/dev/null
  find: util.c:330: get_info: Assertion `p->st_ino' failed.
  Aborted

Likewise, 'find -printf %i' aborted when hitting such a file.

* find/defs.h (get_info): Remove declaration.
* find/pred.c (pred_inum): Remove the redundant assert for ST_INO
as parse_inum sets need_inum=true which ensures that the inode number
is known.
* find/util.c (get_info): Declare static, and simplify: remove the
assertions for the inode number and file type.
While at it, add condition !state.have_stat in the need_stat case
for consistency.
* tests/find/inode-zero.sh: Add test.
* tests/local.mk (all_tests): Reference it.

Problem introduced by the inum optimisation in commit 2bf001636e6.

Reported by Andrea Monaco <andrea.monaco@autistici.org> in
https://lists.gnu.org/r/bug-findutils/2021-12/msg00008.html
2021-12-29 20:36:19 +01:00
Bernhard Voelker
5768a03ddf oldfind: remove
The FTS-based find is the default for a long time; oldfind has not been
installed since 4.5.18 (2015), and was only just used in tests.

* NEWS: Document the change.
* doc/find-maint.texi (Factor Out Repeated Code): Remove mentioning of
oldfind.
* find/.gitignore (/oldfind): Remove entry.
* find/Makefile.am (check_PROGRAMS): Remove.
(oldfind_SOURCES): Remove.
* find/defs.h (struct dir_id): Remove, it was only used in oldfind.c.
(symlink_handling): Likewise.
Adjust comments wrt oldfind otherwise.
* find/oldfind.c: Remove.
* find/testsuite/config/unix.exp: Remove the code to search for and
to run tests with oldfind.
* find/testsuite/find.posix/dotdotfiles.exp: Adjust comment.
* po/POTFILES.in (find/oldfind.c): Remove entry.
* tests/find/debug-missing-arg.sh: Remove run with oldfind.
* tests/find/exec-plus-last-file.sh: Likewise.
* tests/find/execdir-fd-leak.sh: Likewise.
* tests/find/many-dir-entries-vs-OOM.sh: Likewise.
* tests/find/name-lbracket-literal.sh: Likewise.
* tests/find/printf_escape_c.sh: Likewise.
* tests/find/printf_escapechars.sh: Likewise.
* tests/find/printf_inode.sh: Likewise.
* tests/find/refuse-noop.sh: Likewise.
* tests/find/type_list.sh: Likewise.
* tests/local.mk (built_programs): Remove oldfind from list.
2021-09-20 00:14:58 +02:00
Bernhard Voelker
11576f4e6a find: add -files0-from option
* bootstrap.conf (gnulib_modules): Add argv-iter and same-inode.
* find/defs.h (struct options): Add files0_from and ok_prompt_stdin
members.
* find/ftsfind.c (argv-iter.h, same-inode.h, xalloc.h): Add #include
for gnulib headers.
(process_all_startpoints): Change loop over starting point arguments
to a loop using the argv_iter gnulib module.
* find/parser.c (parse_table): Add option.
(parse_files0_from): Declare and define function.
(insert_exec_ok): Set options flag ok_prompt_stdin to true for
the -ok and -okdir action.
* find/util.c (usage): Add new option.
(set_option_defaults): Initialize new struct members.
* doc/find.texi (node Starting points): Add new section describing
the regular processing of starting points, and that with the new
option.  Also mention in the description of -ok and -okdir that they
conflict with the new option.
* find/find.1: Document the new option here as well.
* tests/find/files0-from.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* NEWS (New features in find): Mention the new option.
2021-05-08 14:13:36 +02:00
Andreas Metzler
ee402bdd3a xargs: warn on conflicting options -L, -I, -n
* xargs/xargs.c (warn_mutually_exclusive): Add function to output the
new warning diagnostic.
(main): Call the above new function in order to show a warning message
if conflicting options (-L -l -I -i -n) are specified.
* xargs/xargs.1: Explicitly document the fact that -L -l -I -i -n
options are mutually exclusive and how xargs behaves when more than one
of these options are specified.
* doc/find.texi (node Conflicting xargs options): Likewise, add this
section with examples.
* xargs/testsuite/config/unix.exp (xargs_start): Replace the full path
of the xargs executable in the stderr output file by its basename.
* xargs/testsuite/xargs.gnu/P3-n1-IARG.xe: Add file containing the
expected output with the new warning diagnostic.
* xargs/testsuite/xargs.posix/L2-n2.xe: Likewise.
* xargs/testsuite/xargs.posix/rc-123.xe: Likewise.
* xargs/testsuite/xargs.sysv/l1n4.xe: Likewise.
* xargs/testsuite/xargs/testsuite/xargs.gnu/P3-n1-IARG.exp: Ensure the
error diagnostic is in C locale to avoid false positives in other locales.
* xargs/testsuite/xargs.posix/L2-n2.exp: Likewise.
* xargs/testsuite/xargs.posix/rc-123.exp: Likewise.
* xargs/testsuite/xargs.sysv/l1n4.exp: Likewise.
* tests/xargs/conflicting_opts.sh: Add test coverage for combinations
of the mutually exclusive options -I -L and -n.
* xargs/testsuite/Makefile.am (EXTRA_DIST_EXP): Reference the new tests.
(EXTRA_DIST_XO): Reference the new *.xo files.
(EXTRA_DIST_XE): Reference the new *.xe files.
* NEWS (Improvements): Mention the change.

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>

Discussed at https://savannah.gnu.org/bugs/?52137
Duplicate of https://savannah.gnu.org/bugs/?58156
2021-01-07 18:28:00 +01:00
Bernhard Voelker
c5da48bcff maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
The format of the copyright year number range in Texinfo files is
"YEAR1--YEAR2" now, i.e., with 2x '-'.
* tests/sample-test: Likewise, here to avoid starting a year number range.
* All other files: Update copyright years via the above make run.
2021-01-02 01:46:51 +01:00
Bernhard Voelker
7642d172e1 find: fix -used predicate
* find/pred.c (pred_used): Reverse the check for the delta between
the atime and ctime of the file to accomodate to how pred_timewindow
is working.
Also return false if atime < ctime.
Bug introduced in FINDUTILS_4_3_3-1 in commit a4718831e17.
* tests/find/used.sh: Add test.
* tests/local.mk (all_tests): Reference the test.
* NEWS (Bug Fixes): Mention the fix.

Reported by Martin Schulte in
<https://lists.gnu.org/r/bug-findutils/2019-11/msg00010.html>
2020-04-22 19:35:13 +02:00
Bernhard Voelker
2f9fff9e1f tests: avoid FP when run as root
Test 'sv-bug-54171' produced a false-positive error as 'find' would
not fail for an unreadable directory when run as root.
Migrate the test to the newer shell-based tests, and add the
'skip_if_root_' guard to avoid a false-positive.

* find/testsuite/find.posix/sv-bug-54171.exp: Remove.
* find/testsuite/find.posix/sv-bug-54171.xo: Remove.
* find/testsuite/Makefile.am (EXTRA_DIST_XO, EXTRA_DIST_EXP): Remove the
above deleted test.
* tests/find/depth-unreadable-dir.sh: Add test.
* tests/local.mk (all_tests): Reference it.

Test FP introduced in commit v4.6.0-178-gdf4610d0.
Fixes https://savannah.gnu.org/bugs/?57762
and https://bugzilla.redhat.com/1799064
2020-02-10 18:54:40 +01:00
Bernhard Voelker
f7ea96d2b8 maint: update copyright year number ranges
Run 'make update-copyright'.

* lib/regexprops.c (copying): Update the year number manually.
* tests/sample-test: Likewise, here to avoid starting a year number range.
* All other files: Update copyright years via the above make run.
2020-01-01 16:22:52 +01:00
Bernhard Voelker
eeefd1dc72 xargs: in -t,-p output, quote the command to be executed when needed
To improve readability for the user, xargs(1) shall quote each part
of the command to be executed when printing it to stderr, i.e. for
the -t (--verbose) and -p (--interactive) options.  Example:
  $ echo "some file" | ../xargs -p -I'{}' rm '{}.c' '{}.o'
  rm 'some file.c' 'some file.o' ?...

* xargs/xargs.c (print_args): Apply "shell-escape" quoting.
* xargs/testsuite/xargs.gnu/space-t-0.xe: Adjust test.
* tests/xargs/verbose-quote.sh: Add test.
* tests/local.mk: Reference it.
* README (Improvements): Mention the change.
2019-07-29 08:44:29 +02:00
Bernhard Voelker
b9604dc2b2 tests: migrate 'type_list' to the new testsuite
Make this test a "check-root" test to increase test coverage.
This test runs for non-privileged users as well, but skips the tests
for block and character devices as mknod(1) will fail with EPERM.

* find/testsuite/test_type-list.sh: Move to ...
* tests/find/type_list.sh: ... this, and apply the above.
Simplify, and make more robust.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_root_tests): ... and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
8b1bb60543 tests: migrate 'debug-missing-arg' to the new testsuite
* find/testsuite/sv-52220.sh: Move to ...
* tests/find/debug-missing-arg.sh: ... this, and apply the above.
Simplify, and make more robust.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
fb99de8a29 tests: migrate 'refuse-noop' to the new testsuite
* find/testsuite/sv-48180-refuse-noop.sh: Move to ...
* tests/find/refuse-noop.sh: ... this, and apply the above.
Simplify, and make more robust.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
dbc218f5f5 tests: migrate 'exec-plus-last-file' to the new testsuite
* find/testsuite/sv-48030-exec-plus-bug.sh: Move to ...
* tests/find/exec-plus-last-file.sh: ... this, and apply the above.
Simplify, and make more robust.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
1027613d0f tests: migrate 'execdir-fd-leak' to the new testsuite
* find/testsuite/sv-34976-execdir-fd-leak.sh: Move to ...
* tests/find/execdir-fd-leak.sh: ... this, and apply the above.
Simplify, and make more robust.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
c809ce8fa2 tests: migrate 'printf_inode' to the new testsuite
* find/testsuite/test_inode.sh: Move to ...
* tests/find/printf_inode.sh: ... this, and apply the above.  Simplify.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
1cc45855e5 tests: migrate 'printf_escape_c' to the new testsuite
* find/testsuite/test_escape_c.sh: Move to ...
* tests/find/printf_escape_c.sh: ... this, and apply the above.  Simplify.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
3f6b28c4fb tests: migrate test 'printf_escapechars' to the new testsuite
For migrating, merge with the basic structure from 'tests/sample-test',
i.e., source in 'tests/init.sh', call 'print_ver_', "Exit $fail",  etc.
Also remove now-common functions like die() and framework_failure_().

* find/testsuite/test_escapechars.golden: Remove, as the axpected output
is created on the fly by the new test.
* find/testsuite/test_escapechars.sh: Move to ...
* tests/find/printf_escapechars.sh: ... this, and apply the above.
Create the expected output on the fly, and also check for the expected
error diagnostic on stderr.
* find/testsuite/Makefile.am (EXTRA_DIST_GOLDEN): Remove.
(EXTRA_DIST): Remove $(EXTRA_DIST_GOLDEN).
(tests_shell_progs): Remove the reference to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
77df15aa8b tests: migrate 'name-lbracket-literal' to the new testsuite
For migrating, merge with the basic structure from 'tests/sample-test',
i.e., source in 'tests/init.sh', call 'print_ver_', "Exit $fail",  etc.
Also remove now-common functions like die() and framework_failure_().

* find/testsuite/sv-bug-32043.sh: Move to ...
* tests/find/name-lbracket-literal.sh: ... this, and apply the above.
Simplify.
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.
2019-01-09 00:24:34 +01:00
Bernhard Voelker
8a2f24d5ff tests: migrate 'many-dir-entries-vs-OOM' to the new testsuite
For migrating, merge with the basic structure from 'tests/sample-test',
i.e., source in 'tests/init.sh', call 'print_ver_', "Exit $fail",  etc.
Also remove now-common functions like die() and framework_failure_().

* find/testsuite/sv-34079.sh: Move to ...
* tests/find/many-dir-entries-vs-OOM.sh: ... this, and apply the above.
While at it, loosely pull in changes from the related test in the
GNU coreutils [1]:
Create only 200,000 files, rather than 4 million.  The latter was overkill,
and was too likely to fail due to inode exhaustion.  Now that this test
doesn't take so long, label it as merely "expensive", rather than
"very expensive".
Furthermore, simplify the test data creation, and use the ulimit specifically
for each program under test (find, oldfind).
* find/testsuite/Makefile.am (tests_shell_progs): Remove the reference
to this test ...
* tests/local.mk (all_tests): .. and add it here.

[1]
https://git.sv.gnu.org/cgit/coreutils.git/tree/tests/rm/many-dir-entries-vs-OOM.sh?id=4711c49312d5
2019-01-09 00:24:34 +01:00
Bernhard Voelker
f72b299cdd tests: add shell-style test framework
Borrow the 'tests' framework from GNU coreutils.  This allows better
shell-style tests with more control over stdin, stdout, stderr, signals,
preparatory steps, cleanup, return code verification, root-only tests,
etc.

* .gitignore: Add entries for per-test *.log and *.trs files, and the
'test-suite.log'.
* .x-update-copyright: Exempt 'tests/init.sh' as this comes from gnulib.
* Makefile.am: Include 'tests/local.mk'.
(EXTRA_DIST): Add 'tests/GNUmakefile'.
(SUBDIRS): Move 'gnulib-tests' to the end, i.e., run our own tests first.
(ALL_RECURSIVE_TARGETS): Initialize.
(update-gnulib-to-latest): Copy 'tests/init.sh' from gnulib.
* cfg.mk: Add some syntax-check rules.
* init.cfg: Add file.
* tests/GNUmakefile: Likewise.
* tests/envvar-check: Likewise.
* tests/init.sh: Likewise.
* tests/lang-default: Likewise.
* tests/local.mk: Likewise.
* tests/misc/help-version.sh: Likewise.
* tests/other-fs-tmpdir: Likewise.
* tests/sample-test: Likewise.
* tests/.gitignore: Likewise.
* NEWS (Changes to the build process): Mention the new test framework.
2019-01-09 00:24:34 +01:00