diff mbox

Fix new sancov tests

Message ID CACT4Y+Yy3XXMQ=_CrjCiXmV0q4CQByjWT01FU66Z+CF9niT1YQ@mail.gmail.com
State New
Headers show

Commit Message

Dmitry Vyukov Dec. 6, 2015, 8:56 a.m. UTC
Hello,

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

Comments

Nathan Sidwell Dec. 7, 2015, 1:56 p.m. UTC | #1
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
Jakub Jelinek Dec. 7, 2015, 2:09 p.m. UTC | #2
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
Dmitry Vyukov Dec. 7, 2015, 3:14 p.m. UTC | #3
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.
diff mbox

Patch

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