diff options
author | Pádraig Brady <P@draigBrady.com> | 2023-04-11 13:02:21 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2023-04-14 00:02:22 +0100 |
commit | cf91b9d62cc936ae4942c1d5def0db448a2c8b25 (patch) | |
tree | d50acc46a3a080f2956a8904ac404b433fed471c /tests/misc | |
parent | daa1e4f55702e03e9bcf06d2d0906652fb1619b0 (diff) | |
download | coreutils-cf91b9d62cc936ae4942c1d5def0db448a2c8b25.tar.gz |
tests: tty-eof: fix various issues
* tests/misc/tty-eof.pl: Ensure we don't erroneously
skip commands with parameters.
Comment as to why cut(1) is treated differently.
Adjust expect calls to not wait needlessly for cut output.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/tty-eof.pl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/misc/tty-eof.pl b/tests/misc/tty-eof.pl index d429cbb8f..ad639189f 100755 --- a/tests/misc/tty-eof.pl +++ b/tests/misc/tty-eof.pl @@ -69,15 +69,19 @@ $@ { my $exp = new Expect; $exp->log_user(0); - $ENV{built_programs} =~ /\b$cmd\b/ || next; + my $cmd_name = (split(' ', $cmd))[0]; + $ENV{built_programs} =~ /\b$cmd_name\b/ || next; $exp->spawn("$cmd 2> $stderr") or (warn "$ME: cannot run '$cmd': $!\n"), $fail=1, next; - # No input for cut -f2. + # Test cut in a different mode, even though it supports the standard flow + # Ensure that it exits with no input as it used to not do so $cmd =~ /^cut/ or $exp->send("a b\n"); $exp->send("\cD"); # This is Control-D. FIXME: what if that's not EOF? - $exp->expect (0, '-re', "^a b\\r?\$"); - my $found = $exp->expect (1, '-re', "^.+\$"); + $cmd =~ /^cut/ + or $exp->expect (0, '-re', "^a b\\r?\$"); + $cmd =~ /^cut/ + or my $found = $exp->expect (1, '-re', "^.+\$"); $found and warn "F: $found: " . $exp->exp_match () . "\n"; $exp->expect(10, 'eof'); # Expect no output from cut, since we gave it no input. |