public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] c/c++ asan tests for FreeBSD
@ 2015-11-29 20:03 Andreas Tobler
  2015-11-29 22:10 ` Andreas Tobler
  2015-11-30 10:32 ` Bernd Schmidt
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Tobler @ 2015-11-29 20:03 UTC (permalink / raw)
  To: GCC Patches

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

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?

Thanks,
Andreas

2015-11-29  Andreas Tobler  <andreast@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* 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.

[-- Attachment #2: asan-tests-freebsd.diff --]
[-- Type: text/plain, Size: 5626 bytes --]

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* 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* 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* } }
 

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

end of thread, other threads:[~2015-11-30 19:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-29 20:03 [patch] c/c++ asan tests for FreeBSD Andreas Tobler
2015-11-29 22:10 ` Andreas Tobler
2015-11-30 10:32 ` Bernd Schmidt
2015-11-30 12:12   ` Andreas Tobler
2015-11-30 16:22     ` Bernd Schmidt
2015-11-30 16:33       ` Jakub Jelinek
2015-11-30 20:18         ` Andreas Tobler

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