diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-12-25 02:21:11 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-12-25 02:30:05 +0000 |
commit | 3b7c9d1a31a183b903de9c1396a17b4ee64f09f8 (patch) | |
tree | f4b4532d1cae9d08fdfd5d52bd38c60981e59c77 | |
parent | 6894816c653adef54f3a85becbf75a865d6d39d6 (diff) | |
download | coreutils-3b7c9d1a31a183b903de9c1396a17b4ee64f09f8.tar.xz |
tests: fix error message check on some systems
http://hydra.nixos.org/build/18129583 identified (on OS X)
an incorrect test assumption in the previous commit.
* gl/lib/xdectoint.c (__xnumtoint): Suppress the EINVAL
error message as it's redundant in this context.
* tests/misc/tail.pl: Suppress _optionally_ appended
strerror messages.
* tests/fmt/base.pl: Likewise.
* tests/pr/pr-tests.pl: Likewise.
* tests/split/l-chunk.sh: Likewise.
-rw-r--r-- | gl/lib/xdectoint.c | 3 | ||||
-rwxr-xr-x | tests/fmt/base.pl | 9 | ||||
-rwxr-xr-x | tests/misc/tail.pl | 9 | ||||
-rwxr-xr-x | tests/pr/pr-tests.pl | 7 | ||||
-rwxr-xr-x | tests/split/l-chunk.sh | 2 |
5 files changed, 16 insertions, 14 deletions
diff --git a/gl/lib/xdectoint.c b/gl/lib/xdectoint.c index 2164d1ef4..9ca128130 100644 --- a/gl/lib/xdectoint.c +++ b/gl/lib/xdectoint.c @@ -65,7 +65,8 @@ __xnumtoint (const char *n_str, int base, __xdectoint_t min, __xdectoint_t max, if (s_err != LONGINT_OK) { - error (err_exit ? err_exit : EXIT_FAILURE, errno, + /* EINVAL error message is redundant in this context. */ + error (err_exit ? err_exit : EXIT_FAILURE, errno == EINVAL ? 0 : errno, "%s: %s", err, quote (n_str)); } diff --git a/tests/fmt/base.pl b/tests/fmt/base.pl index 8751119f1..e3e304034 100755 --- a/tests/fmt/base.pl +++ b/tests/fmt/base.pl @@ -19,6 +19,7 @@ use strict; (my $program_name = $0) =~ s|.*/||; +my $normalize_strerror = "s/': .*/'/"; my @Tests = ( @@ -26,11 +27,11 @@ my @Tests = {IN=> "ça\nçb\n"}, {OUT=>"ça b\n"}], ['wide-1', '-w 32768', - {ERR => "fmt: invalid width: '32768'"}, {EXIT => 1}, - {ERR_SUBST => 's/:[^:]*$//'}], + {ERR => "fmt: invalid width: '32768'\n"}, {EXIT => 1}, + {ERR_SUBST => $normalize_strerror}], ['wide-2', '-w 2147483647', - {ERR => "fmt: invalid width: '2147483647'"}, {EXIT => 1}, - {ERR_SUBST => 's/:[^:]*$//'}], + {ERR => "fmt: invalid width: '2147483647'\n"}, {EXIT => 1}, + {ERR_SUBST => $normalize_strerror}], ['bad-suffix', '-72x', {IN=> ''}, {ERR => "fmt: invalid width: '72x'\n"}, {EXIT => 1}], ['no-file', 'no-such-file', diff --git a/tests/misc/tail.pl b/tests/misc/tail.pl index adeff6857..f4522446a 100755 --- a/tests/misc/tail.pl +++ b/tests/misc/tail.pl @@ -19,7 +19,7 @@ use strict; my $prog = 'tail'; -my $normalize_strerror = 's/:[^:]*$//'; +my $normalize_strerror = "s/': .*/'/"; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -59,7 +59,7 @@ my @tv = ( "$prog: cannot open '+cl' for reading: No such file or directory\n"], ['err-2', '-cl', '', '', 1, - "$prog: invalid number of bytes: 'l'\n"], + "$prog: invalid number of bytes: 'l'\n", $normalize_strerror], ['err-3', '+2cz', '', '', 1, "$prog: cannot open '+2cz' for reading: No such file or directory\n"], @@ -72,9 +72,10 @@ my @tv = ( # the diagnostic: 'tail: 99999999999999999999: invalid number of bytes' # on all systems... probably, for now, maybe. ['err-5', '-c99999999999999999999', '', '', 1, - "$prog: invalid number of bytes: '99999999999999999999'", $normalize_strerror], + "$prog: invalid number of bytes: '99999999999999999999'\n", + $normalize_strerror], ['err-6', '-c --', '', '', 1, - "$prog: invalid number of bytes: '-'\n"], + "$prog: invalid number of bytes: '-'\n", $normalize_strerror], # Same as -n 10 ['minus-1', '-', '', '', 0], diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl index cc2ef38c4..04c21e388 100755 --- a/tests/pr/pr-tests.pl +++ b/tests/pr/pr-tests.pl @@ -22,6 +22,7 @@ use strict; @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; my $prog = 'pr'; +my $normalize_strerror = "s/': .*/'/"; my @tv = ( @@ -385,11 +386,9 @@ my @tv = ( ['col-long', '-W3 -t -1 --columns=2', "a\nb\nc\n", "a c\nb\n", 0], # Make sure these fail. ['col-0', '-0', '', '', 1, - "$prog: invalid number of columns: '0'", - 's/:[^:]*$//'], + "$prog: invalid number of columns: '0'\n", $normalize_strerror], ['col-inval', '-'.'9'x100, '', '', 1, - "$prog: invalid number of columns: '". ('9'x100) ."'", - 's/:[^:]*$//'], + "$prog: invalid number of columns: '". ('9'x100) ."'\n", $normalize_strerror], # Before coreutils-5.3.1, --pages=1:-1 would be treated like # --pages=1:18446744073709551615. diff --git a/tests/split/l-chunk.sh b/tests/split/l-chunk.sh index 39ee4dc03..000b527da 100755 --- a/tests/split/l-chunk.sh +++ b/tests/split/l-chunk.sh @@ -55,7 +55,7 @@ printf "%s" "$lines" | tr '~' '\n' > in || framework_failure_ echo "split: invalid chunk number: '16'" > exp split -n l/16/15 in 2>err.t && fail=1 -sed 's/:[^:]*$//' < err.t > err || framework_failure_ +sed "s/': .*/'/" < err.t > err || framework_failure_ compare exp err || fail=1 printf '%s' "\ |