From a0d3f2f58f9dab54cab0c50658431823f3749ea9 Mon Sep 17 00:00:00 2001 From: Siva Chandra Reddy Date: Mon, 15 Apr 2013 20:37:37 +0000 Subject: 2013-04-15 Siva Chandra Reddy Add option to link testcases with Pthreads library when using 'prepare_for_testing' in tests. testsuite/ * lib/gdb.exp (build_executable_from_specs): Use gdb_compile_pthreads to compile if option "pthreads" is specified. --- gdb/testsuite/ChangeLog | 9 +++++++++ gdb/testsuite/lib/gdb.exp | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a35d9ed..b51758a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-04-15 Siva Chandra Reddy + + Add option to link testcases with Pthreads library when + using 'prepare_for_testing' in tests. + + * lib/gdb.exp (build_executable_from_specs): Use + gdb_compile_pthreads to compile if option "pthreads" is + specified. + 2013-04-15 Tom Tromey * gdb.cp/exceptprint.exp: Add regexp catchpoint tests. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3273bf4..06e1226 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3995,7 +3995,8 @@ proc test_prefix_command_help { command_list expected_initial_lines args } { # different options to be passed to different sub-compilations. # TESTNAME is the name of the test; this is passed to 'untested' if # something fails. -# OPTIONS is passed to the final link, using gdb_compile. +# OPTIONS is passed to the final link, using gdb_compile. If OPTIONS +# contains the option "pthreads", then gdb_compile_pthreads is used. # ARGS is a flat list of source specifications, of the form: # { SOURCE1 OPTIONS1 [ SOURCE2 OPTIONS2 ]... } # Each SOURCE is compiled to an object file using its OPTIONS, @@ -4017,10 +4018,19 @@ proc build_executable_from_specs {testname executable options args} { lappend objects "${binfile}${i}.o" incr i } - - if { [gdb_compile $objects "${binfile}" executable $options] != "" } { - untested $testname - return -1 + + set pthreads [lsearch -exact $options "pthreads"] + if { $pthreads >= 0 } { + set options [lreplace $options $pthreads $pthreads] + if { [gdb_compile_pthreads $objects "${binfile}" executable $options] != "" } { + untested $testname + return -1 + } + } else { + if { [gdb_compile $objects "${binfile}" executable $options] != "" } { + untested $testname + return -1 + } } set info_options "" -- cgit v1.1