Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Siva Chandra <sivachandra@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC][testsuite] Add option to link testcases with pthreads when using 'prepare_for_testing'
Date: Mon, 15 Apr 2013 18:12:00 -0000	[thread overview]
Message-ID: <CAGyQ6gx2aLH2_jGAB8e0_EwmCiypepq9EXn4mC6jp4ahZ+BiTg@mail.gmail.com> (raw)
In-Reply-To: <8761zrfox7.fsf@fleche.redhat.com>

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

The attached patch addresses both of Tom's comments.

On Fri, Apr 12, 2013 at 1:56 PM, Tom Tromey <tromey@redhat.com> wrote:
> The intro comment to build_executable_from_specs needs an update to note
> that with_pthreads is handled locally.

Done.

> Siva> +    if { [lsearch -exact $options "with_pthreads"] >= 0 } {
> Siva> +        if  { [gdb_compile_pthreads $objects "${binfile}" executable $options] != "" } {
>
> I wonder if you need to remove with_pthreads from the options here.

Done.

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

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

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d05257d..a900cb7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3977,7 +3977,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 "with_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,
@@ -3999,10 +4000,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 with_pthreads [lsearch -exact $options "with_pthreads"]
+    if { $with_pthreads >= 0 } {
+        set options [lreplace $options $with_pthreads $with_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 13:36 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 [this message]
2013-04-15 18:51     ` Pedro Alves
2013-04-16  5:39       ` Siva Chandra
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=CAGyQ6gx2aLH2_jGAB8e0_EwmCiypepq9EXn4mC6jp4ahZ+BiTg@mail.gmail.com \
    --to=sivachandra@google.com \
    --cc=gdb-patches@sourceware.org \
    --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