This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix test suite race (Re: [patch] Changes to the OpenCL testsuite)
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: ken at linux dot vnet dot ibm dot com (Ken Werner)
- Cc: yao at codesourcery dot com (Yao Qi), gdb-patches at sourceware dot org
- Date: Mon, 31 Jan 2011 20:06:47 +0100 (CET)
- Subject: [commit] Fix test suite race (Re: [patch] Changes to the OpenCL testsuite)
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