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

Re: PATCH: completion tests



In article <200003011401.PAA27932@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> I couldn't test it with comptest, though, because that doesn't seem to 
> work for me, dunno where the problem is.

I found a timing problem in comptest.  The problem is reproducible on
Vine Linux --- Redhat based distribution mainly distributed in Japan.

When a child process on pty exits just after printing a string, zsh
may overlook the string.

This patch avoids the problem by sleeping a second before exit.

Index: Test/comptest
===================================================================
RCS file: /projects/zsh/zsh/Test/comptest,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 comptest
--- Test/comptest	2000/03/01 15:38:26	1.1.1.3
+++ Test/comptest	2000/03/01 17:05:26
@@ -54,6 +54,7 @@
 }
 finish () {
   print "<WIDGET><finish>"
+  sleep 1
   exit 0
 }
 zle -N expand-or-complete-with-report
@@ -68,14 +69,23 @@
 export PS1="<PROMPT>"
 zpty zsh "$zsh" -f
 
-zpty -r zsh log "*<PROMPT>*"
+zpty -r zsh log1 "*<PROMPT>*" || { 
+  print first prompt doesn\'t appered.
+  exit 1
+}
 
 zpty -w zsh ". $tmp"
-zpty -r zsh log "*<PROMPT>*"
+zpty -r zsh log2 "*<PROMPT>*" || {
+  print second prompt doesn\'t appered.
+  exit 1
+}
 rm $tmp
 
-zpty -w zsh "$input"$'\C-Z'
-zpty -r zsh log "*<WIDGET><finish>*"
+zpty -n -w zsh "$input"$'\C-Z'
+zpty -r zsh log "*<WIDGET><finish>*" || {
+  print finish widget doesn\'t invoked.
+  exit 1
+}
 
 if [[ -n "$debug" ]]; then
   print -lr - "$log" > /tmp/comptest.debug
Index: Test/53completion.ztst
===================================================================
RCS file: /projects/zsh/zsh/Test/53completion.ztst,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 53completion.ztst
--- Test/53completion.ztst	2000/02/29 15:51:21	1.1.1.1
+++ Test/53completion.ztst	2000/03/01 17:05:35
@@ -104,11 +104,11 @@
 >DESCRIPTION:{desc1}
 >NO:{arg1}
 
-# code='compdef _tst tst; _tst () { _arguments "-\+[opt]" }'
-# comptest -c "$code" $'tst -\C-D'
-#0:_arguments
-#>DESCRIPTION:{option}
-#>NO:{-+ -- opt}
+ code='compdef _tst tst; _tst () { _arguments "-\+[opt]" }'
+ comptest -c "$code" $'tst -\C-D'
+0:_arguments
+>DESCRIPTION:{option}
+>NO:{-+ -- opt}
 
  code='compdef _tst tst; _tst () { _arguments "1:desc1:(arg1)" }'
  comptest -c "$code" $'tst \t'
-- 
Tanaka Akira



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