Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] testsuite: Fix racy gdb.mi/mi-nsthrexec.exp FAIL
@ 2009-06-30 18:23 Jan Kratochvil
  2009-06-30 19:36 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2009-06-30 18:23 UTC (permalink / raw)
  To: gdb-patches

Hi,

seen the dump below for unstable results for:
	gdb.mi/mi-nsthrexec.exp: thread state, all stopped

the general .* match just aligns the function to existing get_mi_thread_list or
check_mi_and_console_threads expect strings.


Thanks,
Jan


@@ -59880,10 +59843,9 @@ Expecting: ^(-thread-info[
 ]+[(]gdb[)] 
 [ ]*)
 -thread-info
-~"Current language:  auto; currently asm\n"
-^done,threads=[{id="2",target-id="Thread 0x7f2462b8d910 (LWP 9535)",frame={level="0",addr="0x0000000000400668",func="thread_execler",args=[{name="arg",value="0x0"}],file="../.././gdb/testsuite/gdb.mi/nsthrexec.c",fullname="/home/jkratoch/redhat/gdb-master/gdb/testsuite/gdb.mi/nsthrexec.c",line="28"},state="stopped"},{id="1",target-id="Thread 0x7f24635a56f0 (LWP 9296)",frame={level="0",addr="0x00007f246318da7f",func="__lll_unlock_wake_private",args=[],file="../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S",fullname="/usr/src/debug/glibc-20090510T1842/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S",line="336"},state="stopped"}],current-thread-id="1"
+^done,threads=[{id="2",target-id="Thread 0x7f327a926910 (LWP 14350)",frame={level="0",addr="0x0000000000400668",func="thread_execler",args=[{name="arg",value="0x0"}],file="../.././gdb/testsuite/gdb.mi/nsthrexec.c",fullname="/home/jkratoch/redhat/gdb-master/gdb/testsuite/gdb.mi/nsthrexec.c",line="28"},state="stopped"},{id="1",target-id="Thread 0x7f327b33e6f0 (LWP 14301)",frame={level="0",addr="0x00007f327af20b0d",func="pthread_join",args=[{name="threadid",value="139854781507856"},{name="thread_return",value="0x0"}],file="pthread_join.c",fullname="/usr/src/debug/glibc-20090510T1842/nptl/pthread_join.c",line="89"},state="stopped"}],current-thread-id="1"
 (gdb)  
-FAIL: gdb.mi/mi-nsthrexec.exp: thread state, all stopped
+PASS: gdb.mi/mi-nsthrexec.exp: thread state, all stopped
 102-break-delete
 102^done
 (gdb) 


gdb/testsuite/
2009-06-30  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/mi-support.exp (mi_check_thread_states): Permit any output before
	the expected result record.

