]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure due to varied ERANGE errors
authorPádraig Brady <P@draigBrady.com>
Mon, 30 Jun 2025 22:28:32 +0000 (23:28 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 30 Jun 2025 23:03:30 +0000 (00:03 +0100)
* tests/od/od.pl: Use the system error string for ERANGE,
rather than hardcoding a particular one.
Fixes https://bugs.gnu.org/78934

tests/od/od.pl

index e4e328ad6802f83bc5885dacf9e9a8065e0a7887..40cc4289ac14d03db84e8c1a6cf0e73386340f4d 100755 (executable)
@@ -25,6 +25,9 @@ use strict;
 
 my $prog = 'od';
 
+use Errno qw(ERANGE);
+my $ERANGE = do { local $! = ERANGE; "$!" };
+
 # Use a file in /proc whose size is not likely to
 # change between the wc and od invocations.
 my $proc_file = '/proc/version';
@@ -76,11 +79,11 @@ my @Tests =
 
      # Overflowing traditional offsets should be diagnosed.
      ['overflow-off-1', '-', '7' x 255, {IN_PIPE=>""}, {EXIT=>1},
-      {ERR=>"od: ".('7' x 255).": Numerical result out of range\n"}],
+      {ERR=>"od: ".('7' x 255).": $ERANGE\n"}],
      ['overflow-off-2', '-', ('9' x 254).'.', {IN_PIPE=>""}, {EXIT=>1},
-      {ERR=>"od: ".('9' x 254).".: Numerical result out of range\n"}],
+      {ERR=>"od: ".('9' x 254).".: $ERANGE\n"}],
      ['overflow-off-3', '-', '0x'.('f' x 253), {IN_PIPE=>""}, {EXIT=>1},
-      {ERR=>"od: 0x".('f' x 253).": Numerical result out of range\n"}],
+      {ERR=>"od: 0x".('f' x 253).": $ERANGE\n"}],
 
      # Ensure that a large width does not cause trouble.
      # From coreutils-7.0 through coreutils-8.21, these would print