Re: [RFC/RFA] testsuite/gdb.base/watch_thread_num.exp: Fix test for systems having hidden threads

'Daniel Jacobowitz'
2007-12-19T14:04:21Z

On Wed, Dec 19, 2007 at 01:59:13PM +0100, Pierre Muller wrote:
> This test currently fails on cygwin target
> and it does by timeout's which means that it takes a lot of time...
> The reason of the failure is that
> thread #2 is a thread created internally by cygwin,
> for posix emulation, and thus never
> changes the value of the variable shared_var.

Thanks. I saw a bunch of timeouts in this test too:

(gdb) PASS: gdb.base/watch_thread_num.exp: Invalid watch syntax
Next 5
41 res = pthread_create (&threads[i],
(gdb) PASS: gdb.base/watch_thread_num.exp: Next 5
watch shared_var thread 2
Unknown thread 2.
(gdb) FAIL: gdb.base/watch_thread_num.exp: Watchpoint on shared
variable

They aren't really related, but I think your patch will fix them too.
Patch is OK.

Some other things I noticed with this test:

> --- gdb/testsuite/gdb.base/watch_thread_num.exp 17 Dec 2007 12:32:23 -00001.1
> +++ gdb/testsuite/gdb.base/watch_thread_num.exp 19 Dec 2007 08:45:41 -0000

This is a threads test, it should be in gdb.threads.

> +for {set i 1} {$i <= 10} {incr i 1} {
> +gdb_test "continue" "Hardware watchpoint 3: shared_var.*" \
> + "Watchpoint triggered iteration $i"

This test won't work on any target without hardware watchpoints. It
should either handle that (search for can-use-hw-watchpoints) or skip
if the test is fundamentally broken without hardware watchpoints.
Probably the latter. See watchthreads.exp.

--
Daniel Jacobowitz
CodeSourcery