|
From: <sv...@va...> - 2015-02-27 11:34:15
|
Author: rhyskidd
Date: Fri Feb 27 11:34:07 2015
New Revision: 14968
Log:
Fix memcheck/tests/err_disable4 test on OS X
bz#344621
- Unnamed semaphores are not supported on OS X, must use named semaphores.
- To use named semaphores sem_open() instead of sem_init() utilised.
- Test case updated accordingly across all platforms.
Before:
== 586 tests, 240 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==
After:
== 586 tests, 239 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==
Modified:
trunk/NEWS
trunk/memcheck/tests/err_disable4.c
trunk/memcheck/tests/err_disable4.stderr.exp
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Fri Feb 27 11:34:07 2015
@@ -110,6 +110,7 @@
344499 Fix compilation for Linux kernel >= 4. With this, also require
a Linux kernel >= 2.6 as 2.4 is mostly untested and might trigger
obvious and non-obvious issues
+344621 Fix memcheck/tests/err_disable4 test on OS X
n-i-bz Provide implementations of certain compiler builtins to support
compilers who may not provide those
n-i-bz Old STABS code is still being compiled, but never used. Remove it.
Modified: trunk/memcheck/tests/err_disable4.c
==============================================================================
--- trunk/memcheck/tests/err_disable4.c (original)
+++ trunk/memcheck/tests/err_disable4.c Fri Feb 27 11:34:07 2015
@@ -26,7 +26,12 @@
#include "../include/valgrind.h"
char* block = NULL;
+# if !defined(VGO_darwin)
sem_t sem;
+# else
+sem_t *sem;
+static const char *semname = "Semaphore1";
+# endif
__attribute__((noinline)) void usechar ( char c )
{
@@ -45,7 +50,11 @@
{
// Disable error reporting, then wait to exit
VALGRIND_DISABLE_ERROR_REPORTING;
+# if !defined(VGO_darwin)
int r = sem_wait(&sem); assert(!r);
+# else
+ int r = sem_wait(sem); assert(!r);
+# endif
return NULL;
}
@@ -53,7 +62,11 @@
{
// make an error, then wait to exit
err();
+# if !defined(VGO_darwin)
int r = sem_wait(&sem); assert(!r);
+# else
+ int r = sem_wait(sem); assert(!r);
+# endif
return NULL;
}
@@ -73,7 +86,11 @@
NTHREADS);
// set up the semaphore
+# if !defined(VGO_darwin)
r = sem_init(&sem, 0, 0); assert(!r);
+# else
+ sem = sem_open(semname, O_CREAT, 0777, 0); assert(!(sem == SEM_FAILED));
+# endif
pthread_attr_t attr;
r = pthread_attr_init(&attr); assert(!r);
@@ -87,7 +104,11 @@
// let them all exit
for (i = 0; i < NTHREADS; i++) {
+# if !defined(VGO_darwin)
r = sem_post(&sem); assert(!r);
+# else
+ r = sem_post(sem); assert(!r);
+# endif
}
// join
@@ -110,7 +131,11 @@
// let them all exit
for (i = 0; i < NTHREADS; i++) {
+# if !defined(VGO_darwin)
r = sem_post(&sem); assert(!r);
+# else
+ r = sem_post(sem); assert(!r);
+# endif
}
// join
Modified: trunk/memcheck/tests/err_disable4.stderr.exp
==============================================================================
--- trunk/memcheck/tests/err_disable4.stderr.exp (original)
+++ trunk/memcheck/tests/err_disable4.stderr.exp Fri Feb 27 11:34:07 2015
@@ -1500,12 +1500,12 @@
Thread x:
Invalid read of size 1
- at 0x........: err (err_disable4.c:41)
- by 0x........: child_fn_2 (err_disable4.c:55)
+ at 0x........: err (err_disable4.c:46)
+ by 0x........: child_fn_2 (err_disable4.c:64)
...
Address 0x........ is 5 bytes inside a block of size 10 free'd
at 0x........: free (vg_replace_malloc.c:...)
- by 0x........: main (err_disable4.c:68)
+ by 0x........: main (err_disable4.c:81)
-------- Got 498 errors (expected 498 ==> PASS) ------
|