public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
To: janis187@us.ibm.com
Cc: gcc Mailing List <gcc@gcc.gnu.org>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: c-c++-common testsuite
Date: Fri, 07 Aug 2009 14:16:00 -0000	[thread overview]
Message-ID: <6c33472e0908070648t76f08e13lfae22be7b0457a76@mail.gmail.com> (raw)
In-Reply-To: <1249605481.6071.5.camel@janis-laptop>

2009/8/7 Janis Johnson <janis187@us.ibm.com>:
> On Fri, 2009-08-07 at 00:06 +0200, Manuel López-Ibáñez wrote:
>> Often I want to test the exactly same testcase in C and C++, so I find
>> myself adding duplicate tests under gcc.dg/ and g++.dg/. Would it be
>> possible to have a shared testsuite dir that is run for both C and C++
>> languages? (possibly with different default configurations, like
>> adding -Wc++-compat to the commandline for C runs).
>
> I've been thinking about that lately, it would be useful for several
> kinds of functionality.  We'd want effective targets for the language
> for using different options and for providing different error/warning
> checks for each language.  I haven't looked into how to handle it with
> DejaGnu, maybe something like gcc.shared and a [symbolic] link to it
> called g++.shared; do links work with Subversion?

Janis, it would be extremely useful to have dg-options that are only
enabled for certain languages, so I can do

/* { dg-options "-std=c99" { dg-require-effective-target c } } */
/* { dg-options "" { dg-require-effective-target c++ } } */

Would this be hard to implement? Any ideas?


As for how to run the shared tests, Joseph suggestion works, but I
think it is better to just run the common tests from each dg.exp file

Index: gcc/testsuite/gcc.dg/dg.exp
===================================================================
--- gcc/testsuite/gcc.dg/dg.exp (revision 150491)
+++ gcc/testsuite/gcc.dg/dg.exp (working copy)
@@ -30,7 +30,11 @@ dg-init

 # Main loop.
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cSi\]]] \
        "" $DEFAULT_CFLAGS

+# C/C++ common tests.
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \
+       " -Wc++-compat " ""
+
 # All done.
 dg-finish
Index: gcc/testsuite/g++.dg/dg.exp
===================================================================
--- gcc/testsuite/g++.dg/dg.exp (revision 150491)
+++ gcc/testsuite/g++.dg/dg.exp (working copy)
@@ -47,7 +47,11 @@ set tests [prune $tests $srcdir/$subdir/
 set tests [prune $tests $srcdir/$subdir/graphite/*]

 # Main loop.
 dg-runtest $tests "" $DEFAULT_CXXFLAGS

+# C/C++ common tests.
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \
+       "" ""
+
 # All done.
 dg-finish

so people can run c-c++-common testcases by doing simply

make  -C gcc check-gcc RUNTESTFLAGS=dg.exp='*Wconversion*'

Cheers,

Manuel.

  parent reply	other threads:[~2009-08-07 13:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06 22:20 Manuel López-Ibáñez
2009-08-06 22:39 ` Joseph S. Myers
2009-08-07  0:44 ` Janis Johnson
2009-08-07  2:12   ` Joseph S. Myers
2009-08-07  2:18     ` Dave Korn
2009-08-07 11:51       ` Joseph S. Myers
2009-08-07 13:48   ` Daniel Jacobowitz
2009-08-07 14:16   ` Manuel López-Ibáñez [this message]
2009-08-07 18:19     ` Janis Johnson

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=6c33472e0908070648t76f08e13lfae22be7b0457a76@mail.gmail.com \
    --to=lopezibanez@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=janis187@us.ibm.com \
    --cc=joseph@codesourcery.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).