summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-07-15 19:11:34 (GMT)
committerYann Collet <cyan@fb.com>2019-07-15 19:11:34 (GMT)
commit6654c2cd3bd49dfc6b6bb3447bcc01799ea35ac3 (patch)
treecc41ddbff1fe2aaf4d35fe12516f5a697f99fd7a /tests
parenta23541463d924f11dfc0843f4ddb10a1e777e405 (diff)
downloadlz4-6654c2cd3bd49dfc6b6bb3447bcc01799ea35ac3.zip
lz4-6654c2cd3bd49dfc6b6bb3447bcc01799ea35ac3.tar.gz
lz4-6654c2cd3bd49dfc6b6bb3447bcc01799ea35ac3.tar.bz2
ensure conformance with custom LZ4_DISTANCE_MAX
It's now possible to select a custom LZ4_DISTANCE_MAX at compile time, provided it's <= 65535. However, in some cases (when compressing in byU16 mode), the new distance wasn't respected, as it used to implied that it was necessarily within range. Added a distance check for this case. Also : added a new TravisCI test which ensures that custom LZ4_DISTANCE_MAX compiles correctly and compresses correctly (relying on `assert()` to find outsized offsets).
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile2
-rw-r--r--tests/frametest.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 65713ef..422baba 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -448,7 +448,7 @@ test-fuzzer32: CFLAGS += -m32
test-fuzzer32: test-fuzzer
test-frametest: frametest
- ./frametest $(FUZZER_TIME)
+ ./frametest -v $(FUZZER_TIME)
test-frametest32: CFLAGS += -m32
test-frametest32: test-frametest
diff --git a/tests/frametest.c b/tests/frametest.c
index 69dd5aa..91813bb 100644
--- a/tests/frametest.c
+++ b/tests/frametest.c
@@ -46,6 +46,7 @@
#define LZ4F_STATIC_LINKING_ONLY
#include "lz4frame.h"
#include "lz4frame.h"
+#define LZ4_STATIC_LINKING_ONLY /* LZ4_DISTANCE_MAX */
#include "lz4.h" /* LZ4_VERSION_STRING */
#define XXH_STATIC_LINKING_ONLY
#include "xxhash.h" /* XXH64 */
@@ -540,7 +541,7 @@ int basicTests(U32 seed, double compressibility)
cdict, NULL) );
DISPLAYLEVEL(3, "compressed %u bytes into %u bytes \n",
(unsigned)dictSize, (unsigned)cSizeWithDict);
- if (cSizeWithDict >= cSizeNoDict) goto _output_error; /* must be more efficient */
+ if ((LZ4_DISTANCE_MAX > dictSize) && (cSizeWithDict >= cSizeNoDict)) goto _output_error; /* must be more efficient */
crcOrig = XXH64(CNBuffer, dictSize, 0);
DISPLAYLEVEL(3, "LZ4F_decompress_usingDict : ");