summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-05-26 01:13:50 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-05-26 01:13:50 (GMT)
commitbaf78e7e4dcbdf824a76f990ffeb573d113bbbdb (patch)
treee1bcd78b60c5294257662595bbecfabd736785b4 /programs
parent7d182b816ace89d6d6d16b7aee376a9962a05caa (diff)
parent6f50184a4f50e435f6b3322c68b8b8114544496c (diff)
downloadlz4-lz4-r130.zip
lz4-lz4-r130.tar.gz
lz4-lz4-r130.tar.bz2
Merge pull request #111 from Cyan4973/devr130lz4-r130
Dev
Diffstat (limited to 'programs')
-rw-r--r--programs/Makefile61
-rw-r--r--programs/lz4cli.c4
-rw-r--r--programs/lz4io.c22
3 files changed, 64 insertions, 23 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 39335db..43f1789 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -34,7 +34,7 @@
# datagen : generates synthetic data samples for tests & benchmarks
# ##########################################################################
-RELEASE?= r129
+RELEASE?= r130
DESTDIR?=
PREFIX ?= /usr/local
@@ -150,7 +150,7 @@ test-all: test test32
test-travis: $(TRAVIS_TARGET)
test-lz4-sparse: lz4 datagen
- @echo ---- test sparse file support ----
+ @echo "\n ---- test sparse file support ----"
./datagen -g5M -P100 > tmpSrc
./lz4 -B4D tmpSrc | ./lz4 -dv --sparse > tmpB4
diff -s tmpSrc tmpB4
@@ -167,9 +167,25 @@ test-lz4-sparse: lz4 datagen
./datagen -s1 -g1200007 -P100 | diff -s - tmpOdd
ls -ls tmpOdd
@rm tmp*
+ @echo "\n Compatibility with Console :"
+ echo "Hello World 1 !" | ./lz4 | ./lz4 -d -c
+ echo "Hello World 2 !" | ./lz4 | ./lz4 -d | cat
+ echo "Hello World 3 !" | ./lz4 --no-frame-crc | ./lz4 -d -c
+ @echo "\n Compatibility with Append :"
+ ./datagen -P100 -g1M > tmp1M
+ cat tmp1M > tmp2M
+ cat tmp1M >> tmp2M
+ ./lz4 -B5 -v tmp1M tmpC
+ ./lz4 -d -v tmpC tmpR
+ ./lz4 -d -v tmpC >> tmpR
+ ls -ls tmp*
+ diff tmp2M tmpR
+ @rm tmp*
+
+
test-lz4-contentSize: lz4 datagen
- @echo ---- test original size support ----
+ @echo "\n ---- test original size support ----"
./datagen -g15M > tmp
./lz4 -v tmp | ./lz4 -t
./lz4 -v --content-size tmp | ./lz4 -d > tmp2
@@ -182,7 +198,7 @@ test-lz4-contentSize: lz4 datagen
@rm tmp*
test-lz4-frame-concatenation: lz4 datagen
- @echo ---- test frame concatenation ----
+ @echo "\n ---- test frame concatenation ----"
@echo -n > empty.test
@echo hi > nonempty.test
cat nonempty.test empty.test nonempty.test > orig.test
@@ -195,7 +211,7 @@ test-lz4-frame-concatenation: lz4 datagen
@echo frame concatenation test completed
test-lz4-multiple: lz4 datagen
- @echo ---- test multiple files ----
+ @echo "\n ---- test multiple files ----"
@./datagen -s1 > tmp1 2> $(VOID)
@./datagen -s2 -g100K > tmp2 2> $(VOID)
@./datagen -s3 -g1M > tmp3 2> $(VOID)
@@ -207,10 +223,15 @@ test-lz4-multiple: lz4 datagen
./lz4 -f -m tmp1 notHere tmp2; echo $$?
@rm tmp*
-test-lz4: lz4 datagen test-lz4-multiple test-lz4-sparse test-lz4-contentSize test-lz4-frame-concatenation
- @echo ---- test lz4 basic compression/decompression ----
+test-lz4-basic: lz4 datagen
+ @echo "\n ---- test lz4 basic compression/decompression ----"
./datagen -g0 | ./lz4 -v | ./lz4 -t
./datagen -g16KB | ./lz4 -9 | ./lz4 -t
+ ./datagen -g20KB > tmpSrc
+ ./lz4 < tmpSrc | ./lz4 -d > tmpRes
+ diff -q tmpSrc tmpRes
+ ./lz4 --no-frame-crc < tmpSrc | ./lz4 -d > tmpRes
+ diff -q tmpSrc tmpRes
./datagen | ./lz4 | ./lz4 -t
./datagen -g6M -P99 | ./lz4 -9BD | ./lz4 -t
./datagen -g17M | ./lz4 -9v | ./lz4 -qt
@@ -218,22 +239,35 @@ test-lz4: lz4 datagen test-lz4-multiple test-lz4-sparse test-lz4-contentSize tes
./datagen -g256MB | ./lz4 -vqB4D | ./lz4 -t
./datagen -g6GB | ./lz4 -vqB5D | ./lz4 -qt
./datagen -g6GB | ./lz4 -vq9BD | ./lz4 -qt
- @echo ---- test pass-through ----
+ @rm tmp*
+
+test-lz4: lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-sparse test-lz4-contentSize test-lz4-frame-concatenation
+ @echo "\n ---- test pass-through ----"
./datagen | ./lz4 -tf
test-lz4c: lz4c datagen
+ @echo "\n ---- test lz4c version ----"
./datagen -g256MB | ./lz4c -l -v | ./lz4c -t
-test-lz4c32: lz4 lz4c32 datagen
- ./datagen -g16KB | ./lz4c32 -9 | ./lz4c32 -t
+test-interop-32-64: lz4 lz4c32 datagen
+ @echo "\n ---- test interoperability 32-bits -vs- 64 bits ----"
./datagen -g16KB | ./lz4c32 -9 | ./lz4 -t
- ./datagen | ./lz4c32 | ./lz4c32 -t
+ ./datagen -P10 | ./lz4 -9B4 | ./lz4c32 -t
./datagen | ./lz4c32 | ./lz4 -t
- ./datagen -g256MB | ./lz4c32 -vqB4D | ./lz4c32 -qt
+ ./datagen -g1M | ./lz4 -3B5 | ./lz4c32 -t
./datagen -g256MB | ./lz4c32 -vqB4D | ./lz4 -qt
- ./datagen -g6GB | ./lz4c32 -vqB5D | ./lz4c32 -qt
+ ./datagen -g1G -P90 | ./lz4 | ./lz4c32 -t
./datagen -g6GB | ./lz4c32 -vq9BD | ./lz4 -qt
+test-lz4c32-basic: lz4c32 datagen
+ @echo "\n ---- test lz4c32 32-bits version ----"
+ ./datagen -g16KB | ./lz4c32 -9 | ./lz4c32 -t
+ ./datagen | ./lz4c32 | ./lz4c32 -t
+ ./datagen -g256MB | ./lz4c32 -vqB4D | ./lz4c32 -qt
+ ./datagen -g6GB | ./lz4c32 -vqB5D | ./lz4c32 -qt
+
+test-lz4c32: test-lz4c32-basic test-interop-32-64
+
test-fullbench: fullbench
./fullbench --no-prompt $(NB_LOOPS) $(TEST_FILES)
@@ -253,6 +287,7 @@ test-frametest32: frametest32
./frametest32 $(FUZZER_TIME)
test-mem: lz4 datagen fuzzer frametest fullbench
+ @echo "\n ---- valgrind tests : memory analyzer ----"
valgrind --leak-check=yes --error-exitcode=1 ./datagen -g50M > $(VOID)
./datagen -g16KB > tmp
valgrind --leak-check=yes --error-exitcode=1 ./lz4 -9 -BD -f tmp $(VOID)
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 970856d..e5210c9 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -306,7 +306,7 @@ int main(int argc, char** argv)
if (!strcmp(argument, "--no-frame-crc")) { LZ4IO_setStreamChecksumMode(0); continue; }
if (!strcmp(argument, "--content-size")) { LZ4IO_setContentSize(1); continue; }
if (!strcmp(argument, "--no-content-size")) { LZ4IO_setContentSize(0); continue; }
- if (!strcmp(argument, "--sparse")) { LZ4IO_setSparseFile(1); continue; }
+ if (!strcmp(argument, "--sparse")) { LZ4IO_setSparseFile(2); continue; }
if (!strcmp(argument, "--no-sparse")) { LZ4IO_setSparseFile(0); continue; }
if (!strcmp(argument, "--verbose")) { displayLevel=4; continue; }
if (!strcmp(argument, "--quiet")) { if (displayLevel) displayLevel--; continue; }
@@ -473,7 +473,7 @@ int main(int argc, char** argv)
if (multiple_inputs) input_filename = inFileNames[0], output_filename = (const char*)(inFileNames[0]);
if(!input_filename) { input_filename=stdinmark; }
- /* Check if input or output are defined as console; trigger an error in this case */
+ /* Check if input is defined as console; trigger an error in this case */
if (!strcmp(input_filename, stdinmark) && IS_CONSOLE(stdin) ) badusage();
/* Check if benchmark is selected */
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 209f5ed..e782664 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -278,6 +278,11 @@ static int LZ4IO_getFiles(const char* input_filename, const char* output_filenam
DISPLAYLEVEL(4,"Using stdout for output\n");
*pfoutput = stdout;
SET_BINARY_MODE(stdout);
+ if (g_sparseFileSupport==1)
+ {
+ g_sparseFileSupport = 0;
+ DISPLAYLEVEL(4, "Sparse File Support is automatically disabled on stdout ; try --sparse \n");
+ }
}
else
{
@@ -301,7 +306,7 @@ static int LZ4IO_getFiles(const char* input_filename, const char* output_filenam
*pfoutput = fopen( output_filename, "wb" );
}
- if ( *pfoutput==0) EXM_THROW(13, "Pb opening %s", output_filename);
+ if (*pfoutput==0) EXM_THROW(13, "Pb opening %s", output_filename);
return 0;
}
@@ -639,7 +644,7 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer
if (!g_sparseFileSupport) /* normal write */
{
size_t sizeCheck = fwrite(buffer, 1, bufferSize, file);
- if (sizeCheck != bufferSize) EXM_THROW(68, "Write error : cannot write decoded block");
+ if (sizeCheck != bufferSize) EXM_THROW(70, "Write error : cannot write decoded block");
return 0;
}
@@ -647,7 +652,7 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer
if (storedSkips > 1 GB)
{
int seekResult = fseek(file, 1 GB, SEEK_CUR);
- if (seekResult != 0) EXM_THROW(68, "1 GB skip error (sparse file support)");
+ if (seekResult != 0) EXM_THROW(71, "1 GB skip error (sparse file support)");
storedSkips -= 1 GB;
}
@@ -667,12 +672,12 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer
{
size_t sizeCheck;
seekResult = fseek(file, storedSkips, SEEK_CUR);
- if (seekResult) EXM_THROW(68, "Skip error (sparse file)");
+ if (seekResult) EXM_THROW(72, "Sparse skip error ; try --no-sparse");
storedSkips = 0;
seg0SizeT -= nb0T;
ptrT += nb0T;
sizeCheck = fwrite(ptrT, sizeT, seg0SizeT, file);
- if (sizeCheck != seg0SizeT) EXM_THROW(68, "Write error : cannot write decoded block");
+ if (sizeCheck != seg0SizeT) EXM_THROW(73, "Write error : cannot write decoded block");
}
ptrT += seg0SizeT;
}
@@ -689,10 +694,10 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer
{
size_t sizeCheck;
int seekResult = fseek(file, storedSkips, SEEK_CUR);
- if (seekResult) EXM_THROW(68, "Skip error (end of block)");
+ if (seekResult) EXM_THROW(74, "Sparse skip error ; try --no-sparse");
storedSkips = 0;
sizeCheck = fwrite(restPtr, 1, restEnd - restPtr, file);
- if (sizeCheck != (size_t)(restEnd - restPtr)) EXM_THROW(68, "Write error : cannot write decoded end of block");
+ if (sizeCheck != (size_t)(restEnd - restPtr)) EXM_THROW(75, "Write error : cannot write decoded end of block");
}
}
@@ -844,7 +849,6 @@ static unsigned long long LZ4IO_decompressLZ4F(dRess_t ress, FILE* srcFile, FILE
nextToLoad = LZ4F_decompress(ress.dCtx, ress.dstBuffer, &decodedBytes, (char*)(ress.srcBuffer)+pos, &remaining, NULL);
if (LZ4F_isError(nextToLoad)) EXM_THROW(66, "Decompression error : %s", LZ4F_getErrorName(nextToLoad));
pos += remaining;
- if (!nextToLoad) break;
if (decodedBytes)
{
@@ -853,6 +857,8 @@ static unsigned long long LZ4IO_decompressLZ4F(dRess_t ress, FILE* srcFile, FILE
DISPLAYUPDATE(2, "\rDecompressed : %u MB ", (unsigned)(filesize>>20));
storedSkips = LZ4IO_fwriteSparse(dstFile, ress.dstBuffer, decodedBytes, storedSkips);
}
+
+ if (!nextToLoad) break;
}
}