]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add additional tests for lz4 compression in front-end applications.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 18 Aug 2014 14:42:06 +0000 (23:42 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 18 Aug 2014 14:42:06 +0000 (23:42 +0900)
Makefile.am
cat/test/CMakeLists.txt
cat/test/test_expand.lz4.uu [new file with mode: 0644]
cat/test/test_expand_lz4.c [new file with mode: 0644]
cpio/test/CMakeLists.txt
cpio/test/test_extract.cpio.lz4.uu [new file with mode: 0644]
cpio/test/test_extract_cpio_lz4.c [new file with mode: 0644]
tar/test/CMakeLists.txt
tar/test/test_extract.tar.lz4.uu [new file with mode: 0644]
tar/test/test_extract_tar_lz4.c [new file with mode: 0644]

index 35f9e867e119ca1339cc4c042af46543b42d6cc4..5982f64b6d08433b35d75a049144c589a00a8aaf 100644 (file)
@@ -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
index 86ae6927500c84f4084932e4634e427e7b9acb64..ebb702ad8b22a0a30b8c4e84bc2c611e5668858a 100644 (file)
@@ -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 (file)
index 0000000..78306ea
--- /dev/null
@@ -0,0 +1,5 @@
+begin 644 test_expand.lz4
+M!")-&&1PN1T``(!C;VYT96YT<R!O9B!T97-T7V5X<&%N9"YL>C0N"@`````Y
+#!E9+
+`
+end
diff --git a/cat/test/test_expand_lz4.c b/cat/test/test_expand_lz4.c
new file mode 100644 (file)
index 0000000..1b1d210
--- /dev/null
@@ -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");
+       }
+}
index 8280986cba8dd6036e8321cf8e26f5a65da6227f..d4f93bb0cad393c344fb63de0e7b6b24e4f951b8 100644 (file)
@@ -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 (file)
index 0000000..0adc7bb
--- /dev/null
@@ -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"`"<Q,Q(`
+=OU1204E,15(A(2$``0#'4````````````"BVD[$`
+`
+end
diff --git a/cpio/test/test_extract_cpio_lz4.c b/cpio/test/test_extract_cpio_lz4.c
new file mode 100644 (file)
index 0000000..c16247b
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_extract_cpio_lz4)
+{
+       const char *reffile = "test_extract.cpio.lz4";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >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");
+       }
+}
index f19eb548b7f127fd6a6eceb15c76fd4fd93e1e5a..f82ea5767435761fa4eabcf5ebf563434774e337 100644 (file)
@@ -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 (file)
index 0000000..a10ac02
--- /dev/null
@@ -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("`+)U<W1A<@`P,&-U91$`#P(`
+M!`\@``T"RP``W0```@`?($8`!`\"`'[!8V]N=&5N=',@;V8@#`(O+@JD`'X/
+M`@#_2@#T`1\R80%,#P`$&B$T-0`$+S<P``3_9!\R``3_W0\"`/___^M0````
+*````````J.?`=```
+`
+end
diff --git a/tar/test/test_extract_tar_lz4.c b/tar/test/test_extract_tar_lz4.c
new file mode 100644 (file)
index 0000000..150d57d
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_extract_tar_lz4)
+{
+       const char *reffile = "test_extract.tar.lz4";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -tf %s >test.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");
+       }
+}