summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2012-03-22ln: add the --relative optionHarald Hoyer
With the "--relative --symbolic" options, ln computes the relative symbolic link for the user. So, ln works just as cp, but creates relative symbolic links instead of copying the file. I miss this feature since the beginning of using ln. $ tree ./ / `-- usr |-- bin `-- lib `-- foo `-- foo 4 directories, 1 file $ ln -s -v --relative usr/lib/foo/foo usr/bin/foo ‘usr/bin/foo’ -> ‘../lib/foo/foo’ $ tree ./ / `-- usr |-- bin | `-- foo -> ../lib/foo/foo `-- lib `-- foo `-- foo 4 directories, 2 files $ ln -s -v --relative usr/bin/foo usr/lib/foo/link-to-foo ‘usr/lib/foo/link-to-foo’ -> ‘foo’ $ tree ./ / `-- usr |-- bin | `-- foo -> ../lib/foo/foo `-- lib `-- foo |-- link-to-foo -> foo `-- foo 4 directories, 3 files * src/Makefile.am: Reference the relpath module. * src/ln.c (usage): Mention the new option. (do_link): Call the relative conversion if specified. (convert_abs_rel): Perform the relative conversion using the relpath module. * tests/ln/relative: Add a new test. * tests/Makefile.am: Reference the new test. * doc/coreutils.texi: Document the new feature. * NEWS: Mention the new feature.
2012-03-20tests: avoid spurious misc/factor failure on OpenBSD 5.1Jim Meyering
* tests/misc/factor: Map OpenBSD 5.1's "unknown option" to our expected "invalid option". Reported by Bruno Haible.
2012-03-20tests: avoid spurious dd/sparse failurePádraig Brady
* tests/dd/sparse: Allow for greater variation in sparse-block counts. Reported by Nelson H. F. Beebe and Bruno Haible.
2012-03-17tests: fix sort-discrim to work without GMPPádraig Brady
* tests/misc/sort-discrim: The expr limit is intmax_t without GMP.
2012-03-16tests: avoid an ls-time false positive on Solaris 10Pádraig Brady
* tests/misc/ls-time: Force a ctime update as updating the atime doesn't update ctime on tmpfs on Solaris 10.
2012-03-15realpath: let --relative-to default to --relative-baseEric Blake
Most of the time, if someone wants to filter which paths are relative while leaving all others absolute, they also want to to the filtering based on the same --relative-to directory. Make this easier to specify. * src/realpath.c (main): Convert error to default. * doc/coreutils.texi (realpath invocation): Document this. * tests/misc/realpath: Adjust test to match. * NEWS: Document it.
2012-03-15tests: cover more realpath scenariosEric Blake
'realpath --relative-base --relative-to' is identical to --relative-base=--relative-to, so the test wasn't covering what it claimed. Expose recent fixes for handling of // on systems where // is distinct, and for --relative-base=/. Add test that exposes our design decision that --relative-base that is not a prefix of --relative-to is a no-op (if we later change behavior, we will also have to change that part of the test). * tests/misc/realpath: Fix typo. Add some tests.
2012-03-14test: expose recent gnulib canonicalize bugEric Blake
https://lists.gnu.org/archive/html/bug-gnulib/2012-02/msg00038.html detailed a couple of bugs in gnulib's canonicalize that were visible through coreutils' readlink, but only on systems where // is distinct from /. This particular test assumes the POSIX fix which requires canonicalization of a symlink containing just slashes to behave as if slashes separating the symlink from the rest of the name are elided (see http://austingroupbugs.net/view.php?id=541), as that is the only useful (and current) behavior on Cygwin. That is, ln -s / root ls root/dev must list the contents of /dev, not //dev. * tests/misc/readlink-root: New test. * tests/Makefile.am (TESTS): Run it.
2012-03-13tests: new discriminator-based test for sort -n and -hPaul Eggert
* tests/Makefile.am (TESTS): Add misc/sort-discrim. * tests/misc/sort-discrim: New file, which tests a discriminator-based implementation of 'sort'. Coreutils doesn't use this implementation yet, but the test is useful anyway. Co-authored-by: Drew Kutilek <dkutilek@ucla.edu> Co-authored-by: James Wendt <jwendt@cs.ucla.edu>
2012-03-10dirname: support more than one argumentJérémy Compostella
* src/dirname.c (main): Handle new -z option and manage more than one argument. * doc/coreutils.texi (dirname invocation): Mention it. * NEWS (New features): Mention it. * tests/misc/dirname: Add a two arguments test.
2012-03-10split: support an arbitrary number of split files by defaultJérémy Compostella
* src/split.c (next_file_name): If `suffix_auto' is true and the first suffix character is 'z', generate a new file file name adding `z' to the prefix and increasing the suffix length by one. (set_suffix_length): Disable auto suffix width in various cases. * tests/split/suffix-auto-length: Test it. * doc/coreutils.texi (split invocation): Mention it. * NEWS (Improvements): Likewise.
2012-03-08chmod: add notations +40, 00440, etc.Paul Eggert
* NEWS: Document this. * doc/perm.texi (Operator Numeric Modes): New section. (Numeric Modes, Directory Setuid and Setgid): Document new behavior. * src/chmod.c (usage): Document new behavior. (main): Support new options -0, -1, etc. * tests/chmod/setgid: Test these new features.
2012-03-08du: fix -x: don't ignore non-directory argumentsJim Meyering
Surprise! "du -x non-DIR" would print nothing. Note that the problem arises only when processing a non-directory specified on the command line. Not surprisingly, "du -x" still works as expected for any directory argument. When performing its same-file-system check, du may skip an entry only if it is at fts_level 1 or greater. Command-line arguments are at fts_level == 0 (FTS_ROOTLEVEL). * src/du.c (process_file): Don't use the top-level FTS->fts_dev when testing for --one-file-system (-x). It happens to be valid for directories, but it is always 0 for a non-directory. * tests/du/one-file-system: Add tests for this. * NEWS (Bug fixes): Mention it. Reported by Daniel Stavrovski in http://bugs.gnu.org/10967. Introduced by commit v8.14-95-gcfe1040.
2012-03-07basename: support more than one argumentJérémy Compostella
* src/basename.c (perform_basename): New function refactored from main() that performs the basename work on a STRING, optionally removes a trailing SUFFIX and outputs the result. (main): Handle new options. * doc/coreutils.texi (basename invocation): Mention new options. * test/misc/basename: Add new options test cases. * NEWS (New features): Mention it.
2012-03-02tests: work around a block alignment issue in dd/sparsePádraig Brady
Prompted by the continuous integration build failure at: http://hydra.nixos.org/build/2188210 (which uses XFS). * tests/dd/sparse (alloc_equal): Add a block allocation comparison function that accounts for variations due to alignment.
2012-02-29tests: compile and link shared object with $CC to make LD_PRELOAD workBernhard Voelker
* tests/ls/getxattr-speedup: Compile and link in one step with $CC. If the shared object file is created by ld (binutils), then the destructor print_call_count() may not run (seen on OpenSuSE 12.1). See http://lists.opensuse.org/opensuse/2012-02/msg01342.html Thanks to Cristian Rodríguez.
2012-02-29dd: add support for the conv=sparse optionRoman Rybalko
Notes: Small seeks are not coalesced to larger ones, like is done in cache_round() for example. conv= is used rather then oflag= for FreeBSD compatibility. * src/dd.c (final_op_was_seek): A new global boolean to flag whether the final "write" was converted to a seek. (usage): Describe the new conf=sparse option. (iwrite): Convert a write of a NUL block to a seek if requested. (do_copy): Initialize the output buffer to have a sentinel, to allow for efficient testing for NUL output blocks. If the last block in the file was converted to a seek, then convert back to a write so the size is updated. * NEWS: Mention the new feature. * tests/dd/sparse: A new test for the feature. * tests/Makefile.am: Reference the new test.
2012-02-26tests: fix help-version on cygwin, where $EXEEXT is nonemptyJim Meyering
* tests/misc/help-version: Remove the $EXEEXT suffix from each program name before comparing with a literal.
2012-02-26tests: remove unnecessary use of -lcBernhard Voelker
* tests/ls/getxattr-speedup: Remove unneeded use of -lc.
2012-02-20split: add the --additional-suffix optionJérémy Compostella
Add the --additional-suffix option, to append an additional static suffix to output file names. * src/split.c (next_file_name): Append suffix to output file names. (main): Handle new --additional-suffix option. * NEWS (New features): Mention it. * doc/coreutils.texi (split invocation): Mention it. * tests/split/additional-suffix: New file. Test --additional-suffix. * tests/Makefile.am (TESTS): Add it. Requested by Peng Yu, in bug 6554
2012-02-19tests: ls/getxattr-speedup: include <sys/types.h> for older headersJérémy Compostella
Modern <stdio.h> provides ssize_t, but the one from Debian's libc6-dev 2.11.2-10 apparently does not. * tests/ls/getxattr-speedup: Also include <sys/types.h>.
2012-02-18tests: test for ls speed-upJim Meyering
* tests/ls/getxattr-speedup: New test. * tests/Makefile.am (TESTS): Add it. Improved-by: Bernhard Voelker
2012-02-18split: support optional start value for --numeric-suffixesJérémy Compostella
Allow changing the --numeric-suffixes start number from the default of 0. * src/split.c (next_file_name): Initialize the suffix index and the output filename according to start value. (main): Check that the suffix length is large enough for the numerical suffix start value. * doc/coreutils.texi (split invocation): Mention it. * NEWS (New features): Mention it. * tests/split/numeric: New file. Test --numeric-suffixes[=FROM]. * tests/Makefile.am (TESTS): Reference the new test.
2012-02-13dd: fix issues in the count_bytes and seek_bytes flags changePádraig Brady
These edge cases were missed in the previous commit 140eca15c. * src/dd.c (main): Include the bytes slop when truncating without further I/O. Don't invalidate the whole file cache in the case where 0 < count < ibs. * tests/dd/bytes: Change to using the independent truncate command to generate the file for comparison. Remove a redundant test case and replace with one testing the truncation only logic.
2012-02-12dd: add count_bytes, skip_bytes and seek_bytes flagsJérémy Compostella
dd now accepts the count_bytes and skip_bytes input flag and the seek_bytes output flag, to more easily allow processing portions of a file. * src/dd.c (scanargs): Compute skip_records and skip_bytes when 'skip_bytes' iflag is used. Compute max_records and max_bytes when 'count_bytes' iflag is used. Compute seek_records and seek_bytes when 'seek_bytes' oflag is used. (skip_via_lseek): Use new 'bytes' parameter and handle potential 'records' equals to zero. Update the bytes parameter when called with 'fdesc' equal to STDOUT_FILENO. Update the header comments. (dd_copy): Skip accordingly to skip_records AND skip_bytes. Count accordingly to max_records AND max_bytes. Seek on output accordingly to seek_records AND seek_bytes. * NEWS (New features): Mention it. * doc/coreutils.texi (dd invocation): Detail new flags and behaviors. * tests/dd/bytes: New file. Tests for these new flags. * tests/Makefile.am (TESTS): Add it.
2012-02-12mv: "mv A B" would sometimes succeed, yet A would remain, ...Jim Meyering
But only when both A and B were hard links to the same symlink. * src/copy.c (same_file_ok): Handle another special case: the one in which we are moving a symlink onto a hard link to itself. In this case, we must explicitly tell the caller to unlink the source file. Otherwise, at least the linux-3.x kernel rename function would do nothing, as mandated by POSIX 2008. * tests/mv/symlink-onto-hardlink-to-self: New test. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. Reported by Bernhard Voelker in http://bugs.gnu.org/10686
2012-01-30mv: allow moving symlink onto same-inode dest with >= 2 hard linksJim Meyering
Normally, mv detects a few subtle cases in which proceeding with a same-file rename would, with very high probability, cause data loss. Here, we have found a corner case in which one of these same-inode tests makes mv refuse to perform a useful operation. Permit that corner case. * src/copy.c (same_file_ok): Detect/exempt this case. * tests/mv/symlink-onto-hardlink: New test. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. Initially reported by: Matt McCutchen in http://bugs.gnu.org/6960. Raised again by Anders Kaseorg due to http://bugs.debian.org/654596. Improved-by: Paul Eggert.
2012-01-27maint: use single copyright year rangeJim Meyering
Run "make update-copyright".
2012-01-25maint: cleanup an extraneous version output in a testPádraig Brady
* test/misc/stdbuf: Fixup the minor copy & paste issue introduced in commit ff7f0ff8
2012-01-25maint: use the standard require_perl_ functionPádraig Brady
* tests/cp/sparse-fiemap: Don't use a separate check.
2012-01-25realpath: remove extraneous '/' for --relative-to edge casesPádraig Brady
* src/realpath.c (path_common_prefix): Be consistent and always include a leading '/' in the count returned. (relpath): Account for the change in path_common_prefix() and avoid outputting extra '/' chars in relative paths that span the root dir. * tests/misc/realpath: Add the two reported cases. Reported by Mike Frysinger
2012-01-23tests: remove crufty test=test_name code from old testsJim Meyering
Before init.sh and similar, we would set test=test_name, and then construct temporary file names using $test. Now that each init.sh-using test is in its own directory, that practice is unwelcome. Remove bad examples. * tests/rm/f-1: Per above. * tests/rm/i-1: Likewise. * tests/rm/interactive-always: Likewise. * tests/rm/interactive-once: Likewise. * tests/rm/ir-1: Likewise. * tests/rm/r-1: Likewise.
2012-01-22maint: quote 'like this' or "like this", not `like this'Paul Eggert
* doc/coreutils.texi (Formatting the file names): coreutils now quotes 'like this'. * man/help2man: * src/timeout.c (usage): Quote 'like this' in diagnostics. * HACKING, Makefile.am, NEWS, README, README-hacking, TODO, cfg.mk: * doc/Makefile.am, doc/coreutils.texi, m4/jm-macros.m4: * man/Makefile.am, man/help2man, src/Makefile.am, src/copy.h: * src/extract-magic, src/ls.c, src/pinky.c, src/pr.c, src/sort.c: * src/split.c, src/timeout.c, src/who.c, tests/dd/skip-seek-past-file: * tests/pr/pr-tests: Quote 'like this' in commentary. * cfg.mk (old_NEWS_hash): Update due to changed old NEWS.
2012-01-09maint: adjust quoting: emit '...', not `...' in diagnosticsJim Meyering
* src/csplit.c (parse_repeat_count, extract_regexp): As above. * src/date.c (main): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (decode_one_format, main): Likewise. * src/pathchk.c (no_leading_hyphen): Likewise. * src/pr.c (main, getoptarg): Likewise. * src/rm.c (diagnose_leading_hyphen): Likewise. * src/sort.c (key_warnings, incompatible_options, main): Likewise. * src/stat.c (print_esc_char): Print '\x', not `\x' in diagnostic. * src/test.c (main): Likewise. * src/touch.c (main): Likewise. * src/tr.c (build_spec_list, validate, append_range): Likewise. * tests/misc/mktemp: This is an unusual case, since the affected string contains only the ` of an `...' string. So we change the long ` to a lone '. * tests/pr/pr-tests: Manual quote adapting fix-up. * tests/ln/hard-to-sym: Likewise. * tests/split/suffix-length: Likewise. * tests/mv/part-fail: Likewise. * tests/misc/chcon: Likewise. * tests/misc/stat-printf: Likewise.
2012-01-09tests: more automated quote adjustmentJim Meyering
Relax initial regexp to match more instances, but add a filter to avoid some invalid conversions. Run this: git grep -l "\`[^']*'" tests | xargs perl -pi -e '$q=q"'\''";' \ -e '$q="$q\\$q$q"; /(= ?\`|\`expr|\`echo|\Q$q\E)/ and next;' \ -e ' s/\`([^'\''"]*?'\'')/'\''$1/g' The last disjunct in the above (...) filter is to exempt any line that contains this string: '\'' With quoting like that, converting a ` to ' is likely to cause trouble, so we'll handle those manually. Here are three examples where the exemption is required: *': `link-to-dir/'\'': hard link not allowed for directory'*) ;; printf 'creating file `%s'\''\n' $f 'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
2012-01-09tests: change `...' to '...' on lines not matching /[=\$]/Jim Meyering
Exempt lines with '$' or '=', since those are prone to improper conversion. Run this: git grep -l "\`[^']*'" tests \ |xargs perl -pi -e '/[=\$]/ and next;s/\`([^'\''"]*?'\'')/'\''$1/g'
2012-01-09tests: adjust \`...' quoting to '...' to adapt to latest gnulibJim Meyering
Run this: git grep -l "\\\\\`[^']*'" tests \ |xargs perl -pi -e 's/\\\`(.*?'\'')/'\''$1/g
2012-01-07maint: update quoting of "Try `prog --help'" to "Try 'prog --help'"Jim Meyering
Automatically adjust both the source (now in only one place) and all tests that expect the resulting output via this: git grep -l 'Try.*--help' src/system.h tests \ | xargs perl -pi -e 's/Try \\?`(\S+ --help)/Try '\''$1/'
2012-01-06tests: adjust quoting in expected output to match new gnulib policyJim Meyering
* tests/misc/xstrtol: Use '...' to match new quoting in most places. However, leave `9x' to match the sole comparison against output from the quote function, which still uses `...'. * tests/misc/sort-merge: Likewise, though here I had to leave `...'-quoted output to match output from four tests. * tests/pr/pr-tests: Convert a single `...' to '...'. * gnulib: Update submodule to latest.
2012-01-05tests: avoid stty icanon issues on some platformsPádraig Brady
* tests/misc/stty: Exclude 'icanon' for the list to check, as it's problematic on ppc*|sparc* platforms.
2012-01-05tests: avoid ulimit issue on bash 3.2 on OS XPádraig Brady
* tests/misc/sort-continue: Perform the glob before the ulimit, as it was seen to make the glob fail on bash 3.2 on Mac OS X 10.6.8 at least.
2012-01-05tests: avoid a false positive due to overflow on Linux/HPPAPádraig Brady
* tests/misc/timeout-parameters: Verify that the timer doesn't fire immediately in the problematic range, and avoid overflow checks in that case. * man/timeout.x: Mention the possible bug. Reported by Bruno Haible
2012-01-05tests: adjust setfacl usage to accommodate Solaris 10Jim Meyering
* cfg.mk (sc_prohibit_short_facl_mode_spec): New rule. * tests/cp/acl: Extend setfacl mode spec to have length 3. * tests/ls/slink-acl: Likewise. * tests/mv/acl: Likewise. Report and analysis by Bruno Haible.
2012-01-05split: avoid failure due to leftover 'errno' valueBruno Haible
* src/split.c (lines_chunk_split): Fix logic bug that led to unwarranted failure of "split -n l/2 /dev/zero" on NetBSD 5.1. The same would happen when splitting a growing file, where open/lseek-end gives one size, but by the time we read, there is more data available. (bytes_chunk_extract): Likewise. * NEWS (Bug fixes): Mention this. * tests/split/l-chunk: The latter case was not exercised. Add code to do that. Bug introduced with the chunk-selecting feature in v8.7-25-gbe10739. Co-authored-by: Jim Meyering <meyering@redhat.com>
2012-01-03tests: adjust realpath test to avoid "make distcheck" failureJim Meyering
* tests/misc/realpath: Quote lhs of test ... = ..., so that when $PWD contains a space (like it does via "make distcheck"), the test does not fail
2012-01-03realpath: a new program to print the resolved pathPádraig Brady
This program is compatible with other realpath(1) implementations, and also incorporates relpath like support, through the --relative options. The relpath support was suggested by Peng Yu, who also provided an initial implemenation of that functionality. * AUTHORS: Add my name. * NEWS: Mention the new command. * README: Likewise. * doc/coreutils.texi (realpath invocation): Add realpath info. * man/Makefile.am (realpath.1): Add dependency. * man/realpath.x: New template. * man/.gitignore: Ignore generated man page. * po/POTFILES.in: Add src/realpath.c. * src/.gitignore: Exclude realpath. * src/Makefile.am (EXTRA_PROGRAMS): Add realpath. * src/realpath.c: New file. * scripts/git-hooks/commit-msg: Add realpath to the list of prefixes. * tests/Makefile.am (TESTS): Add misc/realpath. * tests/misc/realpath: New file.
2012-01-01tests: also print chmod's --versionJim Meyering
* tests/rm/many-dir-entries-vs-OOM: This test also exercises chmod.
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2012-01-01tests: change copyright year from 2011 to 2012 in sample-testJim Meyering
This file is special. We don't want to use a range, but merely the current year number. * tests/sample-test: s/2011/2012/
2011-12-31tests: fix a missing-dependency problemJim Meyering
* tests/check.mk (.built-programs): Depend on src/Makefile.am, so that when we add a program, this file is updated, and the new program is tested via misc/help-version. Spotted by Pádraig Brady.