zsh-workers
 help / color / mirror / code / Atom feed
* Damn race conditions ...
@ 2014-03-16 21:15 Bart Schaefer
  2014-03-17 13:54 ` Jun T.
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2014-03-16 21:15 UTC (permalink / raw)
  To: zsh-workers

This is still happening sporadically:

*** /tmp/zsh.ztst.out.22780     Sun Mar 16 13:15:32 2014
--- /tmp/zsh.ztst.tout.22780    Sun Mar 16 13:15:32 2014
***************
*** 1,2 ****
! BUFFER: 123
! CURSOR: 2
--- 1,2 ----
! BUFFER: 12
! CURSOR: 1
Test ../../zsh-5.0/Test/X02zlevi.ztst failed: output differs from expected as shown above for:
  comptesteval 'bindkey -a "^K" redo'
  zletest $'123\C-_\e\C-k'
Was testing: undo in insert mode, redo in command
../../zsh-5.0/Test/X02zlevi.ztst: test failed.

Run it again immediately, and it works.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Damn race conditions ...
  2014-03-16 21:15 Damn race conditions Bart Schaefer
@ 2014-03-17 13:54 ` Jun T.
  2014-03-18  0:47   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Jun T. @ 2014-03-17 13:54 UTC (permalink / raw)
  To: zsh-workers

2014/03/17 06:15, Bart Schaefer <schaefer@brasslantern.com> wrote:

> This is still happening sporadically:

What OS (and hardware) are you using?
I'm not getting this on my Macs (10.8 and 10.9) an FreeBSD
and can't test any fix by myself.

What happens if you modify the test as follows (i.e., add a text
after 'redo') ?

(I guess you have already tried uncommenting all of zpty_flush)


diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index 60f878e..d81cf16 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -50,10 +50,10 @@
 >CURSOR: 1
 
   comptesteval 'bindkey -a "^K" redo'
-  zletest $'123\C-_\e\C-k'
+  zletest $'123\C-_\e\C-ka4'
 0:undo in insert mode, redo in command
->BUFFER: 123
->CURSOR: 2
+>BUFFER: 1234
+>CURSOR: 4
 
   comptesteval 'bindkey "^Y" redo'
   zletest $'pre\eA123\C-_\C-y\eu'


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Damn race conditions ...
  2014-03-17 13:54 ` Jun T.
@ 2014-03-18  0:47   ` Bart Schaefer
  2014-03-18  9:36     ` Jun T.
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2014-03-18  0:47 UTC (permalink / raw)
  To: zsh-workers

On Mar 17, 10:54pm, Jun T. wrote:
}
} 2014/03/17 06:15, Bart Schaefer <schaefer@brasslantern.com> wrote:
} 
} > This is still happening sporadically:
} 
} What OS (and hardware) are you using?

It's a 64bit virtualbox VM running 32bit CentOS 4.9.  Failed 16 out of
200 times when I ran it in a loop.  On the host hardware (quad-core
Intel i3, ubuntu 12.04.4) it failed only 1 out of 100.

  { repeat 100 make check TESTNUM=X02 } |& grep -c '[1-9] failure'

} (I guess you have already tried uncommenting all of zpty_flush)

You mean uncommenting the other 3 calls to zpty_flush?  Yes.  It
still fails sometimes (I didn't bother running the full hundreds
of passes).

} What happens if you modify the test as follows (i.e., add a text
} after 'redo') ?

Applied that patch, but still get occasional failure.

OF course it's not consistent WHERE it failes, so patching any one test
is not likely to help.  E.g., in this most recent try the failure is
here:

../../zsh-5.0/Test/X02zlevi.ztst: starting.
*** /tmp/zsh.ztst.out.30213     Mon Mar 17 17:44:32 2014
--- /tmp/zsh.ztst.tout.30213    Mon Mar 17 17:44:32 2014
***************
*** 1,2 ****
! BUFFER: binging
! CURSOR: 3
--- 1,3 ----
! BUFFER: ing
! ing
! CURSOR: 6
Test ../../zsh-5.0/Test/X02zlevi.ztst failed: output differs from expected as
shown above for:
  comptesteval 'setopt overstrike;print -z bung'
  zletest $'ing\e2|.'
Was testing: repeat initial edit with overstrike set
../../zsh-5.0/Test/X02zlevi.ztst: test failed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Damn race conditions ...
  2014-03-18  0:47   ` Bart Schaefer
