summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2016-12-07 22:49:04 (GMT)
committerYann Collet <cyan@fb.com>2016-12-07 22:49:04 (GMT)
commit750a50cf67e8574500e4f9b4bb5e7f6cdd6f9c26 (patch)
treee9273eb9b66b48dcbf43e7d3149cd50f3efa9e66
parent01ffed25adbb4d18e48ceac59b1e5174ae29fc7f (diff)
downloadlz4-750a50cf67e8574500e4f9b4bb5e7f6cdd6f9c26.zip
lz4-750a50cf67e8574500e4f9b4bb5e7f6cdd6f9c26.tar.gz
lz4-750a50cf67e8574500e4f9b4bb5e7f6cdd6f9c26.tar.bz2
fix #284, reported by @beiDei8z : added test cases for path/to/lz4cat
-rw-r--r--programs/.gitignore2
-rw-r--r--programs/Makefile5
-rw-r--r--programs/lz4cli.c1
-rw-r--r--tests/Makefile14
4 files changed, 18 insertions, 4 deletions
diff --git a/programs/.gitignore b/programs/.gitignore
index df3423e..daa7f14 100644
--- a/programs/.gitignore
+++ b/programs/.gitignore
@@ -1,5 +1,7 @@
# local binary (Makefile)
lz4
+unlz4
+lz4cat
lz4c
lz4c32
datagen
diff --git a/programs/Makefile b/programs/Makefile
index 84662c2..74a2440 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -91,7 +91,7 @@ lz4c32: lz4
clean:
@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
@$(RM) core *.o *.test tmp* \
- lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) unlz4
+ lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) unlz4 lz4cat
@echo Cleaning completed
@@ -115,6 +115,9 @@ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD))
unlz4: lz4
ln -s lz4 unlz4
+lz4cat: lz4
+ ln -s lz4 lz4cat
+
install: lz4$(EXT) lz4c$(EXT)
@echo Installing binaries
@install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index eda2018..76e7e14 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -319,6 +319,7 @@ int main(int argc, const char** argv)
if (!strcmp(exeName, LZ4CAT)) {
mode = om_decompress;
LZ4IO_setOverwrite(1);
+ LZ4IO_setRemoveSrcFile(0);
forceStdout=1;
output_filename=stdoutmark;
displayLevel=1;
diff --git a/tests/Makefile b/tests/Makefile
index 5923a20..adfcfea 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -207,9 +207,12 @@ test-lz4-multiple: lz4 datagen
@$(RM) tmp*
unlz4:
- @$(MAKE) -C $(PRGDIR) unlz4
+ @$(MAKE) -C $(PRGDIR) $@
-test-lz4-basic: lz4 datagen unlz4
+lz4cat:
+ @$(MAKE) -C $(PRGDIR) $@
+
+test-lz4-basic: lz4 datagen unlz4 lz4cat
@echo "\n ---- test lz4 basic compression/decompression ----"
./datagen -g0 | $(LZ4) -v | $(LZ4) -t
./datagen -g16KB | $(LZ4) -9 | $(LZ4) -t
@@ -224,13 +227,18 @@ test-lz4-basic: lz4 datagen unlz4
./datagen -g33M | $(LZ4) --no-frame-crc | $(LZ4) -t
./datagen -g256MB | $(LZ4) -vqB4D | $(LZ4) -t
@echo "hello world" > tmp
- $(LZ4) --rm tmp
+ $(LZ4) --rm -f tmp
ls -ls tmp && false || true # must fail (--rm)
ls -ls tmp.lz4
+ $(PRGDIR)/lz4cat tmp.lz4 # must display hello world
+ ls -ls tmp.lz4
$(PRGDIR)/unlz4 --rm tmp.lz4
ls -ls tmp
ls -ls tmp.lz4 && false || true # must fail (--rm)
ls -ls tmp.lz4.lz4 && false || true # must fail (unlz4)
+ $(PRGDIR)/lz4cat tmp # pass-through mode
+ ls -ls tmp
+ ls -ls tmp.lz4 && false || true # must fail (lz4cat)
@$(RM) tmp*
test-lz4-hugefile: lz4 datagen