Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Siva Chandra <sivachandra@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC][testsuite] Add option to link testcases with pthreads when using 'prepare_for_testing'
Date: Tue, 16 Apr 2013 05:39:00 -0000	[thread overview]
Message-ID: <CAGyQ6gxj-S8VLsYutLaSrhUUHoNFexWF8mxV-LNB7rCQRxTeCA@mail.gmail.com> (raw)
In-Reply-To: <516C0D67.7020307@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

On Mon, Apr 15, 2013 at 7:23 AM, Pedro Alves <palves@redhat.com> wrote:
> Super nit, but do we need "with_" ?  We don't say "with_debug" or
> "with_nowarnings" either.  I'd suggest just "pthread".  Singular, as
> GNU uses -pthread / -lpthread.

Done.  Please find the patch attached.

2013-04-15  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 "pthreads" is
        specified.

[-- Attachment #2: pthreads_option_patch.txt --]
[-- Type: text/plain, Size: 1573 bytes --]

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 ""

  reply	other threads:[~2013-04-15 18:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 12:02 Siva Chandra
2013-04-15  9:22 ` Tom Tromey
2013-04-15 18:12   ` Siva Chandra
2013-04-15 18:51     ` Pedro Alves
2013-04-16  5:39       ` Siva Chandra [this message]
2013-04-16  5:47         ` Tom Tromey
2013-04-16  7:52           ` Siva Chandra

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=CAGyQ6gxj-S8VLsYutLaSrhUUHoNFexWF8mxV-LNB7rCQRxTeCA@mail.gmail.com \
    --to=sivachandra@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.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