Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: ken@linux.vnet.ibm.com (Ken Werner)
Cc: yao@codesourcery.com (Yao Qi), gdb-patches@sourceware.org
Subject: [commit] Fix test suite race (Re: [patch] Changes to the OpenCL testsuite)
Date: Mon, 31 Jan 2011 19:45:00 -0000	[thread overview]
Message-ID: <201101311906.p0VJ6lQS006271@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <201101251716.20266.ken@linux.vnet.ibm.com> from "Ken Werner" at Jan 25, 2011 05:16:20 PM

Ken Werner wrote:

> 	* gdb.opencl/convs_casts.cl: Move program scope variables into the
> 	OpenCL kernel function. Add a comment as marker. Add address space
> 	qualifiers for the remaining program scope variables.
> 	* gdb.opencl/datatypes.cl: Likewise.
> 	* gdb.opencl/operators.cl: Likewise.
> 	* gdb.opencl/vec_comps.cl: Likewise.
> 	* gdb.opencl/convs_casts.exp: Replace gdb_test_multiple by gdb_test.
> 	Add breakpoint at the marker comment.
> 	* gdb.opencl/datatypes.exp: Likewise.
> 	* gdb.opencl/operators.exp: Likewise.
> 	* gdb.opencl/vec_comps.exp: Likewise.

This patch exposed a race condition if the kernel runs multi-threaded:
after the inital breakpoint on "testkernel" is hit, GDB now attempts
to proceed to "marker" -- but we might instead hit "testkernel" in
another thread.

This patch fixes the race by using "tbreak" to make sure only one
thread will ever stop at "testkernel".

Tested on powerpc64-linux.
Committed to mainline.


ChangeLog:

	* gdb.opencl/convs_casts.exp: Use tbreak instead of break to
	proceed to initial kernel entry point.
	* gdb.opencl/datatypes.exp: Likewise.
	* gdb.opencl/operators.exp: Likewise.
	* gdb.opencl/vec_comps.exp: Likewise.

Index: gdb/testsuite/gdb.opencl/convs_casts.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.opencl/convs_casts.exp,v
retrieving revision 1.3
diff -u -p -r1.3 convs_casts.exp
--- gdb/testsuite/gdb.opencl/convs_casts.exp	25 Jan 2011 16:10:28 -0000	1.3
+++ gdb/testsuite/gdb.opencl/convs_casts.exp	31 Jan 2011 18:59:33 -0000
@@ -40,14 +40,14 @@ if { [gdb_compile_opencl_hostapp "${clpr
 clean_restart ${testfile}
 
 # Set breakpoint at the OpenCL kernel
-gdb_test "break testkernel" \
+gdb_test "tbreak testkernel" \
     "" \
     "Set pending breakpoint" \
     ".*Function \"testkernel\" not defined.*Make breakpoint pending.*y or \\\[n\\\]. $" \
     "y"
 
 gdb_run_cmd
-gdb_test "" ".*Breakpoint.*1.*testkernel.*" "run"
+gdb_test "" ".*reakpoint.*1.*testkernel.*" "run"
 
 # Continue to the marker
 gdb_breakpoint [gdb_get_line_number "marker" "${clprogram}"]
Index: gdb/testsuite/gdb.opencl/datatypes.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.opencl/datatypes.exp,v
retrieving revision 1.3
diff -u -p -r1.3 datatypes.exp
--- gdb/testsuite/gdb.opencl/datatypes.exp	25 Jan 2011 16:10:28 -0000	1.3
+++ gdb/testsuite/gdb.opencl/datatypes.exp	31 Jan 2011 18:59:33 -0000
@@ -206,14 +206,14 @@ gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${objdir}/${subdir}/${testfile}
 
 # Set breakpoint at the OpenCL kernel
-gdb_test "break testkernel" \
+gdb_test "tbreak testkernel" \
     "" \
     "Set pending breakpoint" \
     ".*Function \"testkernel\" not defined.*Make breakpoint pending.*y or \\\[n\\\]. $" \
     "y"
 
 gdb_run_cmd
-gdb_test "" ".*Breakpoint.*1.*testkernel.*" "run"
+gdb_test "" ".*reakpoint.*1.*testkernel.*" "run"
 
 # Continue to the marker
 gdb_breakpoint [gdb_get_line_number "marker" "${clprogram}"]
Index: gdb/testsuite/gdb.opencl/operators.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.opencl/operators.exp,v
retrieving revision 1.3
diff -u -p -r1.3 operators.exp
--- gdb/testsuite/gdb.opencl/operators.exp	25 Jan 2011 16:10:28 -0000	1.3
+++ gdb/testsuite/gdb.opencl/operators.exp	31 Jan 2011 18:59:33 -0000
@@ -40,14 +40,14 @@ if { [gdb_compile_opencl_hostapp "${clpr
 clean_restart ${testfile}
 
 # Set breakpoint at the OpenCL kernel
-gdb_test "break testkernel" \
+gdb_test "tbreak testkernel" \
     "" \
     "Set pending breakpoint" \
     ".*Function \"testkernel\" not defined.*Make breakpoint pending.*y or \\\[n\\\]. $" \
     "y"
 
 gdb_run_cmd
-gdb_test "" ".*Breakpoint.*1.*testkernel.*" "run"
+gdb_test "" ".*reakpoint.*1.*testkernel.*" "run"
 
 # Continue to the marker
 gdb_breakpoint [gdb_get_line_number "marker" "${clprogram}"]
Index: gdb/testsuite/gdb.opencl/vec_comps.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.opencl/vec_comps.exp,v
retrieving revision 1.3
diff -u -p -r1.3 vec_comps.exp
--- gdb/testsuite/gdb.opencl/vec_comps.exp	25 Jan 2011 16:10:28 -0000	1.3
+++ gdb/testsuite/gdb.opencl/vec_comps.exp	31 Jan 2011 18:59:33 -0000
@@ -40,14 +40,14 @@ if { [gdb_compile_opencl_hostapp "${clpr
 clean_restart ${testfile}
 
 # Set breakpoint at the OpenCL kernel
-gdb_test "break testkernel" \
+gdb_test "tbreak testkernel" \
     "" \
     "Set pending breakpoint" \
     ".*Function \"testkernel\" not defined.*Make breakpoint pending.*y or \\\[n\\\]. $" \
     "y"
 
 gdb_run_cmd
-gdb_test "" ".*Breakpoint.*1.*testkernel.*" "run"
+gdb_test "" ".*reakpoint.*1.*testkernel.*" "run"
 
 # Continue to the marker
 gdb_breakpoint [gdb_get_line_number "marker" "${clprogram}"]
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2011-01-31 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 20:54 [patch] Changes to the OpenCL testsuite Ken Werner
2011-01-24 22:04 ` Yao Qi
2011-01-25  8:46   ` Ken Werner
2011-01-25 14:22     ` Ulrich Weigand
2011-01-25 16:26       ` Ken Werner
2011-01-31 19:45         ` Ulrich Weigand [this message]
2011-01-25 15:22     ` Yao Qi
2011-01-25 16:16       ` Ken Werner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201101311906.p0VJ6lQS006271@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ken@linux.vnet.ibm.com \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox