public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix new sancov tests
@ 2015-12-06  8:56 Dmitry Vyukov
  2015-12-07 13:56 ` Nathan Sidwell
  2015-12-07 14:09 ` Jakub Jelinek
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Vyukov @ 2015-12-06  8:56 UTC (permalink / raw)
  To: GCC Patches, Jakub Jelinek, Nathan Sidwell

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

Hello,

Sancov tests submitted in 231296 assume that asan is supported on all platforms.
This patch fixes that assumption.
OK for trunk?



Index: ChangeLog
===================================================================
--- ChangeLog (revision 231328)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2015-12-06  Dmitry Vyukov  <dvyukov@google.com>
+
+ * gcc.dg/sancov/sancov.exp: Don't run asan tests when asan is not
+ available.
+
 2015-12-05  David Edelsohn  <dje.gcc@gmail.com>

  * gcc.target/powerpc/recip-sqrtf.c: New test.
Index: gcc.dg/sancov/sancov.exp
===================================================================
--- gcc.dg/sancov/sancov.exp (revision 231328)
+++ gcc.dg/sancov/sancov.exp (working copy)
@@ -18,6 +18,7 @@

 load_lib gcc-dg.exp
 load_lib torture-options.exp
+load_lib asan-dg.exp

 dg-init
 torture-init
@@ -31,7 +32,11 @@
  { -O2 -g } \
  { -O3 -g } ]

-gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""

+if [check_effective_target_fsanitize_address] {
+  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
+}
+
 torture-finish
 dg-finish

[-- Attachment #2: sancov.patch --]
[-- Type: text/x-patch, Size: 1056 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 231328)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2015-12-06  Dmitry Vyukov  <dvyukov@google.com>
+
+	* gcc.dg/sancov/sancov.exp: Don't run asan tests when asan is not
+	available.
+
 2015-12-05  David Edelsohn  <dje.gcc@gmail.com>
 
 	* gcc.target/powerpc/recip-sqrtf.c: New test.
Index: gcc.dg/sancov/sancov.exp
===================================================================
--- gcc.dg/sancov/sancov.exp	(revision 231328)
+++ gcc.dg/sancov/sancov.exp	(working copy)
@@ -18,6 +18,7 @@
 
 load_lib gcc-dg.exp
 load_lib torture-options.exp
+load_lib asan-dg.exp
 
 dg-init
 torture-init
@@ -31,7 +32,11 @@
 	{ -O2 -g } \
 	{ -O3 -g } ]
 
-gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""
 
+if [check_effective_target_fsanitize_address] {
+  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
+}
+
 torture-finish
 dg-finish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix new sancov tests
  2015-12-06  8:56 [PATCH] Fix new sancov tests Dmitry Vyukov
@ 2015-12-07 13:56 ` Nathan Sidwell
  2015-12-07 15:14   ` Dmitry Vyukov
  2015-12-07 14:09 ` Jakub Jelinek
  1 sibling, 1 reply; 7+ messages in thread
From: Nathan Sidwell @ 2015-12-07 13:56 UTC (permalink / raw)
  To: Dmitry Vyukov, GCC Patches, Jakub Jelinek

On 12/06/15 03:56, Dmitry Vyukov wrote:
> Hello,
>
> Sancov tests submitted in 231296 assume that asan is supported on all platforms.
> This patch fixes that assumption.

>    * gcc.target/powerpc/recip-sqrtf.c: New test.
> Index: gcc.dg/sancov/sancov.exp
> ===================================================================

> -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
> +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""
>
> +if [check_effective_target_fsanitize_address] {
> +  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
> +}
> +
>   torture-finish
>   dg-finish
>

Thanks for addressing this.  FWIW I think canonical form in .exp files is to 
place something like

if { ! [is this for me?] } then {
  return
}

as early as possible (before the dg-init call)

nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix new sancov tests
  2015-12-06  8:56 [PATCH] Fix new sancov tests Dmitry Vyukov
  2015-12-07 13:56 ` Nathan Sidwell
@ 2015-12-07 14:09 ` Jakub Jelinek
  2015-12-07 15:16   ` Dmitry Vyukov
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2015-12-07 14:09 UTC (permalink / raw)
  To: Dmitry Vyukov; +Cc: GCC Patches, Nathan Sidwell

On Sun, Dec 06, 2015 at 09:56:32AM +0100, Dmitry Vyukov wrote:

> --- gcc.dg/sancov/sancov.exp (revision 231328)
> +++ gcc.dg/sancov/sancov.exp (working copy)
> @@ -18,6 +18,7 @@
> 
>  load_lib gcc-dg.exp
>  load_lib torture-options.exp
> +load_lib asan-dg.exp
> 
>  dg-init
>  torture-init
> @@ -31,7 +32,11 @@
>   { -O2 -g } \
>   { -O3 -g } ]
> 
> -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
> +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""
> 
> +if [check_effective_target_fsanitize_address] {
> +  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
> +}
> +

I don't like this, it is bad enough vect.exp works this way, let's not add
further tests depending on test names.
So, either just load_lib asan-dg.exp and change
/* { dg-do compile } */
to
/* { dg-do compile { target fsanitize_address } } */
or avoid the load_lib and add check_effective_target_fsanitize_address
variant that checks compilation with -fsanitize=address of trivial program
instead of linking, put it into lib/target-supports.exp and use it
in dg-do ompile.

	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix new sancov tests
  2015-12-07 13:56 ` Nathan Sidwell
@ 2015-12-07 15:14   ` Dmitry Vyukov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Vyukov @ 2015-12-07 15:14 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: GCC Patches, Jakub Jelinek

On Mon, Dec 7, 2015 at 2:56 PM, Nathan Sidwell <nathan@acm.org> wrote:
> On 12/06/15 03:56, Dmitry Vyukov wrote:
>>
>> Hello,
>>
>> Sancov tests submitted in 231296 assume that asan is supported on all
>> platforms.
>> This patch fixes that assumption.
>
>
>>    * gcc.target/powerpc/recip-sqrtf.c: New test.
>> Index: gcc.dg/sancov/sancov.exp
>> ===================================================================
>
>
>> -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
>> +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""
>>
>> +if [check_effective_target_fsanitize_address] {
>> +  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
>> +}
>> +
>>   torture-finish
>>   dg-finish
>>
>
> Thanks for addressing this.  FWIW I think canonical form in .exp files is to
> place something like
>
> if { ! [is this for me?] } then {
>  return
> }
>
> as early as possible (before the dg-init call)


Only asan.c is not for me, but other tests still need to be executed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix new sancov tests
  2015-12-07 14:09 ` Jakub Jelinek
@ 2015-12-07 15:16   ` Dmitry Vyukov
  2015-12-07 15:21     ` Jakub Jelinek
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Vyukov @ 2015-12-07 15:16 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches, Nathan Sidwell

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

On Mon, Dec 7, 2015 at 3:09 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Sun, Dec 06, 2015 at 09:56:32AM +0100, Dmitry Vyukov wrote:
>
>> --- gcc.dg/sancov/sancov.exp (revision 231328)
>> +++ gcc.dg/sancov/sancov.exp (working copy)
>> @@ -18,6 +18,7 @@
>>
>>  load_lib gcc-dg.exp
>>  load_lib torture-options.exp
>> +load_lib asan-dg.exp
>>
>>  dg-init
>>  torture-init
>> @@ -31,7 +32,11 @@
>>   { -O2 -g } \
>>   { -O3 -g } ]
>>
>> -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
>> +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""
>>
>> +if [check_effective_target_fsanitize_address] {
>> +  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
>> +}
>> +
>
> I don't like this, it is bad enough vect.exp works this way, let's not add
> further tests depending on test names.
> So, either just load_lib asan-dg.exp and change
> /* { dg-do compile } */
> to
> /* { dg-do compile { target fsanitize_address } } */
> or avoid the load_lib and add check_effective_target_fsanitize_address
> variant that checks compilation with -fsanitize=address of trivial program
> instead of linking, put it into lib/target-supports.exp and use it
> in dg-do ompile.


Did the first option. Please take another look:


Index: ChangeLog
===================================================================
--- ChangeLog (revision 231362)
+++ ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2015-12-06  Dmitry Vyukov  <dvyukov@google.com>
+
+ * gcc.dg/sancov/asan.c: Don't run when asan is not available.
+
 2015-12-07  Nathan Sidwell  <nathan@acm.org>

  * gcc.target/nvptx/decl-init.c: New.
Index: gcc.dg/sancov/asan.c
===================================================================
--- gcc.dg/sancov/asan.c (revision 231362)
+++ gcc.dg/sancov/asan.c (working copy)
@@ -3,7 +3,7 @@
      - coverage does not instrument asan-emitted basic blocks
      - asan considers coverage callback as "nonfreeing" (thus 1 asan store
        callback.  */
-/* { dg-do compile } */
+/* { dg-do compile { target fsanitize_address } } */
 /* { dg-options "-fsanitize-coverage=trace-pc -fsanitize=address
-fdump-tree-optimized" } */

 void foo(volatile int *a, int *b)
Index: gcc.dg/sancov/sancov.exp
===================================================================
--- gcc.dg/sancov/sancov.exp (revision 231362)
+++ gcc.dg/sancov/sancov.exp (working copy)
@@ -17,6 +17,7 @@
 # <http://www.gnu.org/licenses/>.

 load_lib gcc-dg.exp
+load_lib asan-dg.exp
 load_lib torture-options.exp

 dg-init

[-- Attachment #2: sancov.patch --]
[-- Type: text/x-patch, Size: 1262 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 231362)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2015-12-06  Dmitry Vyukov  <dvyukov@google.com>
+
+	* gcc.dg/sancov/asan.c: Don't run when asan is not available.
+
 2015-12-07  Nathan Sidwell  <nathan@acm.org>
 
 	* gcc.target/nvptx/decl-init.c: New.
Index: gcc.dg/sancov/asan.c
===================================================================
--- gcc.dg/sancov/asan.c	(revision 231362)
+++ gcc.dg/sancov/asan.c	(working copy)
@@ -3,7 +3,7 @@
      - coverage does not instrument asan-emitted basic blocks
      - asan considers coverage callback as "nonfreeing" (thus 1 asan store
        callback.  */
-/* { dg-do compile } */
+/* { dg-do compile { target fsanitize_address } } */
 /* { dg-options "-fsanitize-coverage=trace-pc -fsanitize=address -fdump-tree-optimized" } */
 
 void foo(volatile int *a, int *b)
Index: gcc.dg/sancov/sancov.exp
===================================================================
--- gcc.dg/sancov/sancov.exp	(revision 231362)
+++ gcc.dg/sancov/sancov.exp	(working copy)
@@ -17,6 +17,7 @@
 # <http://www.gnu.org/licenses/>.
 
 load_lib gcc-dg.exp
+load_lib asan-dg.exp
 load_lib torture-options.exp
 
 dg-init

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix new sancov tests
  2015-12-07 15:16   ` Dmitry Vyukov
