From: Yann Collet Date: Mon, 6 Jun 2016 17:42:47 +0000 (+0200) Subject: removed msan tests, due to issues with `datagen.c` X-Git-Tag: v0.7.0^2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f72dc6091b24141db660eeb6f56b482c9f722155;p=thirdparty%2Fzstd.git removed msan tests, due to issues with `datagen.c` --- diff --git a/.travis.yml b/.travis.yml index 6a2e90309..879aff8a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,9 +22,6 @@ matrix: - os: linux sudo: false env: PLATFORM="Ubuntu 12.04 container" MAKE_PARAM=asan - - os: linux - sudo: false - env: PLATFORM="Ubuntu 12.04 container" MAKE_PARAM=msan - os: linux sudo: false env: PLATFORM="Ubuntu 12.04 container" MAKE_PARAM=zlibwrapper diff --git a/programs/datagen.c b/programs/datagen.c index fd9b2316f..ec118f5d1 100644 --- a/programs/datagen.c +++ b/programs/datagen.c @@ -27,9 +27,9 @@ * Includes **************************************/ #include /* malloc */ -#include /* FILE, fwrite */ +#include /* FILE, fwrite, fprintf */ #include /* memcpy */ -#include "mem.h" +#include "mem.h" /* U32 */ /*-************************************ @@ -92,7 +92,7 @@ static void RDG_fillLiteralDistrib(BYTE* ldt, double ld) for (u=0; u lastChar) character = firstChar; } @@ -108,43 +108,52 @@ static BYTE RDG_genChar(U32* seed, const BYTE* ldt) } -#define RDG_RAND15BITS ( RDG_rand(seed) & 0x7FFF ) -#define RDG_RANDLENGTH ( (RDG_rand(seed) & 7) ? (RDG_rand(seed) & 0xF) : (RDG_rand(seed) & 0x1FF) + 0xF) +static U32 RDG_rand15Bits (unsigned* seedPtr) +{ + return RDG_rand(seedPtr) & 0x7FFF; +} + +static U32 RDG_randLength(unsigned* seedPtr) +{ + if (RDG_rand(seedPtr) & 7) + return (RDG_rand(seedPtr) & 0xF); + return (RDG_rand(seedPtr) & 0x1FF) + 0xF; +} + void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, const BYTE* ldt, unsigned* seedPtr) { - BYTE* buffPtr = (BYTE*)buffer; - const U32 matchProba32 = (U32)(32768 * matchProba); + BYTE* const buffPtr = (BYTE*)buffer; + U32 const matchProba32 = (U32)(32768 * matchProba); size_t pos = prefixSize; - U32* seed = seedPtr; U32 prevOffset = 1; /* special case : sparse content */ while (matchProba >= 1.0) { - size_t size0 = RDG_rand(seed) & 3; + size_t size0 = RDG_rand(seedPtr) & 3; size0 = (size_t)1 << (16 + size0 * 2); - size0 += RDG_rand(seed) & (size0-1); /* because size0 is power of 2*/ + size0 += RDG_rand(seedPtr) & (size0-1); /* because size0 is power of 2*/ if (buffSize < pos + size0) { memset(buffPtr+pos, 0, buffSize-pos); return; } memset(buffPtr+pos, 0, size0); pos += size0; - buffPtr[pos-1] = RDG_genChar(seed, ldt); + buffPtr[pos-1] = RDG_genChar(seedPtr, ldt); continue; } /* init */ - if (pos==0) buffPtr[0] = RDG_genChar(seed, ldt), pos=1; + if (pos==0) buffPtr[0] = RDG_genChar(seedPtr, ldt), pos=1; /* Generate compressible data */ while (pos < buffSize) { /* Select : Literal (char) or Match (within 32K) */ - if (RDG_RAND15BITS < matchProba32) { + if (RDG_rand15Bits(seedPtr) < matchProba32) { /* Copy (within 32K) */ - U32 const length = RDG_RANDLENGTH + 4; + U32 const length = RDG_randLength(seedPtr) + 4; U32 const d = (U32) MIN(pos + length , buffSize); - U32 const repeatOffset = (RDG_rand(seed) & 15) == 2; - U32 const randOffset = RDG_RAND15BITS + 1; + U32 const repeatOffset = (RDG_rand(seedPtr) & 15) == 2; + U32 const randOffset = RDG_rand15Bits(seedPtr) + 1; U32 const offset = repeatOffset ? prevOffset : (U32) MIN(randOffset , pos); size_t match = pos - offset; //TRACE("pos : %u; offset: %u ; length : %u \n", (U32)pos, offset, length); @@ -152,9 +161,9 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match prevOffset = offset; } else { /* Literal (noise) */ - U32 const length = RDG_RANDLENGTH; + U32 const length = RDG_randLength(seedPtr); U32 const d = (U32) MIN(pos + length, buffSize); - while (pos < d) buffPtr[pos++] = RDG_genChar(seed, ldt); + while (pos < d) buffPtr[pos++] = RDG_genChar(seedPtr, ldt); } } } @@ -174,7 +183,7 @@ void RDG_genStdout(unsigned long long size, double matchProba, double litProba, { size_t const stdBlockSize = 128 KB; size_t const stdDictSize = 32 KB; - BYTE* buff = (BYTE*)malloc(stdDictSize + stdBlockSize); + BYTE* const buff = (BYTE*)malloc(stdDictSize + stdBlockSize); U64 total = 0; BYTE ldt[LTSIZE];