From: Rhys Kidd Date: Sat, 15 Aug 2015 10:47:55 +0000 (+0000) Subject: Increase test coverage on OS X, by re-enabling the none/tests/*/movbe regression... X-Git-Tag: svn/VALGRIND_3_11_0~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a014b4f974784cec2be4fefa9c0b94555f592d1;p=thirdparty%2Fvalgrind.git Increase test coverage on OS X, by re-enabling the none/tests/*/movbe regression tests with a handy memalign() shim. n-i-bz $ perl tests/vg_regtest none/tests/x86/movbe none/tests/amd64/movbe movbe: valgrind -q ./movbe movbe: valgrind -q ./movbe == 2 tests, 0 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == On OS X 10.10 Before: == 592 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures == After: == 594 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures == git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15549 --- diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am index 53acc50220..e1fff6c022 100644 --- a/none/tests/amd64/Makefile.am +++ b/none/tests/amd64/Makefile.am @@ -111,6 +111,9 @@ endif if BUILD_LZCNT_TESTS check_PROGRAMS += lzcnt64 endif +if BUILD_MOVBE_TESTS + check_PROGRAMS += movbe +endif if BUILD_SSE42_TESTS check_PROGRAMS += \ pcmpstr64 pcmpxstrx64 sse4-64 crc32 aes \ @@ -144,9 +147,6 @@ if ! VGCONF_OS_IS_DARWIN if BUILD_LOOPNEL_TESTS check_PROGRAMS += loopnel endif -if BUILD_MOVBE_TESTS - check_PROGRAMS += movbe -endif if BUILD_AVX_TESTS if BUILD_VPCLMULQDQ_TESTS check_PROGRAMS += avx-1 diff --git a/none/tests/amd64/movbe.c b/none/tests/amd64/movbe.c index 4b23696b81..603e140cbf 100644 --- a/none/tests/amd64/movbe.c +++ b/none/tests/amd64/movbe.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include "tests/malloc.h" typedef unsigned char UChar; typedef unsigned int UInt; @@ -43,7 +43,7 @@ void randBlock ( Block* b ) \ __attribute__ ((noinline)) static void test_##_name ( void ) \ { \ - Block* b = memalign(32, sizeof(Block)); \ + Block* b = memalign32(sizeof(Block)); \ randBlock(b); \ printf("%s\n", #_name); \ showBlock("before", b); \ diff --git a/none/tests/x86/Makefile.am b/none/tests/x86/Makefile.am index b0d10ef683..15d1e3e77b 100644 --- a/none/tests/x86/Makefile.am +++ b/none/tests/x86/Makefile.am @@ -119,10 +119,10 @@ endif if BUILD_LZCNT_TESTS check_PROGRAMS += lzcnt32 endif -if !VGCONF_OS_IS_DARWIN if BUILD_MOVBE_TESTS - check_PROGRAMS += movbe + check_PROGRAMS += movbe endif +if !VGCONF_OS_IS_DARWIN if !SOLARIS_SUN_STUDIO_AS # Sun Studio assembler fails to assemble the bound instruction check_PROGRAMS += faultstatus diff --git a/none/tests/x86/movbe.c b/none/tests/x86/movbe.c index d4f49536b0..8821462f92 100644 --- a/none/tests/x86/movbe.c +++ b/none/tests/x86/movbe.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include "tests/malloc.h" typedef unsigned char UChar; typedef unsigned int UInt; @@ -43,7 +43,7 @@ void randBlock ( Block* b ) \ __attribute__ ((noinline)) static void test_##_name ( void ) \ { \ - Block* b = memalign(32, sizeof(Block)); \ + Block* b = memalign32(sizeof(Block)); \ randBlock(b); \ printf("%s\n", #_name); \ showBlock("before", b); \ diff --git a/tests/malloc.h b/tests/malloc.h index 0179b387cc..6a73dde1a9 100644 --- a/tests/malloc.h +++ b/tests/malloc.h @@ -23,5 +23,21 @@ static void* memalign16(size_t szB) assert(x); assert(0 == ((16-1) & (unsigned long)x)); return x; -} +} + +// Allocates a 32-aligned block. Asserts if the allocation fails. +__attribute__((unused)) +static void* memalign32(size_t szB) +{ + void* x; +#if defined(VGO_darwin) + // Darwin lacks memalign + posix_memalign((void **)&x, 32, szB); +#else + x = memalign(32, szB); +#endif + assert(x); + assert(0 == ((32-1) & (unsigned long)x)); + return x; +}