Remove test parameter

This commit is contained in:
Stella Lau
2017-08-21 10:09:06 -07:00
parent f181f33bdf
commit 91b30dbe84
10 changed files with 98 additions and 136 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ clean:
fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \
fuzzer-dll$(EXT) zstreamtest-dll$(EXT) zbufftest-dll$(EXT)\
zstreamtest$(EXT) zstreamtest32$(EXT) \
datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) longmatch$(EXT) \
datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) cctxParamRoundTrip$(EXT) longmatch$(EXT) \
symbols$(EXT) invalidDictionaries$(EXT) legacy$(EXT) poolTests$(EXT) \
decodecorpus$(EXT)
@echo Cleaning completed
+11 -14
View File
@@ -32,6 +32,15 @@
*==========================================*/
#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
static void crash(int errorCode){
/* abort if AFL/libfuzzer, exit otherwise */
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION /* could also use __AFL_COMPILER */
abort();
#else
exit(errorCode);
#endif
}
#define CHECK_Z(f) { \
size_t const err = f; \
if (ZSTD_isError(err)) { \
@@ -41,7 +50,6 @@
crash(1); \
} }
/** roundTripTest() :
* Compresses `srcBuff` into `compressedBuff`,
* then decompresses `compressedBuff` into `resultBuff`.
@@ -61,10 +69,8 @@ static size_t roundTripTest(void* resultBuff, size_t resultBuffCapacity,
ZSTD_inBuffer inBuffer = { srcBuff, srcBuffSize, 0 };
ZSTD_outBuffer outBuffer = {compressedBuff, compressedBuffCapacity, 0 };
ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_compressionLevel, 1);
ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_test, 1);
ZSTD_CCtx_applyCCtxParams(cctx, cctxParams);
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_compressionLevel, 1) );
CHECK_Z( ZSTD_CCtx_applyCCtxParams(cctx, cctxParams) );
CHECK_Z (ZSTD_compress_generic(cctx, &outBuffer, &inBuffer, ZSTD_e_end) );
@@ -88,15 +94,6 @@ static size_t checkBuffers(const void* buff1, const void* buff2, size_t buffSize
return pos;
}
static void crash(int errorCode){
/* abort if AFL/libfuzzer, exit otherwise */
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION /* could also use __AFL_COMPILER */
abort();
#else
exit(errorCode);
#endif
}
static void roundTripCheck(const void* srcBuff, size_t srcBuffSize)
{
size_t const cBuffSize = ZSTD_compressBound(srcBuffSize);
-7
View File
@@ -1655,12 +1655,8 @@ static int fuzzerTests_newAPI_opaque(U32 seed, U32 nbTests, unsigned startTest,
}
if (FUZ_rand(&lseed) & 1) CHECK_Z (ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_forceMaxWindow, FUZ_rand(&lseed) & 1) );
#if 0
if (FUZ_rand(&lseed) & 1) CHECK_Z (ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_test, FUZ_rand(&lseed) & 1) );
#endif
/* Apply parameters */
CHECK_Z (ZSTD_CCtx_applyCCtxParams(zc, cctxParams) );
if (FUZ_rand(&lseed) & 1) {
@@ -1795,9 +1791,6 @@ _output_error:
goto _cleanup;
}
/*-*******************************************************
* Command line
*********************************************************/