mirror of
				https://github.com/facebook/zstd.git
				synced 2025-10-31 16:47:48 +02:00 
			
		
		
		
	removed long-range-mode tests from zstreamtest --no-big-tests
				
					
				
			This commit is contained in:
		| @@ -241,6 +241,7 @@ static ZSTD_CCtx_params ZSTD_assignParamsToCCtxParams( | ||||
|  | ||||
| size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value) | ||||
| { | ||||
|     DEBUGLOG(4, "ZSTD_CCtx_setParameter"); | ||||
|     if (cctx->streamStage != zcss_init) return ERROR(stage_wrong); | ||||
|  | ||||
|     switch(param) | ||||
| @@ -320,6 +321,7 @@ size_t ZSTD_CCtxParam_setParameter( | ||||
|         return CCtxParams->compressionLevel; | ||||
|  | ||||
|     case ZSTD_p_windowLog : | ||||
|         DEBUGLOG(4, "setting windowLog=%u", value); | ||||
|         if (value) {  /* 0 : does not change current windowLog */ | ||||
|             CLAMPCHECK(value, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX); | ||||
|             ZSTD_cLevelToCCtxParams(CCtxParams); | ||||
| @@ -2862,7 +2864,6 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx, | ||||
|                 if (cctx->mtctx == NULL) return ERROR(memory_allocation); | ||||
|             } | ||||
|             DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads); | ||||
|             DEBUGLOG(2, "params.windowLog = %u", params.cParams.windowLog); | ||||
|             CHECK_F( ZSTDMT_initCStream_internal( | ||||
|                         cctx->mtctx, | ||||
|                         prefixDict.dict, prefixDict.dictSize, ZSTD_dm_rawContent, | ||||
|   | ||||
| @@ -140,7 +140,7 @@ static size_t ZSTDMT_sizeof_bufferPool(ZSTDMT_bufferPool* bufPool) | ||||
|     return poolSize + totalBufferSize; | ||||
| } | ||||
|  | ||||
| static void ZSTDMT_setBufferSize(ZSTDMT_bufferPool* bufPool, size_t bSize) | ||||
| static void ZSTDMT_setBufferSize(ZSTDMT_bufferPool* const bufPool, size_t const bSize) | ||||
| { | ||||
|     ZSTD_pthread_mutex_lock(&bufPool->poolMutex); | ||||
|     DEBUGLOG(4, "ZSTDMT_setBufferSize: bSize = %u", (U32)bSize); | ||||
|   | ||||
| @@ -1486,43 +1486,47 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest, double | ||||
|                 cParams = ZSTD_adjustCParams(cParams, 0, 0); | ||||
|  | ||||
|                 if (FUZ_rand(&lseed) & 1) { | ||||
|                     DISPLAYLEVEL(5, "t%u: windowLog : %u \n", testNb, cParams.windowLog); | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_windowLog, cParams.windowLog, useOpaqueAPI) ); | ||||
|                     assert(cParams.windowLog >= ZSTD_WINDOWLOG_MIN);   /* guaranteed by ZSTD_adjustCParams() */ | ||||
|                     windowLogMalus = (cParams.windowLog - ZSTD_WINDOWLOG_MIN) / 5; | ||||
|                     DISPLAYLEVEL(5, "t%u: windowLog : %u \n", testNb, cParams.windowLog); | ||||
|                 } | ||||
|                 if (FUZ_rand(&lseed) & 1) { | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_hashLog, cParams.hashLog, useOpaqueAPI) ); | ||||
|                     DISPLAYLEVEL(5, "t%u: hashLog : %u \n", testNb, cParams.hashLog); | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_hashLog, cParams.hashLog, useOpaqueAPI) ); | ||||
|                 } | ||||
|                 if (FUZ_rand(&lseed) & 1) { | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_chainLog, cParams.chainLog, useOpaqueAPI) ); | ||||
|                     DISPLAYLEVEL(5, "t%u: chainLog : %u \n", testNb, cParams.chainLog); | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_chainLog, cParams.chainLog, useOpaqueAPI) ); | ||||
|                 } | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_searchLog, cParams.searchLog, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_minMatch, cParams.searchLength, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_targetLength, cParams.targetLength, useOpaqueAPI) ); | ||||
|  | ||||
|                 /* mess with long distance matching parameters */ | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_enableLongDistanceMatching, FUZ_rand(&lseed) & 63, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmHashLog, FUZ_randomClampedLength(&lseed, ZSTD_HASHLOG_MIN, 23), useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmMinMatch, FUZ_randomClampedLength(&lseed, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX), useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmBucketSizeLog, FUZ_randomClampedLength(&lseed, 0, ZSTD_LDM_BUCKETSIZELOG_MAX), useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmHashEveryLog, FUZ_randomClampedLength(&lseed, 0, ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN), useOpaqueAPI) ); | ||||
|                 if (bigTests) { | ||||
|                     if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_enableLongDistanceMatching, FUZ_rand(&lseed) & 63, useOpaqueAPI) ); | ||||
|                     if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmHashLog, FUZ_randomClampedLength(&lseed, ZSTD_HASHLOG_MIN, 23), useOpaqueAPI) ); | ||||
|                     if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmMinMatch, FUZ_randomClampedLength(&lseed, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX), useOpaqueAPI) ); | ||||
|                     if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmBucketSizeLog, FUZ_randomClampedLength(&lseed, 0, ZSTD_LDM_BUCKETSIZELOG_MAX), useOpaqueAPI) ); | ||||
|                     if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmHashEveryLog, FUZ_randomClampedLength(&lseed, 0, ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN), useOpaqueAPI) ); | ||||
|                 } | ||||
|  | ||||
|                 /* mess with frame parameters */ | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_checksumFlag, FUZ_rand(&lseed) & 1, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_dictIDFlag, FUZ_rand(&lseed) & 1, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_contentSizeFlag, FUZ_rand(&lseed) & 1, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( ZSTD_CCtx_setPledgedSrcSize(zc, pledgedSrcSize) ); | ||||
|                 DISPLAYLEVEL(5, "t%u: pledgedSrcSize : %u \n", testNb, (U32)pledgedSrcSize); | ||||
|                 if (FUZ_rand(&lseed) & 1) { | ||||
|                     DISPLAYLEVEL(5, "t%u: pledgedSrcSize : %u \n", testNb, (U32)pledgedSrcSize); | ||||
|                     CHECK_Z( ZSTD_CCtx_setPledgedSrcSize(zc, pledgedSrcSize) ); | ||||
|                 } | ||||
|  | ||||
|                 /* multi-threading parameters */ | ||||
|                 {   U32 const nbThreadsCandidate = (FUZ_rand(&lseed) & 4) + 1; | ||||
|                     U32 const nbThreadsAdjusted = (windowLogMalus < nbThreadsCandidate) ? nbThreadsCandidate - windowLogMalus : 1; | ||||
|                     U32 const nbThreads = MIN(nbThreadsAdjusted, nbThreadsMax); | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_nbThreads, nbThreads, useOpaqueAPI) ); | ||||
|                     DISPLAYLEVEL(5, "t%u: nbThreads : %u \n", testNb, nbThreads); | ||||
|                     CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_nbThreads, nbThreads, useOpaqueAPI) ); | ||||
|                     if (nbThreads > 1) { | ||||
|                         U32 const jobLog = FUZ_rand(&lseed) % (testLog+1); | ||||
|                         CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_overlapSizeLog, FUZ_rand(&lseed) % 10, useOpaqueAPI) ); | ||||
| @@ -1530,10 +1534,11 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest, double | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z (setCCtxParameter(zc, cctxParams, ZSTD_p_forceMaxWindow, FUZ_rand(&lseed) & 1, useOpaqueAPI) ); | ||||
|                 if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_forceMaxWindow, FUZ_rand(&lseed) & 1, useOpaqueAPI) ); | ||||
|  | ||||
|                 /* Apply parameters */ | ||||
|                 if (useOpaqueAPI) { | ||||
|                     DISPLAYLEVEL(6," t%u: applying CCtxParams \n", testNb); | ||||
|                     CHECK_Z (ZSTD_CCtx_setParametersUsingCCtxParams(zc, cctxParams) ); | ||||
|                 } | ||||
|  | ||||
| @@ -1573,8 +1578,8 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest, double | ||||
|                 outBuff.size = outBuff.pos + dstBuffSize; | ||||
|  | ||||
|                 CHECK_Z( ZSTD_compress_generic(zc, &outBuff, &inBuff, flush) ); | ||||
|                 DISPLAYLEVEL(6, "compress consumed %u bytes (total : %u) \n", | ||||
|                     (U32)inBuff.pos, (U32)(totalTestSize + inBuff.pos)); | ||||
|                 DISPLAYLEVEL(6, "t%u: compress consumed %u bytes (total : %u) \n", | ||||
|                     testNb, (U32)inBuff.pos, (U32)(totalTestSize + inBuff.pos)); | ||||
|  | ||||
|                 XXH64_update(&xxhState, srcBuffer+srcStart, inBuff.pos); | ||||
|                 memcpy(copyBuffer+totalTestSize, srcBuffer+srcStart, inBuff.pos); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user