summaryrefslogtreecommitdiff
path: root/test/lib/library.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/library.exp')
-rw-r--r--test/lib/library.exp58
1 files changed, 38 insertions, 20 deletions
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 97bede3b..1aebfa3e 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -879,34 +879,52 @@ proc start_interactive_test {} {
# @param string $prompt (optional) Bash prompt. Default is "/@"
proc sync_after_int {{prompt /@}} {
+ # Check for fast mode
+ global OPT_FAST_SYNC
+ set opt_fast 0
+ if {[info exists OPT_FAST_SYNC]} {
+ set opt_fast $OPT_FAST_SYNC
+ }
+
# expect_after will access the $test variable.
set test "Sync after INT"
# We synchronise in two steps.
-
- # First we send a text we hope is unique and swallow everything before it.
- set synctext "sync[expr int(rand() * 1000)]"
-
- # \005 is ^E; move to end of the line in emacs mode. This is required
- # because some tests use cmdline features and leave the 'cursor' in the
- # middle of a line
- send "\005$synctext"
-
- # Regexp `.*' causes `expect' to discard previous unknown output.
- # This is necessary if a completion doesn't match expectations.
- # For instance with `filetype_xspec' completion (e.g. `kdvi') if
- # one expects `.txt' as a completion (wrong, because it isn't
- # there), the unmatched completions need to be cleaned up.
- expect -re ".*$synctext$"
+ if {$opt_fast} {
+ # First we send a text we hope is unique and swallow everything before it.
+ set synctext "sync[expr int(rand() * 1000)]"
+
+ # \005 is ^E; move to end of the line in emacs mode. This is required
+ # because some tests use cmdline features and leave the 'cursor' in the
+ # middle of a line
+ send "\005$synctext"
+
+ # Regexp `.*' causes `expect' to discard previous unknown output.
+ # This is necessary if a completion doesn't match expectations.
+ # For instance with `filetype_xspec' completion (e.g. `kdvi') if
+ # one expects `.txt' as a completion (wrong, because it isn't
+ # there), the unmatched completions need to be cleaned up.
+ expect -re ".*$synctext$"
+ } else {
+ # Slow alternative is to sleep before sending an intrerrupt
+ sleep 0.1
+ }
# Then we send QUIT/INT and match the new prompt that shows up.
send \031\003;
- # Bash versions >4 will echo a ^C by default. This can be disabled in
- # inputrc starting from bash 4.1. This is not enough; we need to run tests
- # against bash-4.0 as well.
- # See http://www.mail-archive.com/bug-bash@gnu.org/msg07038.html
- expect -re "^(\\^C)?\\r\\n$prompt$"
+ if {$opt_fast} {
+ # Bash versions >4 will echo a ^C by default. This can be disabled in
+ # inputrc starting from bash 4.1. This is not enough; we need to run tests
+ # against bash-4.0 as well.
+ # See http://www.mail-archive.com/bug-bash@gnu.org/msg07038.html
+ expect -re "^(\\^C)?\\r\\n$prompt$"
+ } else {
+ # Slow alternative is to sleep and hope we don't match the first of
+ # two prompts
+ sleep 0.1
+ expect -re ".*$prompt$"
+ }
}