aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authornjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-05-28 01:53:07 +0000
committernjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-05-28 01:53:07 +0000
commitf76d27a697a7b0bf3b84490baf60623fc96a23af (patch)
tree682ff0946c0b8b501714e055ff1269c6b0bf5d91 /tests
parentda8549df7939ee3024938cdd8a4cc64e6c2279b8 (diff)
downloadvalgrind-f76d27a697a7b0bf3b84490baf60623fc96a23af.tar.gz
Merge the DARWIN branch onto the trunk.
I tried using 'svn merge' to do the merge but it did a terrible job and there were bazillions of conflicts. So instead I just took the diff between the branch and trunk at r10155, applied the diff to the trunk, 'svn add'ed the added files (no files needed to be 'svn remove'd) and committed. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/arch_test.c4
-rw-r--r--tests/asm.h8
-rwxr-xr-xtests/filter_libc5
-rw-r--r--tests/malloc.h11
-rw-r--r--tests/os_test.c6
-rw-r--r--tests/platform_test1
-rw-r--r--tests/sys_mman.h4
-rw-r--r--tests/x86_amd64_features.c2
9 files changed, 38 insertions, 7 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0350f0db1..2cf5a82f9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,3 +27,7 @@ check_PROGRAMS = \
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
+if VGCONF_OS_IS_DARWIN
+x86_amd64_features_CFLAGS = $(AM_CFLAGS) -mdynamic-no-pic
+endif
+
diff --git a/tests/arch_test.c b/tests/arch_test.c
index f6206e3ef..6771f4a6a 100644
--- a/tests/arch_test.c
+++ b/tests/arch_test.c
@@ -32,10 +32,10 @@ char* all_archs[] = {
static Bool go(char* arch)
{
-#if defined(VGP_x86_linux)
+#if defined(VGP_x86_linux) || defined(VGP_x86_darwin)
if ( 0 == strcmp( arch, "x86" ) ) return True;
-#elif defined(VGP_amd64_linux)
+#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin)
if ( 0 == strcmp( arch, "x86" ) ) return True;
if ( 0 == strcmp( arch, "amd64" ) ) return True;
diff --git a/tests/asm.h b/tests/asm.h
index 99f9cc5a5..e2c2524ed 100644
--- a/tests/asm.h
+++ b/tests/asm.h
@@ -5,7 +5,15 @@
// general, any symbol named in asm code should be wrapped by VG_SYM.
// This one is for use in inline asm in C files.
+#if defined(VGO_darwin)
+#define VG_SYM(x) "_"#x
+#else
#define VG_SYM(x) #x
+#endif
// This one is for use in asm files.
+#if defined(VGO_darwin)
+#define VG_SYM_ASM(x) _##x
+#else
#define VG_SYM_ASM(x) x
+#endif
diff --git a/tests/filter_libc b/tests/filter_libc
index a89fb8912..48c443ffc 100755
--- a/tests/filter_libc
+++ b/tests/filter_libc
@@ -15,8 +15,9 @@ while (<>)
s/ __GI___/ __/;
s/ __([a-z]*)_nocancel / $1 /;
- s/\(in \/.*libc.*\)$/(in \/...libc...)/;
- s/\(within \/.*libc.*\)$/(within \/...libc...)/;
+ # "libSystem*" occurs on Darwin.
+ s/\(in \/.*(libc|libSystem).*\)$/(in \/...libc...)/;
+ s/\(within \/.*(libc|libSystem).*\)$/(within \/...libc...)/;
# Remove the filename -- on some platforms (eg. Linux) it will be in
# libc, on some (eg. Darwin) it will be in the main executable.
diff --git a/tests/malloc.h b/tests/malloc.h
index 454d2cff6..0179b387c 100644
--- a/tests/malloc.h
+++ b/tests/malloc.h
@@ -1,7 +1,11 @@
// Replacement for malloc.h which factors out platform differences.
#include <stdlib.h>
-#include <malloc.h>
+#if defined(VGO_darwin)
+# include <malloc/malloc.h>
+#else
+# include <malloc.h>
+#endif
#include <assert.h>
@@ -10,7 +14,12 @@ __attribute__((unused))
static void* memalign16(size_t szB)
{
void* x;
+#if defined(VGO_darwin)
+ // Darwin lacks memalign, but its malloc is always 16-aligned anyway.
+ x = malloc(szB);
+#else
x = memalign(16, szB);
+#endif
assert(x);
assert(0 == ((16-1) & (unsigned long)x));
return x;
diff --git a/tests/os_test.c b/tests/os_test.c
index 065dbe536..a65115c64 100644
--- a/tests/os_test.c
+++ b/tests/os_test.c
@@ -22,6 +22,7 @@ typedef int Bool;
char* all_OSes[] = {
"linux",
"aix5",
+ "darwin",
NULL
};
@@ -31,7 +32,10 @@ static Bool go(char* OS)
if ( 0 == strcmp( OS, "linux" ) ) return True;
#elif defined(VGO_aix5)
- if ( 0 == strcmp( OS, "aix5" ) ) return True;
+ if ( 0 == strcmp( OS, "aix5" ) ) return True;
+
+#elif defined(VGO_darwin)
+ if ( 0 == strcmp( OS, "darwin" ) ) return True;
#else
# error Unknown OS
diff --git a/tests/platform_test b/tests/platform_test
index e91b9f7ab..4d5790113 100644
--- a/tests/platform_test
+++ b/tests/platform_test
@@ -13,6 +13,7 @@
all_platforms=
all_platforms="$all_platforms x86-linux amd64-linux ppc32-linux ppc64-linux"
all_platforms="$all_platforms ppc32-aix5 ppc64-aix5"
+all_platforms="$all_platforms x86-darwin amd64-darwin"
if [ $# -ne 2 ] ; then
echo "usage: platform_test <arch-type> <OS-type>"
diff --git a/tests/sys_mman.h b/tests/sys_mman.h
index 862bccc13..7ac64d54c 100644
--- a/tests/sys_mman.h
+++ b/tests/sys_mman.h
@@ -2,6 +2,10 @@
#include <sys/mman.h>
+#if defined(VGO_darwin)
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+
#include <assert.h>
#include <unistd.h>
diff --git a/tests/x86_amd64_features.c b/tests/x86_amd64_features.c
index 9d17805a8..06ebe5d1e 100644
--- a/tests/x86_amd64_features.c
+++ b/tests/x86_amd64_features.c
@@ -83,7 +83,7 @@ static Bool go(char* cpu)
return 1; // Feature not present.
}
-#else // defined(VGA_x86) || defined(VGA_amd64)
+#else
static Bool go(char* cpu)
{