Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Commit 137b15a fails X02zlevi test



Bart wrote:
> I've been repeatedly running
> 
>     make check TESTNUM=X02
> 
> and have decided that it fails nondeterministically.  Sometimes the

On my desktop it never seems to fail. I just tried on my NAS box and
it appears to reliably fail there. I don't think the send-break is an
issue because the combination of kill-buffer and accept-line also
exhibit the problem. For the test to be relevant, it needed a new line.

The problem seems somewhat similar to the problems I have with Felix's
incremental search tests except that is failing more consistently for
me. I've attached my modified patch for them in case it provides you
with any clues. They seem to always fail on tests that would produce a
"failing bck-i-search". I'm fairly stuck on trying to understand that
too. Probably need to try to trace the zsh instance that's running under
zpty.

Oliver

diff --git a/Test/X01isearch.ztst b/Test/X01isearch.ztst
new file mode 100644
index 0000000..d683242
--- /dev/null
+++ b/Test/X01isearch.ztst
@@ -0,0 +1,167 @@
+%prep
+  if ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+    . $ZTST_srcdir/comptest
+    mkdir zle.tmp
+    cd zle.tmp
+    print -lr date 'echo xyz three' 'echo xyz two' 'echo 123 abc' \
+	'echo abc abcdef' 'echo abc' 'echo xyz' 'echo date' "echo '*OH NO*'" \
+	"echo '\n'" 'echo "*WHAT?*"' > historyX01
+    comptestinit -z $ZTST_testdir/../Src/zsh
+  else
+    ZTST_unimplemented="the zsh/zpty module is not available"
+  fi
+
+%test
+# Tests to add:
+#  case-insesitivity
+#  ignoring duplicate lines
+#  special keys
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabc'
+0q:Verify incremental search first match
+>echo <FG 2><BG 1>abc<FG 9><BG 9>
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabcd\C-H'
+0q:Verify incremental search first match via backspace
+>echo <FG 2><BG 1>abc<FG 9><BG 9>
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\n\C-Rabc\C-R'
+0q:Verify incremental search second match
+>echo abc <FG 2><BG 1>abc<FG 9><BG 9>def
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabc\C-R\C-R'
+0q:Verify incremental search third match
+>echo <FG 2><BG 1>abc<FG 9><BG 9> abcdef
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabc\C-R\C-R\C-R'
+0q:Verify incremental search fourth match
+>echo 123 <FG 2><BG 1>abc<FG 9><BG 9>
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabc\C-R\C-R\C-R\C-R'
+0q:Verify incremental search failed fifth match
+>echo 123 abc
+>failing bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabc\C-R\C-R\C-Rd'
+0q:Verify incremental search pass something
+>echo 123 abc
+>failing bck-i-search: abcd_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabc\C-R\C-R\C-Rd\C-H\C-H\C-Hd'
+0q:Verify incremental search pass, backup, and find again.
+>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
+>bck-i-search: abcd_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-Rabcd\C-T'
+0q:Verify incremental search pass, then use search forward to find.
+>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
+>fwd-i-search: abcd_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-R^date'
+0q:Verify incremental search bol pattern
+><FG 2><BG 1>date<FG 9><BG 9>
+>bck-i-search: ^date_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-R\\'
+0q:Verify incremental search backslash
+>echo '<FG 2><BG 1>\<FG 9><BG 9>n'
+>bck-i-search: \_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XR\\*'
+0q:Verify incremental search backslash star
+>echo "*WHAT?<FG 2><BG 1>*<FG 9><BG 9>"
+>bck-i-search: \*_
+
+############# incremental pattern search
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabc'
+0q:Verify incremental pattern search first match
+>echo <FG 2><BG 1>abc<FG 9><BG 9>
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabcd\C-H'
+0q:Verify incremental pattern search first match via backspace
+>echo <FG 2><BG 1>abc<FG 9><BG 9>
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\n\C-XRabc\C-XR'
+0q:Verify incremental pattern search second match
+>echo abc <FG 2><BG 1>abc<FG 9><BG 9>def
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabc\C-XR\C-XR'
+0q:Verify incremental pattern search third match
+>echo <FG 2><BG 1>abc<FG 9><BG 9> abcdef
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabc\C-XR\C-XR\C-XR'
+0q:Verify incremental pattern search fourth match
+>echo 123 <FG 2><BG 1>abc<FG 9><BG 9>
+>bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabc\C-XR\C-XR\C-XR\C-XR'
+0q:Verify incremental pattern search failed fifth match
+>echo 123 abc
+>failing bck-i-search: abc_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabc\C-XR\C-XR\C-XRd'
+0q:Verify incremental pattern search pass something
+>echo 123 abc
+>failing bck-i-search: abcd_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabc\C-XR\C-XR\C-XRd\C-H\C-H\C-Hd'
+0q:Verify incremental pattern search pass, backup, and find again.
+>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
+>bck-i-search: abcd_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XRabcd\C-XT'
+0q:Verify incremental pattern search pass, then use search forward to find.
+>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
+>fwd-i-search: abcd_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XR^date'
+0q:Verify incremental pattern search bol pattern
+><FG 2><BG 1>date<FG 9><BG 9>
+>bck-i-search: ^date_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XR\\'
+0q:Verify incremental pattern search backslash
+>echo '<FG 2><BG 1>\<FG 9><BG 9>n'
+>bck-i-search: \_
+
+ comptesteval 'fc -R historyX01'
+ termtest $'\C-XR\\*'
+0q:Verify incremental pattern search backslash star
+>echo "*WHAT?<FG 2><BG 1>*<FG 9><BG 9>"
+>bck-i-search: \*_
+
+%clean
+  zmodload -ui zsh/zpty
diff --git a/Test/comptest b/Test/comptest
index f1c5af0..8a11ca9 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -18,10 +18,10 @@ comptestinit () {
   done
   (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
 
-  export PS1="<PROMPT>"
+  export PS1="<PROMPT>" PS2="" RPS1="" RPS2=""
   zpty zsh "$comptest_zsh -f +Z"
 
-  zpty -r zsh log1 "*<PROMPT>*" || { 
+  zpty -r zsh log1 "*<PROMPT>*" || {
     print "first prompt hasn't appeared."
     return 1
   }
@@ -32,6 +32,7 @@ comptestinit () {
 "export ZDOTDIR=$ZTST_testdir" \
 "module_path=( $module_path )" \
 "fpath=( $fpath )" \
+"zle_highlight=(bg_start_code:'\<BG ' bg_end_code:'\>' fg_start_code:'\<FG ' fg_end_code:'\>' isearch:bg=1,fg=2)" \
 "bindkey -$comptest_keymap" \
 'LISTMAX=10000000
 stty 38400 columns 80 rows 24
@@ -62,6 +63,14 @@ list-choices-with-report () {
   zle clear-screen
   zle -R
 }
+tcfunc() {
+  if [[ -n $2 ]]; then
+    REPLY="<tc=$1,arg=$2>"
+  else
+    REPLY="<tc=$1>"
+  fi
+}
+zle -T tc tcfunc
 comp-finish () {
   print "<WIDGET><finish>"
   zle kill-whole-line
@@ -73,18 +82,30 @@ zle-finish () {
   (( region_active )) && print -lr "MARK: $MARK"
   zle -K main
   zle clear-screen
+  zle -R
   zle send-break
+}
+term-finish () {
+  zle kill-buffer
+  zle clear-screen
+  print "<finish>"
   zle -R
 }
 zle -N expand-or-complete-with-report
 zle -N list-choices-with-report
 zle -N comp-finish
+zle -N term-finish
 zle -N zle-finish
 bindkey "^I" expand-or-complete-with-report
 bindkey "^D" list-choices-with-report
-bindkey "^Z" comp-finish
-bindkey "^M" zle-finish
-bindkey -a "^M" zle-finish
+bindkey "^T" history-incremental-search-forward
+bindkey "^XR" history-incremental-pattern-search-backward
+bindkey "^XT" history-incremental-pattern-search-forward
+bindkey -r "^M"
+bindkey "^Mc" comp-finish
+bindkey "^Mt" term-finish
+bindkey "^Mz" zle-finish
+bindkey -a "^Mz" zle-finish
 '
 }
 
@@ -102,7 +123,7 @@ comptesteval () {
 
 comptest () {
   input="$*"
-  zpty -n -w zsh "$input"$'\C-Z'
+  zpty -n -w zsh "$input"$'\C-Mc'
   zpty -r -m zsh log "*<WIDGET><finish>*<PROMPT>*" || {
     print "failed to invoke finish widget."
     return 1
@@ -136,10 +157,26 @@ comptest () {
 
 zletest () {
   input="$*"
-  zpty -n -w zsh "$input"$'\C-M'
+  zpty -n -w zsh "$input"$'\C-Mz'
   zpty -r -m zsh log "*<WIDGET><finish>*<PROMPT>*" || {
     print "failed to invoke finish widget."
     return 1
   }
   print -lr "${(@)${(ps:\r\n:)log##*<WIDGET><finish>}[1,-2]}"
 }
+
+termtest () {
+  input="$*"
+  zpty -n -w zsh "$input"
+  # clear screen, to clear out control sequences
+  zpty -n -w zsh $'\C-L'
+  # send trailing output to scrape off.
+  zpty -n -w zsh $'\C-Mt\C-U'
+  zpty -r -m zsh log "*<finish>*<PROMPT>" || {
+    print "failed to invoke finish widget."
+    return 1
+  }
+  # there might be multiple <PROMPT>'s in log, grab the last one
+  # generated after the clear screen.
+  print -lr -- ${${(f)${log%%<finish>*}##*<PROMPT>}%%<tc=c?>*}
+}



Messages sorted by: Reverse Date, Date, Thread, Author