]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
use time limited fuzzer tests in CI
authorYann Collet <yann.collet.73@gmail.com>
Fri, 4 Dec 2015 16:45:35 +0000 (17:45 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Fri, 4 Dec 2015 16:45:35 +0000 (17:45 +0100)
programs/Makefile
programs/fuzzer.c

index 15b4e05c7303ef91a065ed4a807f0d56f51dee83..c2a1ca267a4c16150f899845ab3c1f7d39a705cc 100644 (file)
@@ -65,6 +65,7 @@ VOID = /dev/null
 endif
 
 ZBUFFTEST = -T2mn
+FUZZERTEST= -T5mn
 
 .PHONY: default all clean install uninstall test test32 test-all
 
@@ -258,10 +259,10 @@ test-fullbench32: fullbench32 datagen
        ./fullbench32 -i1 -P0
 
 test-fuzzer: fuzzer
-       ./fuzzer
+       ./fuzzer $(FUZZERTEST)
 
 test-fuzzer32: fuzzer32
-       ./fuzzer32
+       ./fuzzer32 $(FUZZERTEST)
 
 test-zbuff: zbufftest
        ./zbufftest $(ZBUFFTEST)
index d108ff9760840bac6a0808cc2244ecbfb283937b..0079eebb9b3c69dfcbd7a7a2b49d834e0d812349 100644 (file)
@@ -306,9 +306,10 @@ int fuzzerTests(U32 seed, U32 nbTests, unsigned startTest, double compressibilit
         BYTE* sampleBuffer;
 
         /* init */
-        DISPLAYUPDATE(2, "\r%6u", testNb);
-        if (nbTests >= testNb) DISPLAYUPDATE(2, "\r/%6u", nbTests);
-        DISPLAYUPDATE(2, "    ");
+        if (nbTests >= testNb)
+             { DISPLAYUPDATE(2, "\r%6u/%6u    ", testNb, nbTests); }
+        else { DISPLAYUPDATE(2, "\r%6u      ", testNb); }
+
         FUZ_rand(&coreSeed);
         lseed = coreSeed ^ prime1;
         buffNb = FUZ_rand(&lseed) & 127;
@@ -471,7 +472,7 @@ int fuzzerTests(U32 seed, U32 nbTests, unsigned startTest, double compressibilit
         cSize += errorCode;
         crcOrig = XXH64_digest(&crc64);
     }
-    DISPLAY("\r%u fuzzer tests completed   \n", testNb);
+    DISPLAY("\r%u fuzzer tests completed   \n", testNb-1);
 
 _cleanup:
     ZSTD_freeCCtx(ctx);
@@ -629,8 +630,6 @@ int main(int argc, char** argv)
     DISPLAY("Seed = %u\n", seed);
     if (proba!=FUZ_COMPRESSIBILITY_DEFAULT) DISPLAY("Compressibility : %i%%\n", proba);
 
-    if (nbTests<=0) nbTests=1;
-
     if (testNb==0) result = basicUnitTests(0, ((double)proba) / 100);  /* constant seed for predictability */
     if (!result)
         result = fuzzerTests(seed, nbTests, testNb, ((double)proba) / 100);