aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/opencl.exp
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-08-13 15:55:52 +0000
committerTom Tromey <tromey@redhat.com>2013-08-13 15:55:52 +0000
commit17e1c970ef41149e5eb6b5f908301e6a86a7f528 (patch)
tree23b999d13e17d616ef89dcc37aab806ca63973d4 /gdb/testsuite/lib/opencl.exp
parent4e2348988f2e09ced290e012981de941c96bc70c (diff)
downloadgdb-17e1c970ef41149e5eb6b5f908301e6a86a7f528.zip
gdb-17e1c970ef41149e5eb6b5f908301e6a86a7f528.tar.gz
gdb-17e1c970ef41149e5eb6b5f908301e6a86a7f528.tar.bz2
add caching procs to test suite
In the fully parallel mode, each .exp file can be run in parallel (at least conceptually -- the actual split may not be so severe). This means that procs that compute a result and cache it are not going to function very well. The test they run will be invoked over and over. This patch introduces a generic caching mechanism and changes various result-caching procs to use it. This is a cleanup to introduce the basic change; the results aren't written to disk yet. A caching proc is defined using gdb_caching_proc, which works like "proc", except that it caches the result of the body. * lib/cache.exp: New file. * lib/cell.exp (skip_cell_tests): Use gdb_caching_proc. * lib/gdb.exp: Load cache.exp. (support_complex_tests, is_ilp32_target, is_lp64_target) (is_amd64_regs_target, skip_altivec_tests, skip_vsx_tests) (gdb_skip_xml_test): Use gdb_caching_proc. * lib/opencl.exp (skip_opencl_tests): Use gdb_caching_proc.
Diffstat (limited to 'gdb/testsuite/lib/opencl.exp')
-rw-r--r--gdb/testsuite/lib/opencl.exp24
1 files changed, 9 insertions, 15 deletions
diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp
index 5afb3f8..32491396 100644
--- a/gdb/testsuite/lib/opencl.exp
+++ b/gdb/testsuite/lib/opencl.exp
@@ -29,18 +29,11 @@ proc gdb_compile_opencl_hostapp {clsource executable options} {
# Run a test on the target to check if it supports OpenCL. Return 0 if so, 1 if
# it does not.
-proc skip_opencl_tests {} {
- global skip_opencl_tests_saved srcdir objdir subdir gdb_prompt
+gdb_caching_proc skip_opencl_tests {
+ global srcdir objdir subdir gdb_prompt
global inferior_exited_re
- # Use the cached value, if it exists. Cache value per "board" to handle
- # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
set me "skip_opencl_tests"
- set board [target_info name]
- if [info exists skip_opencl_tests_saved($board)] {
- verbose "$me: returning saved $skip_opencl_tests_saved($board)" 2
- return $skip_opencl_tests_saved($board)
- }
# Set up, compile, and execute an OpenCL program. Include the current
# process ID in the file name of the executable to prevent conflicts with
@@ -52,8 +45,9 @@ proc skip_opencl_tests {} {
set compile_flags {debug nowarnings quiet}
if { [gdb_compile_opencl_hostapp "${clprogram}" "${executable}" "${compile_flags}" ] != "" } {
+ remote_file target delete ${clprogram}
verbose "$me: compiling OpenCL binary failed, returning 1" 2
- return [set skip_opencl_tests_saved($board) 1]
+ return 1
}
# Compilation succeeded so now run it via gdb.
@@ -62,15 +56,15 @@ proc skip_opencl_tests {} {
gdb_expect 30 {
-re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
verbose -log "\n$me: OpenCL support detected"
- set skip_opencl_tests_saved($board) 0
+ set result 0
}
-re ".*$inferior_exited_re code.*${gdb_prompt} $" {
verbose -log "\n$me: OpenCL support not detected"
- set skip_opencl_tests_saved($board) 1
+ set result 1
}
default {
verbose -log "\n$me OpenCL support not detected (default case)"
- set skip_opencl_tests_saved($board) 1
+ set result 1
}
}
gdb_exit
@@ -79,6 +73,6 @@ proc skip_opencl_tests {} {
# Delete the OpenCL program source file.
remote_file target delete ${clprogram}
- verbose "$me: returning $skip_opencl_tests_saved($board)" 2
- return $skip_opencl_tests_saved($board)
+ verbose "$me: returning $result" 2
+ return $result
}