From 78173cf541d03d5eba6a3f9a1a8a78014960a044 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 9 Dec 2020 17:52:17 +0100 Subject: [PATCH] tests/bind: Rationalize delays This increases a 100ms timeout to 200ms, because we've hit it on Github Actions: ``` INPUT 3904.65 ms (Line 223): set -g fish_escape_delay_ms 100\n OUTPUT +1.74 ms (Line 224): \rprompt 25> INPUT +0.71 ms (Line 230): echo abc def INPUT +0.57 ms (Line 231): \x1b INPUT +0.57 ms (Line 232): t\r OUTPUT +2.41 ms (Line 234): \r\ndef abc\r\n OUTPUT +1.63 ms (Line 234): \rprompt 26> INPUT +0.75 ms (Line 239): echo ghi jkl INPUT +0.57 ms (Line 240): \x1b INPUT +134.98 ms (Line 242): t\r ``` In other places it decreases sleeps where we just wait for a timeout to elapse, in which case we don't need much longer than the timeout. --- tests/pexpects/bind.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/pexpects/bind.py b/tests/pexpects/bind.py index 64779447c..7db4243da 100644 --- a/tests/pexpects/bind.py +++ b/tests/pexpects/bind.py @@ -47,7 +47,7 @@ expect_prompt("\r\njkl ghi\r\n") # occur and the "t" should become part of the text that is echoed. send("echo mno pqr") send("\033") -sleep(0.220) +sleep(0.250) send("t\r") # emacs transpose words, default timeout: long delay expect_prompt("\r\nmno pqrt\r\n") @@ -153,17 +153,17 @@ expect_prompt( ) # Verify that changing the escape timeout has an effect. -send("set -g fish_escape_delay_ms 200\r") +send("set -g fish_escape_delay_ms 100\r") expect_prompt() send("echo fail: lengthened escape timeout") send("\033") -sleep(0.350) +sleep(0.250) send("ddi") send("echo success: lengthened escape timeout\r") expect_prompt( "\r\nsuccess: lengthened escape timeout\r\n", - unmatched="vi replace line, 200ms timeout: long delay", + unmatched="vi replace line, 100ms timeout: long delay", ) # Verify that we don't switch to vi normal mode if we don't wait long enough @@ -175,7 +175,7 @@ send("ddi") send("inserted\r") expect_prompt( "\r\nfail: no normal modediinserted\r\n", - unmatched="vi replace line, 200ms timeout: short delay", + unmatched="vi replace line, 100ms timeout: short delay", ) # Now set it back to speed up the tests - these don't use any escape+thing bindings! @@ -193,11 +193,11 @@ expect_prompt("\r\nTENT\r\n", unmatched="Couldn't find expected output 'TENT'") # Test '~' (togglecase-char) send("\033") -sleep(0.200) +sleep(0.100) send("cc") sleep(0.01) send("echo some TExT\033") -sleep(0.200) +sleep(0.300) send("hh~~bbve~\r") expect_prompt("\r\nSOME TeXT\r\n", unmatched="Couldn't find expected output 'SOME TeXT") @@ -219,8 +219,7 @@ expect_prompt( unmatched="default-mode custom timeout not set correctly", ) -# Set it to 100ms. -sendline("set -g fish_escape_delay_ms 100") +sendline("set -g fish_escape_delay_ms 200") expect_prompt() # Verify the emacs transpose word (\et) behavior using various delays, @@ -230,9 +229,8 @@ expect_prompt() send("echo abc def") send("\033") send("t\r") -# emacs transpose words, 100ms timeout: no delay expect_prompt( - "\r\ndef abc\r\n", unmatched="emacs transpose words fail, 100ms timeout: no delay" + "\r\ndef abc\r\n", unmatched="emacs transpose words fail, 200ms timeout: no delay" ) # Same test as above but with a slight delay less than the escape timeout. @@ -240,10 +238,9 @@ send("echo ghi jkl") send("\033") sleep(0.020) send("t\r") -# emacs transpose words, 100ms timeout: short delay expect_prompt( "\r\njkl ghi\r\n", - unmatched="emacs transpose words fail, 100ms timeout: short delay", + unmatched="emacs transpose words fail, 200ms timeout: short delay", ) # Now test with a delay > the escape timeout. The transposition should not @@ -255,7 +252,7 @@ send("t\r") # emacs transpose words, 100ms timeout: long delay expect_prompt( "\r\nmno pqrt\r\n", - unmatched="emacs transpose words fail, 100ms timeout: long delay", + unmatched="emacs transpose words fail, 200ms timeout: long delay", ) # Verify special characters, such as \cV, are not intercepted by the kernel