tests: Try another strategy to check for immediate output.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 2 Nov 2023 01:41:57 +0000 (18:41 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 2 Nov 2023 01:41:57 +0000 (18:41 -0700)
The previous strategy hung on some machines and failed on others.  The
failures are sometimes sensitive to whether libreadline is available.  I
hope that this avoids the problem.

tests/ui/terminal/main.at

index 8a692017b7a4ae217af73937ff18b3e5692d3176..e62eefd3d865f00415f57f4a516d7bfc1de13fd7 100644 (file)
@@ -74,17 +74,11 @@ dnl Bug #63910 reported that command output was delayed until the
 dnl next command was supplied.  This checks for regression against
 dnl that bug.
 AT_SETUP([interactive output appears immediately])
-dnl The crucial thing to notice below is that the SHOW output
-dnl must appear before the prompt for FINISH.
-AT_CHECK([echo 'SHOW N.
-FINISH.' | PSPP_INTERACTIVE=1 pspp], [0], [stdout])
-AT_CHECK([sed -n 's/\r$//
-/^PSPP>/,$p' stdout], [0], [dnl
-PSPP> SHOW N.
-  Settings
-+-+-------+
-|N|Unknown|
-+-+-------+
-PSPP> FINISH.
+dnl This uses concatenation with + so that just printing the
+dnl command itself doesn't make "text string" appear in the
+dnl output.
+AT_CHECK([(echo 'ECHO "text"+" "+"string".'; sleep 10) | PSPP_INTERACTIVE=1 pspp & sleep 1; kill $!], [0], [stdout])
+cat stdout
+AT_CHECK([grep 'text string' stdout], [0], [text string
 ])
 AT_CLEANUP