@ 2015-12-07 15:21     ` Jakub Jelinek
  2015-12-07 15:28       ` Dmitry Vyukov
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2015-12-07 15:21 UTC (permalink / raw)
  To: Dmitry Vyukov; +Cc: GCC Patches, Nathan Sidwell

On Mon, Dec 07, 2015 at 04:16:02PM +0100, Dmitry Vyukov wrote:
> Index: ChangeLog
> ===================================================================
> --- ChangeLog (revision 231362)
> +++ ChangeLog (working copy)
> @@ -1,3 +1,7 @@
> +2015-12-06  Dmitry Vyukov  <dvyukov@google.com>
> +
> + * gcc.dg/sancov/asan.c: Don't run when asan is not available.

The ChangeLog entry should also contain the other change:
	* gcc.dg/sancov/sancov.exp: Load asan-dg.exp.

Ok with that change.

	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix new sancov tests
  2015-12-07 15:21     ` Jakub Jelinek
@ 2015-12-07 15:28       ` Dmitry Vyukov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Vyukov @ 2015-12-07 15:28 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches, Nathan Sidwell

On Mon, Dec 7, 2015 at 4:20 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Dec 07, 2015 at 04:16:02PM +0100, Dmitry Vyukov wrote:
>> Index: ChangeLog
>> ===================================================================
>> --- ChangeLog (revision 231362)
>> +++ ChangeLog (working copy)
>> @@ -1,3 +1,7 @@
>> +2015-12-06  Dmitry Vyukov  <dvyukov@google.com>
>> +
>> + * gcc.dg/sancov/asan.c: Don't run when asan is not available.
>
> The ChangeLog entry should also contain the other change:
>         * gcc.dg/sancov/sancov.exp: Load asan-dg.exp.
>
> Ok with that change.


Committed as 231364 with updated ChangeLog:

* gcc.dg/sancov/sancov.exp: Load asan-dg.exp.
* gcc.dg/sancov/asan.c: Don't run when asan is not available.

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-07 15:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-06  8:56 [PATCH] Fix new sancov tests Dmitry Vyukov
2015-12-07 13:56 ` Nathan Sidwell
2015-12-07 15:14   ` Dmitry Vyukov
2015-12-07 14:09 ` Jakub Jelinek
2015-12-07 15:16   ` Dmitry Vyukov
2015-12-07 15:21     ` Jakub Jelinek
2015-12-07 15:28       ` Dmitry Vyukov

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).