This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][testsuite] Add option to link testcases with pthreads when using 'prepare_for_testing'


Hello,

The attached patch allows one to specify an option 'with_pthreads'
when using 'prepare_for_testing' in tests.  One could call
gdb_compile_pthreads directly for such a purpose, but I think using
'prepare_for_testing' is the suggested approach.  If my understanding
or approach is wrong here, then what is the best way to make testcases
to link with pthreads for c++ testcases?

2013-03-23  Siva Chandra Reddy  <sivachandra@google.com>

        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 "with_pthreads" is
        specified.

Thanks,
Siva Chandra
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ee9fdec..ab91cc5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3997,10 +3997,17 @@ 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
+
+    if { [lsearch -exact $options "with_pthreads"] >= 0 } {    
+        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 ""

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]