diff mbox

[testsuite] : Move gcc.dg/sancov/asan.c to gcc.dg/asan/sancov-1.c

Message ID CAFULd4aRh-OP7=fgLms4_VCoA99JHXAJ94V7jFRfbFpXdFh-=Q@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Feb. 4, 2016, 1:21 p.m. UTC
On Thu, Feb 4, 2016 at 1:49 PM, Andreas Schwab <schwab@suse.de> wrote:

>>> OTOH, does this testcase even gets a chance to run?
>>
>> It's not a runtime check.
>
> But it didn't link until today:
>
> Running /opt/gcc/gcc-20160203/gcc/testsuite/gcc.dg/sancov/sancov.exp ...
> Executing on host: /opt/gcc/gcc-20160203/Build/gcc/xgcc -B/opt/gcc/gcc-20160203/Build/gcc/ fsanitize_address29346.c     -fno-diagnostics-show-caret -fdiagnostics-color=never  -fsanitize=address  -lm  -o fsanitize_address29346.exe    (timeout = 300)
> spawn -ignore SIGHUP /opt/gcc/gcc-20160203/Build/gcc/xgcc -B/opt/gcc/gcc-20160203/Build/gcc/ fsanitize_address29346.c -fno-diagnostics-show-caret -fdiagnostics-color=never -fsanitize=address -lm -o fsanitize_address29346.exe.
> /usr/aarch64-suse-linux/bin/ld: cannot find libasan_preinit.o: No such file or directory.
> /usr/aarch64-suse-linux/bin/ld: cannot find -lasan.
> collect2: error: ld returned 1 exit status.
> compiler exited with status 1
> output is:
> /usr/aarch64-suse-linux/bin/ld: cannot find libasan_preinit.o: No such file or directory.
> /usr/aarch64-suse-linux/bin/ld: cannot find -lasan.
> collect2: error: ld returned 1 exit status.
>
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O0
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O1
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O2
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O3
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O0 -g
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O1 -g
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O2 -g
> UNSUPPORTED: gcc.dg/sancov/asan.c   -O3 -g

We have to move the testcase from sancov to asan directory, otherwise
the test won't work (and it didn't work even on x86_64, since the
effective target test always failed).

2016-02-04  Uros Bizjak  <ubizjak@gmail.com>

    * gcc.dg/sancov/asan.c: Move to ...
    * gcc.dg/asan/sancov-1.c: ... here.

The patch was tested on x86_64-linux-gnu and I have double checked
that the testcase passes.

OK for mainline?

Uros.

Comments

Uros Bizjak Feb. 5, 2016, 4:42 p.m. UTC | #1
On Thu, Feb 4, 2016 at 2:21 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Feb 4, 2016 at 1:49 PM, Andreas Schwab <schwab@suse.de> wrote:
>
>>>> OTOH, does this testcase even gets a chance to run?
>>>
>>> It's not a runtime check.
>>
>> But it didn't link until today:
>>
>> Running /opt/gcc/gcc-20160203/gcc/testsuite/gcc.dg/sancov/sancov.exp ...
>> Executing on host: /opt/gcc/gcc-20160203/Build/gcc/xgcc -B/opt/gcc/gcc-20160203/Build/gcc/ fsanitize_address29346.c     -fno-diagnostics-show-caret -fdiagnostics-color=never  -fsanitize=address  -lm  -o fsanitize_address29346.exe    (timeout = 300)
>> spawn -ignore SIGHUP /opt/gcc/gcc-20160203/Build/gcc/xgcc -B/opt/gcc/gcc-20160203/Build/gcc/ fsanitize_address29346.c -fno-diagnostics-show-caret -fdiagnostics-color=never -fsanitize=address -lm -o fsanitize_address29346.exe.
>> /usr/aarch64-suse-linux/bin/ld: cannot find libasan_preinit.o: No such file or directory.
>> /usr/aarch64-suse-linux/bin/ld: cannot find -lasan.
>> collect2: error: ld returned 1 exit status.
>> compiler exited with status 1
>> output is:
>> /usr/aarch64-suse-linux/bin/ld: cannot find libasan_preinit.o: No such file or directory.
>> /usr/aarch64-suse-linux/bin/ld: cannot find -lasan.
>> collect2: error: ld returned 1 exit status.
>>
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O0
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O1
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O2
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O3
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O0 -g
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O1 -g
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O2 -g
>> UNSUPPORTED: gcc.dg/sancov/asan.c   -O3 -g
>
> We have to move the testcase from sancov to asan directory, otherwise
> the test won't work (and it didn't work even on x86_64, since the
> effective target test always failed).
>
> 2016-02-04  Uros Bizjak  <ubizjak@gmail.com>
>
>     * gcc.dg/sancov/asan.c: Move to ...
>     * gcc.dg/asan/sancov-1.c: ... here.
>
> The patch was tested on x86_64-linux-gnu and I have double checked
> that the testcase passes.

Now committed to mainline SVN.

Uros.
diff mbox

Patch

Index: gcc.dg/asan/sancov-1.c
===================================================================
--- gcc.dg/asan/sancov-1.c	(nonexistent)
+++ gcc.dg/asan/sancov-1.c	(working copy)
@@ -0,0 +1,19 @@ 
+/* Test coverage/asan interaction:
+     - coverage instruments __asan_init ctor (thus 4 covarage callbacks)
+     - coverage does not instrument asan-emitted basic blocks
+     - asan considers coverage callback as "nonfreeing" (thus 1 asan store
+       callback.  */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
+/* { dg-options "-fsanitize-coverage=trace-pc -fsanitize=address -fdump-tree-optimized" } */
+
+void foo(volatile int *a, int *b)
+{
+  *a = 1;
+  if (*b)
+    *a = 2;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4 \\(" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store4 \\(" 1 "optimized" } } */
Index: gcc.dg/sancov/asan.c
===================================================================
--- gcc.dg/sancov/asan.c	(revision 233127)
+++ gcc.dg/sancov/asan.c	(nonexistent)
@@ -1,18 +0,0 @@ 
-/* Test coverage/asan interaction:
-     - coverage instruments __asan_init ctor (thus 4 covarage callbacks)
-     - coverage does not instrument asan-emitted basic blocks
-     - asan considers coverage callback as "nonfreeing" (thus 1 asan store
-       callback.  */
-/* { dg-do compile { target fsanitize_address } } */
-/* { dg-options "-fsanitize-coverage=trace-pc -fsanitize=address -fdump-tree-optimized" } */
-
-void foo(volatile int *a, int *b)
-{
-  *a = 1;
-  if (*b)
-    *a = 2;
-}
-
-/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 4 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4 \\(" 1 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store4 \\(" 1 "optimized" } } */