From: Michihiro NAKAJIMA Date: Mon, 18 Aug 2014 14:42:06 +0000 (+0900) Subject: Add additional tests for lz4 compression in front-end applications. X-Git-Tag: v3.1.900a~240 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aecd3a2c3f3956a66815eef88b355f644fe1ae5e;p=thirdparty%2Flibarchive.git Add additional tests for lz4 compression in front-end applications. --- diff --git a/Makefile.am b/Makefile.am index 35f9e867e..5982f64b6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -861,6 +861,7 @@ bsdtar_test_SOURCES= \ tar/test/test_extract_tar_gz.c \ tar/test/test_extract_tar_lrz.c \ tar/test/test_extract_tar_lz.c \ + tar/test/test_extract_tar_lz4.c \ tar/test/test_extract_tar_lzma.c \ tar/test/test_extract_tar_lzo.c \ tar/test/test_extract_tar_xz.c \ @@ -930,6 +931,7 @@ bsdtar_test_EXTRA_DIST= \ tar/test/test_extract.tar.gz.uu \ tar/test/test_extract.tar.lrz.uu \ tar/test/test_extract.tar.lz.uu \ + tar/test/test_extract.tar.lz4.uu \ tar/test/test_extract.tar.lzma.uu \ tar/test/test_extract.tar.lzo.uu \ tar/test/test_extract.tar.xz.uu \ @@ -1010,6 +1012,7 @@ bsdcpio_test_SOURCES= \ cpio/test/test_extract_cpio_gz.c \ cpio/test/test_extract_cpio_lrz.c \ cpio/test/test_extract_cpio_lz.c \ + cpio/test/test_extract_cpio_lz4.c \ cpio/test/test_extract_cpio_lzma.c \ cpio/test/test_extract_cpio_lzo.c \ cpio/test/test_extract_cpio_xz.c \ @@ -1071,6 +1074,7 @@ bsdcpio_test_EXTRA_DIST= \ cpio/test/test_extract.cpio.gz.uu \ cpio/test/test_extract.cpio.lrz.uu \ cpio/test/test_extract.cpio.lz.uu \ + cpio/test/test_extract.cpio.lz4.uu \ cpio/test/test_extract.cpio.lzma.uu \ cpio/test/test_extract.cpio.lzo.uu \ cpio/test/test_extract.cpio.xz.uu \ @@ -1149,6 +1153,7 @@ bsdcat_test_SOURCES= \ cat/test/test_expand_Z.c \ cat/test/test_expand_bz2.c \ cat/test/test_expand_gz.c \ + cat/test/test_expand_lz4.c \ cat/test/test_expand_mixed.c \ cat/test/test_expand_plain.c \ cat/test/test_expand_xz.c \ @@ -1181,6 +1186,7 @@ bsdcat_test_EXTRA_DIST= \ cat/test/test_expand.Z.uu \ cat/test/test_expand.bz2.uu \ cat/test/test_expand.gz.uu \ + cat/test/test_expand.lz4.uu \ cat/test/test_expand.plain.uu \ cat/test/test_expand.xz.uu \ cat/test/CMakeLists.txt diff --git a/cat/test/CMakeLists.txt b/cat/test/CMakeLists.txt index 86ae69275..ebb702ad8 100644 --- a/cat/test/CMakeLists.txt +++ b/cat/test/CMakeLists.txt @@ -17,6 +17,7 @@ IF(ENABLE_CAT AND ENABLE_TEST) test_expand_Z.c test_expand_bz2.c test_expand_gz.c + test_expand_lz4.c test_expand_mixed.c test_expand_plain.c test_expand_xz.c diff --git a/cat/test/test_expand.lz4.uu b/cat/test/test_expand.lz4.uu new file mode 100644 index 000000000..78306eaae --- /dev/null +++ b/cat/test/test_expand.lz4.uu @@ -0,0 +1,5 @@ +begin 644 test_expand.lz4 +M!")-&&1PN1T``(!C;VYT96YTC0N"@`````Y +#!E9+ +` +end diff --git a/cat/test/test_expand_lz4.c b/cat/test/test_expand_lz4.c new file mode 100644 index 000000000..1b1d21064 --- /dev/null +++ b/cat/test/test_expand_lz4.c @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * Copyright (c) 2012, 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + +DEFINE_TEST(test_expand_lz4) +{ + const char *reffile = "test_expand.lz4"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, f); + assertTextFileContents("contents of test_expand.lz4.\n", "test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +} diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt index 8280986cb..d4f93bb0c 100644 --- a/cpio/test/CMakeLists.txt +++ b/cpio/test/CMakeLists.txt @@ -19,6 +19,7 @@ IF(ENABLE_CPIO AND ENABLE_TEST) test_extract_cpio_gz test_extract_cpio_lrz test_extract_cpio_lz + test_extract_cpio_lz4 test_extract_cpio_lzma test_extract_cpio_lzo test_extract_cpio_xz diff --git a/cpio/test/test_extract.cpio.lz4.uu b/cpio/test/test_extract.cpio.lz4.uu new file mode 100644 index 000000000..0adc7bbcc --- /dev/null +++ b/cpio/test/test_extract.cpio.lz4.uu @@ -0,0 +1,7 @@ +begin 644 test_extract.cpio.lz4 +M!")-&&1PN9$````A,#<"`&`P-#`P,3`!`&`Q,3`P-C8/`#0W-3`&```)``$& +M`,$P,3(P,S(W-#`R,S01`!$V!@```@#Q!3(S9FEL93$`8V]N=&5N=',@;V8@ +M$@`A+@IC``AE`!\R90`4$#2#``YE`!TR90`6,F4`#P(`#@+H``P"`"test.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err", + testprog, reffile)); + + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertTextFileContents("1 block\n", "test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +} diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt index f19eb548b..f82ea5767 100644 --- a/tar/test/CMakeLists.txt +++ b/tar/test/CMakeLists.txt @@ -41,6 +41,7 @@ IF(ENABLE_TAR AND ENABLE_TEST) test_option_k.c test_option_keep_newer_files.c test_option_lrzip.c + test_option_lz4.c test_option_lzma.c test_option_lzop.c test_option_n.c diff --git a/tar/test/test_extract.tar.lz4.uu b/tar/test/test_extract.tar.lz4.uu new file mode 100644 index 000000000..a10ac0275 --- /dev/null +++ b/tar/test/test_extract.tar.lz4.uu @@ -0,0 +1,8 @@ +begin 644 test_extract.tar.lz4 +M!")-&&1PN:L```!O9FEL93$``0!+Z#`P,#8V-"``,#`Q-S4P"``#`@#_"3(S +M(#$R,#,R-S0P,C,T(#`Q,3,V-0`@,)<`2P("`+)Utest.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, systemf("%s -xf %s >test.out 2>test.err", + testprog, reffile)); + + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +}