On 29.11.15 20:32, Andreas Tobler wrote:
Hi all,

the attached patch prepares the testsuite, c and c++, for the upcoming
ASAN support for FreeBSD (x86_64 first).

I tested the patch on CentOS7.1 x86_64 and on FreeBSD x86_64.
Results can be seen on the list.

Is this ok for trunk?

Aehm, an add-on, i?86 works also.

ChangeLog changed and g++.dg/asan/asan_test.C modified.

Ok?

Thanks,
Andreas


2015-11-29  Andreas Tobler  <andre...@gcc.gnu.org>

        * c-c++-common/asan/no-asan-stack.c: Add x86_64-*-freebsd*.
        * c-c++-common/asan/asan-interface-1.c: Add *-*-freebsd*.
        * c-c++-common/asan/pr59063-1.c: Likewise.
        * c-c++-common/asan/pr59063-2.c: Likewise.
        * g++.dg/asan/asan_test.C: Add *-*-freebsd*, i?86-*-freebsd* and
        x86_64-*-freebsd* where needed.
        Move the -ldl addtional-option to a new line, used for all non
        FreeBSD targets.
        * g++.dg/asan/asan_test_utils.h: Include the <unistd.h> for __linux__
        and __FreeBSD__.
        * g++.dg/asan/interception-failure-test-1.C: Add *-*-freebsd*.
        * g++.dg/asan/interception-malloc-test-1.C: Likewise.
        * g++.dg/asan/interception-test-1.C: Likewise.



Index: c-c++-common/asan/asan-interface-1.c
===================================================================
--- c-c++-common/asan/asan-interface-1.c        (revision 231047)
+++ c-c++-common/asan/asan-interface-1.c        (working copy)
@@ -1,6 +1,6 @@
 /* Check that interface headers work. */
 
-/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-do run { target { *-*-linux* *-*-freebsd* } } } */
 
 #include <sanitizer/asan_interface.h>
 
Index: c-c++-common/asan/no-asan-stack.c
===================================================================
--- c-c++-common/asan/no-asan-stack.c   (revision 231047)
+++ c-c++-common/asan/no-asan-stack.c   (working copy)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { { i?86-*-linux* x86_64-*-linux* } && lp64 } } } 
*/
+/* { dg-do compile { target { { i?86-*-linux* x86_64-*-linux* 
x86_64-*-freebsd* } && lp64 } } } */
 /* { dg-options "--param asan-stack=0" } */
 #include <string.h>
 
Index: c-c++-common/asan/pr59063-1.c
===================================================================
--- c-c++-common/asan/pr59063-1.c       (revision 231047)
+++ c-c++-common/asan/pr59063-1.c       (working copy)
@@ -1,4 +1,4 @@
-/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-do run { target { *-*-linux* *-*-freebsd* } } } */
 
 #include <time.h>
 static int weak_gettime (clockid_t clk_id, struct timespec *tp)
Index: c-c++-common/asan/pr59063-2.c
===================================================================
--- c-c++-common/asan/pr59063-2.c       (revision 231047)
+++ c-c++-common/asan/pr59063-2.c       (working copy)
@@ -1,4 +1,4 @@
-/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-do run { target { *-*-linux* *-*-freebsd* } } } */
 /* { dg-options "-static-libasan" } */
 
 #include <time.h>
Index: g++.dg/asan/asan_test.C
===================================================================
--- g++.dg/asan/asan_test.C     (revision 231047)
+++ g++.dg/asan/asan_test.C     (working copy)
@@ -1,13 +1,14 @@
-// { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && sse2_runtime } 
} }
+// { dg-do run { target { { i?86-*-linux* x86_64-*-linux* i?86-*freebsd* 
x86_64-*-freebsd* } && sse2_runtime } } }
 // { dg-skip-if "" { *-*-* } { "*" } { "-O2" } }
 // { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
 // { dg-additional-sources "asan_globals_test-wrapper.cc" }
-// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Wno-format 
-Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 
-DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }
+// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Wno-format 
-Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 
-DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread" }
+// { dg-additional-options "-ldl" { target { ! *-*-freebsd* } } }
 // { dg-additional-options "-DASAN_NEEDS_SEGV=1" { target { ! arm*-*-* } } }
 // { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target 
arm*-*-* } }
 // { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! 
run_expensive_tests } } }
-// { dg-additional-options "-msse2" { target { i?86-*-linux* x86_64-*-linux* } 
} }
-// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
+// { dg-additional-options "-msse2" { target { i?86-*-linux* x86_64-*-linux* 
i?86-*freebsd* x86_64-*-freebsd* } } }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu 
*-*-freebsd* } } }
 // { dg-final { asan-gtest } }
 
 #include "asan_test.cc"
Index: g++.dg/asan/asan_test_utils.h
===================================================================
--- g++.dg/asan/asan_test_utils.h       (revision 231047)
+++ g++.dg/asan/asan_test_utils.h       (working copy)
@@ -40,6 +40,9 @@
 # include <sys/types.h>
 # include <sys/stat.h>
 # include <fcntl.h>
+#endif
+
+#if defined(__linux__) || defined(__FreeBSD__)
 #include <unistd.h>
 #endif
 
Index: g++.dg/asan/interception-failure-test-1.C
===================================================================
--- g++.dg/asan/interception-failure-test-1.C   (revision 231047)
+++ g++.dg/asan/interception-failure-test-1.C   (working copy)
@@ -3,7 +3,7 @@
 
 // { dg-do run }
 // { dg-options "-fno-builtin-malloc -fno-builtin-free" }
-// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu 
*-*-freebsd* } } }
 
 #include <stdlib.h>
 #include <stdio.h>
Index: g++.dg/asan/interception-malloc-test-1.C
===================================================================
--- g++.dg/asan/interception-malloc-test-1.C    (revision 231047)
+++ g++.dg/asan/interception-malloc-test-1.C    (working copy)
@@ -1,8 +1,8 @@
 // ASan interceptor can be accessed with __interceptor_ prefix.
 
-// { dg-do run { target *-*-linux* } }
+// { dg-do run { target *-*-linux* *-*-freebsd* } }
 // { dg-options "-fno-builtin-free" }
-// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu 
*-*-freebsd* } } }
 // { dg-shouldfail "asan" }
 
 #include <stdlib.h>
Index: g++.dg/asan/interception-test-1.C
===================================================================
--- g++.dg/asan/interception-test-1.C   (revision 231047)
+++ g++.dg/asan/interception-test-1.C   (working copy)
@@ -2,7 +2,7 @@
 
 // { dg-do run }
 // { dg-options "-fno-builtin-malloc -fno-builtin-free" }
-// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu 
*-*-freebsd* } } }
 // { dg-shouldfail "asan" }
 // { dg-skip-if "Darwin uses mac function interposition" { *-*-darwin* } }
 

Reply via email to