PERFORCE change 168658 for review
Stanislav Sedov
stas at FreeBSD.org
Fri Sep 18 13:24:41 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=168658
Change 168658 by stas at stas_deglitch on 2009/09/18 13:24:03
- Make tests build.
Affected files ...
.. //depot/projects/valgrind/drd/tests/Makefile.am#3 edit
.. //depot/projects/valgrind/exp-ptrcheck/tests/Makefile.am#3 edit
.. //depot/projects/valgrind/helgrind/tests/tc17_sembar.c#3 edit
.. //depot/projects/valgrind/helgrind/tests/tc23_bogus_condwait.c#3 edit
.. //depot/projects/valgrind/helgrind/tests/tc24_nonzero_sem.c#3 edit
.. //depot/projects/valgrind/memcheck/tests/amd64/int3-amd64.c#3 edit
.. //depot/projects/valgrind/memcheck/tests/str_tester.c#5 edit
.. //depot/projects/valgrind/memcheck/tests/x86/Makefile.am#5 edit
.. //depot/projects/valgrind/none/tests/Makefile.am#6 edit
.. //depot/projects/valgrind/none/tests/amd64/bug156404-amd64.c#3 edit
.. //depot/projects/valgrind/none/tests/faultstatus.c#4 edit
.. //depot/projects/valgrind/none/tests/pth_atfork1.c#4 edit
.. //depot/projects/valgrind/tests/arch_test.c#2 edit
.. //depot/projects/valgrind/tests/malloc.h#2 edit
.. //depot/projects/valgrind/tests/os_test.c#2 edit
.. //depot/projects/valgrind/tests/sys_mman.h#2 edit
Differences ...
==== //depot/projects/valgrind/drd/tests/Makefile.am#3 (text+ko) ====
@@ -273,8 +273,10 @@
if HAVE_BUILTIN_ATOMIC
check_PROGRAMS += annotate_rwlock atomic_var circular_buffer
+if !VGCONF_OS_IS_FREEBSD
check_PROGRAMS += tsan_unittest
endif
+endif
if HAVE_OPENMP
check_PROGRAMS += omp_matinv omp_prime omp_printf
==== //depot/projects/valgrind/exp-ptrcheck/tests/Makefile.am#3 (text+ko) ====
@@ -72,9 +72,11 @@
# DDD: not sure if these ones should work on Darwin or not... if not, should
# be moved into x86-linux/.
if ! VGCONF_OS_IS_DARWIN
+if ! VGCONF_OS_IS_FREEBSD
check_PROGRAMS += \
ccc
endif
+endif
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
@@ -105,12 +107,17 @@
preen_invars_LDADD = -ldl
preen_invars_LDFLAGS = $(AM_FLAG_M3264_PRI)
else
+if VGCONF_OS_IS_FREEBSD
+ preen_invars_LDFLAGS = $(AM_FLAG_M3264_PRI) \
+ -Wl,-rpath,$(top_builddir)/memcheck/tests
+else
preen_invars_LDADD = -ldl
preen_invars_LDFLAGS = $(AM_FLAG_M3264_PRI) \
-Wl,-rpath,$(top_builddir)/memcheck/tests
endif
endif
endif
+endif
preen_invars_so_so_SOURCES = preen_invars_so.c # For automake-1.7.
preen_invars_so_so_CFLAGS = $(AM_CFLAGS) -fpic
==== //depot/projects/valgrind/helgrind/tests/tc17_sembar.c#3 (text+ko) ====
@@ -4,6 +4,9 @@
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
+#if defined(VGO_freebsd)
+# include <sys/fcntl.h>
+#endif
/* This is really a test of semaphore handling
(sem_{init,destroy,post,wait}). Using semaphores a barrier
function is created. Helgrind-3.3 (p.k.a Thrcheck) does understand
@@ -222,7 +225,7 @@
{
#if defined(VGO_linux)
return sem_init(s, pshared, count);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
char name[100];
sem_t** fakeptr = (sem_t**)s;
assert(sizeof(sem_t) >= sizeof(sem_t*));
@@ -244,7 +247,7 @@
{
#if defined(VGO_linux)
return sem_destroy(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
sem_t** fakeptr = (sem_t**)s;
return sem_close(*fakeptr);
#else
@@ -256,7 +259,7 @@
{
#if defined(VGO_linux)
return sem_wait(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
return sem_wait( *(sem_t**)s );
#else
# error "Unsupported OS"
@@ -267,7 +270,7 @@
{
#if defined(VGO_linux)
return sem_post(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
return sem_post( *(sem_t**)s );
#else
# error "Unsupported OS"
==== //depot/projects/valgrind/helgrind/tests/tc23_bogus_condwait.c#3 (text+ko) ====
@@ -6,6 +6,9 @@
#include <unistd.h>
#include <semaphore.h>
#include <stdio.h>
+#if defined(VGO_freebsd)
+#include <sys/fcntl.h>
+#endif
pthread_mutex_t mx[4];
pthread_cond_t cv;
pthread_rwlock_t rwl;
@@ -98,7 +101,7 @@
{
#if defined(VGO_linux)
return sem_init(s, pshared, count);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
char name[100];
sem_t** fakeptr = (sem_t**)s;
assert(sizeof(sem_t) >= sizeof(sem_t*));
@@ -120,7 +123,7 @@
{
#if defined(VGO_linux)
return sem_destroy(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
sem_t** fakeptr = (sem_t**)s;
return sem_close(*fakeptr);
#else
@@ -132,7 +135,7 @@
{
#if defined(VGO_linux)
return sem_wait(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
return sem_wait( *(sem_t**)s );
#else
# error "Unsupported OS"
@@ -143,7 +146,7 @@
{
#if defined(VGO_linux)
return sem_post(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
return sem_post( *(sem_t**)s );
#else
# error "Unsupported OS"
==== //depot/projects/valgrind/helgrind/tests/tc24_nonzero_sem.c#3 (text+ko) ====
@@ -7,6 +7,9 @@
#include <semaphore.h>
#include <assert.h>
#include <unistd.h>
+#if defined(VGO_freebsd)
+# include <sys/fcntl.h>
+#endif
#define N_THREADS 3
static int my_sem_init(sem_t*, char*, int, unsigned);
static int my_sem_destroy(sem_t*);
@@ -45,7 +48,7 @@
{
#if defined(VGO_linux)
return sem_init(s, pshared, count);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
char name[100];
sem_t** fakeptr = (sem_t**)s;
assert(sizeof(sem_t) >= sizeof(sem_t*));
@@ -67,7 +70,7 @@
{
#if defined(VGO_linux)
return sem_destroy(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
sem_t** fakeptr = (sem_t**)s;
return sem_close(*fakeptr);
#else
@@ -79,7 +82,7 @@
{
#if defined(VGO_linux)
return sem_wait(s);
-#elif defined(VGO_darwin)
+#elif defined(VGO_darwin) || defined(VGO_freebsd)
return sem_wait( *(sem_t**)s );
#else
# error "Unsupported OS"
==== //depot/projects/valgrind/memcheck/tests/amd64/int3-amd64.c#3 (text+ko) ====
@@ -8,12 +8,17 @@
static char* rip_at_sig = NULL;
+
static void int_handler(int signum, siginfo_t *si, void *uc_arg)
{
ucontext_t *uc = (ucontext_t *)uc_arg;
/* Note that uc->uc_mcontext is an embedded struct, not a pointer */
mcontext_t *mc = &(uc->uc_mcontext);
+#if defined(__FreeBSD__)
+ void *pc = (void*)mc->mc_rip;
+#else
void *pc = (void*)mc->gregs[REG_RIP];
+#endif
printf("in int_handler, RIP is ...\n");
rip_at_sig = pc;
}
==== //depot/projects/valgrind/memcheck/tests/str_tester.c#5 (text+ko) ====
@@ -182,7 +182,6 @@
}
}
-#if !defined(__FreeBSD__)
static void
test_stpcpy (void)
{
@@ -266,7 +265,7 @@
}
// DDD: better done by testing for the function.
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
static void
test_stpncpy (void)
{
@@ -505,7 +504,7 @@
#endif /* !defined(_AIX) */
// DDD: better done by testing for the function.
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(_AIX) && !defined(__APPLE__) && !defined(__FreeBSD__)
static void
test_rawmemchr (void)
{
@@ -902,9 +901,8 @@
equal(one+2, "b", 49);
equal(one+4, "c", 50);
-#if !defined(__FreeBSD__)
{
-# if !defined(_AIX) && !defined(__APPLE__)
+# if !defined(_AIX) && !defined(__APPLE__) && !defined(__FreeBSD__)
char text[] = "This,is,a,test";
char *list = strdupa (text);
equal (strsep (&list, ","), "This", 51);
@@ -914,7 +912,6 @@
check (strsep (&list, ",") == NULL, 55);
# endif
}
-#endif
cp = strcpy(one, "a,b, c,, ,d,");
equal(strsep(&cp, ","), "a", 56); /* Different separators. */
@@ -1387,11 +1384,10 @@
/* Test strcpy next because we need it to set up other tests. */
test_strcpy ();
-#if !defined(__FreeBSD__)
/* A closely related function is stpcpy. */
test_stpcpy ();
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
/* stpncpy. */
test_stpncpy ();
#endif
==== //depot/projects/valgrind/memcheck/tests/x86/Makefile.am#5 (text+ko) ====
@@ -34,7 +34,6 @@
pushfpopf \
pushfw_x86 \
pushpopmem \
- sse_memory \
tronical \
xor-undef-x86
==== //depot/projects/valgrind/none/tests/Makefile.am#6 (text+ko) ====
@@ -220,9 +220,13 @@
if VGCONF_OS_IS_AIX5
res_search_LDADD = -lpthread
else
+if VGCONF_OS_IS_FREEBSD
+ res_search_LDADD = -lpthread
+else
res_search_LDADD = -lresolv -lpthread
resolv_LDADD = -lresolv -lpthread
endif
+endif
semlimit_LDADD = -lpthread
thread_exits_LDADD = -lpthread
threaded_fork_LDADD = -lpthread
==== //depot/projects/valgrind/none/tests/amd64/bug156404-amd64.c#3 (text+ko) ====
@@ -14,6 +14,10 @@
#define VG_STRINGIFZ(__str) #__str
#define VG_STRINGIFY(__str) VG_STRINGIFZ(__str)
+#if defined(__FreeBSD__)
+# define __NR_readlink 58
+#endif
+
#define __NR_READLINK VG_STRINGIFY(__NR_readlink)
extern long my_readlink ( const char* path );
==== //depot/projects/valgrind/none/tests/faultstatus.c#4 (text+ko) ====
@@ -138,7 +138,6 @@
{
const struct test tests[] = {
#define T(n, sig, code, addr) { test##n, sig, code, addr }
-#if !defined(__FreeBSD__) || __FreeBSD__ >= 5
T(1, SIGSEGV, SEGV_MAPERR, BADADDR),
T(2, SIGSEGV, SEGV_ACCERR, mapping),
T(3, SIGBUS, BUS_ADRERR, &mapping[FILESIZE+10]),
==== //depot/projects/valgrind/none/tests/pth_atfork1.c#4 (text+ko) ====
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#include <errno.h>
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(_AIX) && !defined(__APPLE__) && !defined(__FreeBSD__)
# include <error.h>
#endif
#include <stdlib.h>
@@ -27,7 +27,7 @@
#include <sys/wait.h>
#include <stdio.h>
-#if defined(_AIX) || defined(__APPLE__)
+#if defined(_AIX) || defined(__APPLE__) || defined(__FreeBSD__)
#include <string.h> /* strerror */
static void error (int status, int errnum, char* msg)
{
==== //depot/projects/valgrind/tests/arch_test.c#2 (text+ko) ====
@@ -32,10 +32,10 @@
static Bool go(char* arch)
{
-#if defined(VGP_x86_linux) || defined(VGP_x86_darwin)
+#if defined(VGP_x86_linux) || defined(VGP_x86_darwin) || defined(VGP_x86_freebsd)
if ( 0 == strcmp( arch, "x86" ) ) return True;
-#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin)
+#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) || defined(VGP_amd64_freebsd)
if ( 0 == strcmp( arch, "x86" ) ) return True;
if ( 0 == strcmp( arch, "amd64" ) ) return True;
==== //depot/projects/valgrind/tests/malloc.h#2 (text+ko) ====
@@ -3,6 +3,8 @@
#include <stdlib.h>
#if defined(VGO_darwin)
# include <malloc/malloc.h>
+#elif defined(VGO_freebsd)
+# include <stdlib.h>
#else
# include <malloc.h>
#endif
@@ -14,7 +16,7 @@
static void* memalign16(size_t szB)
{
void* x;
-#if defined(VGO_darwin)
+#if defined(VGO_darwin) || defined(VGO_freebsd)
// Darwin lacks memalign, but its malloc is always 16-aligned anyway.
x = malloc(szB);
#else
==== //depot/projects/valgrind/tests/os_test.c#2 (text+ko) ====
@@ -23,6 +23,7 @@
"linux",
"aix5",
"darwin",
+ "freebsd",
NULL
};
@@ -37,6 +38,9 @@
#elif defined(VGO_darwin)
if ( 0 == strcmp( OS, "darwin" ) ) return True;
+#elif defined(VGO_freebsd)
+ if ( 0 == strcmp( OS, "darwin" ) ) return True;
+
#else
# error Unknown OS
#endif // VGO_*
==== //depot/projects/valgrind/tests/sys_mman.h#2 (text+ko) ====
@@ -2,7 +2,7 @@
#include <sys/mman.h>
-#if defined(VGO_darwin)
+#if defined(VGO_darwin) || defined(VGO_freebsd)
# define MAP_ANONYMOUS MAP_ANON
#endif
More information about the p4-projects
mailing list