@ 2014-03-18  9:36     ` Jun T.
  2014-03-18 17:06       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Jun T. @ 2014-03-18  9:36 UTC (permalink / raw)
  To: zsh-workers


On 2014/03/18, at 9:47, Bart Schaefer <schaefer@brasslantern.com> wrote:
> OF course it's not consistent WHERE it failes, so patching any one test
> is not likely to help.  E.g., in this most recent try the failure is
> here:

Are failures always at tests with comptesteval?

comptesteval uses '. $tmp' for executing commands in a
file $tmp by the slave zsh, but the '.' (or source)
would temporarily change the tty mode of the slave zsh
and may cause some trouble ...

It seems we can avoid using comptesteval as in the
patch below. Please git it a try.



diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index 60f878e..19188df 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -21,19 +21,19 @@
 >text
 >CURSOR: 8
 
-  comptesteval 'print -z before'
+  zpty_run 'print -z before'
   zletest $'after\e.'
 0:repeat initial edit with non-blank starting line
 >BUFFER: beforeafterafter
 >CURSOR: 15
 
-  comptesteval 'setopt overstrike;print -z bung'
+  zpty_run 'setopt overstrike;print -z bung'
   zletest $'ing\e2|.'
 0:repeat initial edit with overstrike set
 >BUFFER: binging
 >CURSOR: 3
 
-  comptesteval 'bindkey "^_" undo'
+  zpty_run 'bindkey "^_" undo'
   zletest $'undoc\037e'
 0:use of undo in vi insert mode
 >BUFFER: undoe
@@ -49,19 +49,19 @@
 >BUFFER: z
 >CURSOR: 1
 
-  comptesteval 'bindkey -a "^K" redo'
+  zpty_run 'bindkey -a "^K" redo'
   zletest $'123\C-_\e\C-k'
 0:undo in insert mode, redo in command
 >BUFFER: 123
 >CURSOR: 2
 
-  comptesteval 'bindkey "^Y" redo'
+  zpty_run 'bindkey "^Y" redo'
   zletest $'pre\eA123\C-_\C-y\eu'
 0:undo and redo in insert mode, undo in command
 >BUFFER: pre
 >CURSOR: 2
 
-  comptesteval 'bindkey "^Gu" split-undo'
+  zpty_run 'bindkey "^Gu" split-undo'
   zletest $'one\C-gutwo\eu'
 0:split the undo sequence
 >BUFFER: one
diff --git a/Test/comptest b/Test/comptest
index 48b6cdf..4655f3b 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -102,6 +102,14 @@ zpty_flush() {
   fi
 }
 
+zpty_run() {
+  zpty -w zsh "$*"
+  zpty -r -m zsh log "*<PROMPT>*" || {
+    print "prompt hasn't appeared."
+    return 1
+  }
+}
+
 comptesteval () {
   local tmp=/tmp/comptest.$$
 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Damn race conditions ...
  2014-03-18  9:36     ` Jun T.
@ 2014-03-18 17:06       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2014-03-18 17:06 UTC (permalink / raw)
  To: Jun T., zsh-workers@zsh.org 

On Mar 18,  6:36pm, Jun T. wrote:
}
} Are failures always at tests with comptesteval?

Yes, it seems so.

} It seems we can avoid using comptesteval as in the
} patch below. Please git it a try.

That seems to have done it.  200 runs without a single failure.

Thanks!

-- 
Barton E. Schaefer


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-18 17:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-16 21:15 Damn race conditions Bart Schaefer
2014-03-17 13:54 ` Jun T.
2014-03-18  0:47   ` Bart Schaefer
2014-03-18  9:36     ` Jun T.
2014-03-18 17:06       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).