static U32 g_displayLevel = 2;
#define DISPLAYUPDATE(l, ...) if (g_displayLevel>=l) { \
- if ((FUZ_GetMilliSpan(g_time) > g_refreshRate) || (g_displayLevel>=4)) \
- { g_time = FUZ_GetMilliStart(); DISPLAY(__VA_ARGS__); \
+ if ((FUZ_GetMilliSpan(g_displayTime) > g_refreshRate) || (g_displayLevel>=4)) \
+ { g_displayTime = FUZ_GetMilliStart(); DISPLAY(__VA_ARGS__); \
if (g_displayLevel>=4) fflush(stdout); } }
static const U32 g_refreshRate = 150;
-static U32 g_time = 0;
+static U32 g_displayTime = 0;
+
+static U32 g_testTime = 0;
/*********************************************************
U32 testNb = 0;
U32 coreSeed = seed, lseed = 0;
ZSTD_CCtx* ctx;
+ U32 startTime = FUZ_GetMilliStart();
/* allocation */
ctx = ZSTD_createCCtx();
FUZ_rand(&coreSeed);
/* test loop */
- for ( ; testNb <= nbTests; testNb++ )
+ for ( ; (testNb <= nbTests) || (FUZ_GetMilliSpan(startTime) < g_testTime); testNb++ )
{
size_t sampleSize, sampleStart, maxTestSize, totalTestSize;
size_t cSize, dSize, dSupSize, errorCode;
BYTE* sampleBuffer;
/* init */
- DISPLAYUPDATE(2, "\r%6u/%6u ", testNb, nbTests);
+ DISPLAYUPDATE(2, "\r%6u", testNb);
+ if (nbTests >= testNb) DISPLAYUPDATE(2, "\r/%6u", nbTests);
+ DISPLAYUPDATE(2, " ");
FUZ_rand(&coreSeed);
lseed = coreSeed ^ prime1;
buffNb = FUZ_rand(&lseed) & 127;
cSize += errorCode;
crcOrig = XXH64_digest(&crc64);
}
- DISPLAY("\rAll fuzzer tests completed \n");
+ DISPLAY("\r%u fuzzer tests completed \n", testNb);
_cleanup:
ZSTD_freeCCtx(ctx);
break;
case 'i':
- argument++;
+ argument++; g_testTime=0;
nbTests=0;
while ((*argument>='0') && (*argument<='9'))
{
}
break;
+ case 'T':
+ argument++;
+ nbTests=0; g_testTime=0;
+ while ((*argument>='0') && (*argument<='9'))
+ {
+ g_testTime *= 10;
+ g_testTime += *argument - '0';
+ argument++;
+ }
+ if (*argument=='m') g_testTime *=60, argument++;
+ if (*argument=='n') argument++;
+ g_testTime *= 1000;
+ break;
+
case 's':
argument++;
seed=0;