]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: tty-eof.pl: make fully table driven
authorPádraig Brady <P@draigBrady.com>
Thu, 9 Apr 2026 14:32:29 +0000 (15:32 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 9 Apr 2026 20:25:27 +0000 (21:25 +0100)
* tests/tty/tty-eof.pl: Remove command specific logic,
and adjust commands to support general input.
Also add cut -b, as cut_bytes has its own read loop.

tests/tty/tty-eof.pl

index 7cac3b5e2f9c61a91f73fc1f64fe4b305a43a68e..4820dafe8f123a9e91665bd13a998552e66c73f6 100755 (executable)
@@ -36,7 +36,6 @@ $@
     base64
     cat
     cksum
-    dd
     expand
     fmt
     fold
@@ -63,8 +62,13 @@ $@
     uniq
     wc
   );
-  my @commands = (@stdin_reading_commands, 'basenc --z85', 'cut -f2',
-                  'numfmt --invalid=ignore');
+  my @commands = (@stdin_reading_commands,
+   'basenc --z85',
+   'cut -d " " -f2',
+   'cut -b1-3',
+   'dd status=none',
+   'numfmt --invalid=ignore'
+  );
   my $stderr = 'tty-eof.err';
   foreach my $with_input (1, 0)
     {
@@ -82,7 +86,7 @@ $@
           my $found;
           if ($with_input)
             {
-              my $input = $cmd =~ /^cut/ ? "a\tb\n" : "a b\n";
+              my $input = "a b\n";
               my $echo = quotemeta $input;
               $echo =~ s/\n$//;
 
@@ -112,10 +116,6 @@ $@
                $fail=1;
           $exp->hard_close();
 
-          # dd normally writes to stderr.  If it exits successfully, we're done.
-          $cmd eq 'dd' && $s == 0
-            and next;
-
           if (-s $stderr)
             {
               warn "$ME: $cmd wrote to stderr ($mode):\n";