--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1808,7 +1808,7 @@ proc mi_reverse_list { list } {
 proc mi_check_thread_states { xstates test } {
     global expect_out
     set states [mi_reverse_list $xstates]
-    set pattern "\\^done,threads=\\\["
+    set pattern ".*\\^done,threads=\\\["
     foreach s $states {
 	set pattern "${pattern}(.*)state=\"$s\""
     }


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

* Re: [patch] testsuite: Fix racy gdb.mi/mi-nsthrexec.exp FAIL
  2009-06-30 18:23 [patch] testsuite: Fix racy gdb.mi/mi-nsthrexec.exp FAIL Jan Kratochvil
@ 2009-06-30 19:36 ` Pedro Alves
  2009-06-30 20:28   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2009-06-30 19:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Kratochvil

On Tuesday 30 June 2009 19:23:34, Jan Kratochvil wrote:

> @@ -59880,10 +59843,9 @@ Expecting: ^(-thread-info[
>  ]+[(]gdb[)] 
>  [ ]*)
>  -thread-info
> -~"Current language:  auto; currently asm\n"

Usually, I'd like to understand what causes these racy
issues, or where the output is being produced, since these issues
can easily be caused by real bug.  Non-stop is naturally harder
to test.

This must be from the language_info call in inf-loop.c, that
is always called when something stops.  In light of non-stop mode,
this is a weird place to output this (and to change expected
language) --- the thread that just stopped may not be the
current thread.  To be clear, I'm not expecting you to fix it,
just pointing it out.  :-)

> -^done,threads=[{id="2",target-id="Thread 0x7f2462b8d910 (LWP 9535)",frame={level="0",addr="0x0000000000400668",func="thread_execler",args=[{name="arg",value="0x0"}],file="../.././gdb/testsuite/gdb.mi/nsthrexec.c",fullname="/home/jkratoch/redhat/gdb-master/gdb/testsuite/gdb.mi/nsthrexec.c",line="28"},state="stopped"},{id="1",target-id="Thread 0x7f24635a56f0 (LWP 9296)",frame={level="0",addr="0x00007f246318da7f",func="__lll_unlock_wake_private",args=[],file="../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S",fullname="/usr/src/debug/glibc-20090510T1842/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S",line="336"},state="stopped"}],current-thread-id="1"
> +^done,threads=[{id="2",target-id="Thread 0x7f327a926910 (LWP 14350)",frame={level="0",addr="0x0000000000400668",func="thread_execler",args=[{name="arg",value="0x0"}],file="../.././gdb/testsuite/gdb.mi/nsthrexec.c",fullname="/home/jkratoch/redhat/gdb-master/gdb/testsuite/gdb.mi/nsthrexec.c",line="28"},state="stopped"},{id="1",target-id="Thread 0x7f327b33e6f0 (LWP 14301)",frame={level="0",addr="0x00007f327af20b0d",func="pthread_join",args=[{name="threadid",value="139854781507856"},{name="thread_return",value="0x0"}],file="pthread_join.c",fullname="/usr/src/debug/glibc-20090510T1842/nptl/pthread_join.c",line="89"},state="stopped"}],current-thread-id="1"
>  (gdb)  
> -FAIL: gdb.mi/mi-nsthrexec.exp: thread state, all stopped
> +PASS: gdb.mi/mi-nsthrexec.exp: thread state, all stopped
>  102-break-delete
>  102^done
>  (gdb) 



> the general .* match just aligns the function to existing get_mi_thread_list or
> check_mi_and_console_threads expect strings.

A parenthesis just to raise global awareness, not really applicable to
your case:  In general, this is not a good argument for non-stop mode
testsuite patches.  Other testsuite code may be using racy .*'s simply because
it is not being exercised in non-stop mode (we had to remove a bunch of
those before, tightening the expected strings up), which naturally is
more susceptible to racy issues, but also due to the fact that in many
cases there's no prompt to firmly pedal on.  In this case, we do want
to ignore any previous output though.  So...

> gdb/testsuite/
> 2009-06-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* lib/mi-support.exp (mi_check_thread_states): Permit any output before
> 	the expected result record.

... Ok.

-- 
Pedro Alves


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

* Re: [patch] testsuite: Fix racy gdb.mi/mi-nsthrexec.exp FAIL
  2009-06-30 19:36 ` Pedro Alves
@ 2009-06-30 20:28   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2009-06-30 20:28 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Tue, 30 Jun 2009 21:37:50 +0200, Pedro Alves wrote:
> On Tuesday 30 June 2009 19:23:34, Jan Kratochvil wrote:
> 
> > @@ -59880,10 +59843,9 @@ Expecting: ^(-thread-info[
> >  ]+[(]gdb[)] 
> >  [ ]*)
> >  -thread-info
> > -~"Current language:  auto; currently asm\n"
[...]
> This must be from the language_info call in inf-loop.c, that
> is always called when something stops.  In light of non-stop mode,
> this is a weird place to output this (and to change expected
> language) --- the thread that just stopped may not be the
> current thread.

Understood, admitting I did not found this point out.


> Other testsuite code may be using racy .*'s simply because
> it is not being exercised in non-stop mode (we had to remove a bunch of
> those before, tightening the expected strings up),

OK, thanks for the notice to be aware of it.


> ... Ok.

Checked-in:
	http://sourceware.org/ml/gdb-cvs/2009-06/msg00204.html



Thanks for the review,
Jan


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

end of thread, other threads:[~2009-06-30 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-30 18:23 [patch] testsuite: Fix racy gdb.mi/mi-nsthrexec.exp FAIL Jan Kratochvil
2009-06-30 19:36 ` Pedro Alves
2009-06-30 20:28   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox