tests: improve robustness of immediate successes in screen tests

This commit is contained in:
Björn Linse
2017-06-26 14:49:15 +02:00
parent 8fd092f3ff
commit c8810a51a3
20 changed files with 314 additions and 147 deletions

View File

@@ -51,25 +51,20 @@ describe("shell command :!", function()
end)
it("throttles shell-command output greater than ~10KB", function()
if os.getenv("TRAVIS") and helpers.os_name() == "osx" then
pending("[Unreliable on Travis macOS.]", function() end)
return
end
screen.timeout = 20000 -- Avoid false failure on slow systems.
child_session.feed_data(
":!for i in $(seq 2 3000); do echo XXXXXXXXXX $i; done\n")
":!for i in $(seq 2 30000); do echo XXXXXXXXXX $i; done\n")
-- If we observe any line starting with a dot, then throttling occurred.
screen:expect{any="\n."}
-- Avoid false failure on slow systems.
screen:expect{any="\n%.", timeout=20000}
-- Final chunk of output should always be displayed, never skipped.
-- (Throttling is non-deterministic, this test is merely a sanity check.)
screen:expect([[
XXXXXXXXXX 2997 |
XXXXXXXXXX 2998 |
XXXXXXXXXX 2999 |
XXXXXXXXXX 3000 |
XXXXXXXXXX 29997 |
XXXXXXXXXX 29998 |
XXXXXXXXXX 29999 |
XXXXXXXXXX 30000 |
|
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |