]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add decompression tests to bsdcpio and bsdtar.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 8 Oct 2012 07:49:46 +0000 (16:49 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 8 Oct 2012 07:49:46 +0000 (16:49 +0900)
24 files changed:
Makefile.am
cpio/test/CMakeLists.txt
cpio/test/test_extract.cpio.Z.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.bz2.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.gz.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.lrz.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.lz.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.lzma.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.lzo.uu [new file with mode: 0644]
cpio/test/test_extract.cpio.xz.uu [new file with mode: 0644]
cpio/test/test_extract_cpio_Z.c [new file with mode: 0644]
cpio/test/test_extract_cpio_bz2.c [new file with mode: 0644]
cpio/test/test_extract_cpio_gz.c [new file with mode: 0644]
cpio/test/test_extract_cpio_lrz.c [new file with mode: 0644]
cpio/test/test_extract_cpio_lz.c [new file with mode: 0644]
cpio/test/test_extract_cpio_lzma.c [new file with mode: 0644]
cpio/test/test_extract_cpio_lzo.c [new file with mode: 0644]
cpio/test/test_extract_cpio_xz.c [new file with mode: 0644]
tar/test/CMakeLists.txt
tar/test/test_extract.tar.Z.uu [new file with mode: 0644]
tar/test/test_extract.tar.lzo.uu [new file with mode: 0644]
tar/test/test_extract_tar_Z.c [new file with mode: 0644]
tar/test/test_extract_tar_lrz.c
tar/test/test_extract_tar_lzo.c [new file with mode: 0644]

index 70601fc6a71c48823f939c77e5b10f52d8de330b..9dbe6813c21dce24774842c97de41bba246eff80 100644 (file)
@@ -710,11 +710,13 @@ bsdtar_test_SOURCES=                                              \
        tar/test/test_basic.c                                   \
        tar/test/test_copy.c                                    \
        tar/test/test_empty_mtree.c                             \
+       tar/test/test_extract_tar_Z.c                           \
        tar/test/test_extract_tar_bz2.c                         \
        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_lzma.c                        \
+       tar/test/test_extract_tar_lzo.c                         \
        tar/test/test_extract_tar_xz.c                          \
        tar/test/test_format_newc.c                             \
        tar/test/test_help.c                                    \
@@ -771,6 +773,14 @@ endif
 
 bsdtar_test_EXTRA_DIST=                        \
        tar/test/list.h \
+       tar/test/test_extract.tar.Z.uu   \
+       tar/test/test_extract.tar.bz2.uu \
+       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.lzma.uu \
+       tar/test/test_extract.tar.lzo.uu \
+       tar/test/test_extract.tar.xz.uu \
        tar/test/test_option_keep_newer_files.tar.Z.uu \
        tar/test/test_option_s.tar.Z.uu \
        tar/test/test_patterns_2.tar.uu \
@@ -842,6 +852,14 @@ bsdcpio_test_SOURCES=                                              \
        cpio/test/test_0.c                                      \
        cpio/test/test_basic.c                                  \
        cpio/test/test_cmdline.c                                \
+       cpio/test/test_extract_cpio_Z.c                         \
+       cpio/test/test_extract_cpio_bz2.c                       \
+       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_lzma.c                      \
+       cpio/test/test_extract_cpio_lzo.c                       \
+       cpio/test/test_extract_cpio_xz.c                        \
        cpio/test/test_format_newc.c                            \
        cpio/test/test_gcpio_compat.c                           \
        cpio/test/test_option_0.c                               \
@@ -892,6 +910,14 @@ endif
 
 bsdcpio_test_EXTRA_DIST=                       \
        cpio/test/list.h        \
+       cpio/test/test_extract.cpio.Z.uu        \
+       cpio/test/test_extract.cpio.bz2.uu      \
+       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.lzma.uu     \
+       cpio/test/test_extract.cpio.lzo.uu      \
+       cpio/test/test_extract.cpio.xz.uu       \
        cpio/test/test_gcpio_compat_ref.bin.uu  \
        cpio/test/test_gcpio_compat_ref.crc.uu  \
        cpio/test/test_gcpio_compat_ref.newc.uu \
index 55a12e7a915e1d3caf876088efe43860affcc567..3713cd3d8fcaa6eeeddda05327624c6de7ff48d9 100644 (file)
@@ -13,6 +13,14 @@ IF(ENABLE_CPIO AND ENABLE_TEST)
     test_0.c
     test_basic.c
     test_cmdline.c
+    test_extract_cpio_Z
+    test_extract_cpio_bz2
+    test_extract_cpio_gz
+    test_extract_cpio_lrz
+    test_extract_cpio_lz
+    test_extract_cpio_lzma
+    test_extract_cpio_lzo
+    test_extract_cpio_xz
     test_format_newc.c
     test_gcpio_compat.c
     test_option_0.c
diff --git a/cpio/test/test_extract.cpio.Z.uu b/cpio/test/test_extract.cpio.Z.uu
new file mode 100644 (file)
index 0000000..e520a34
--- /dev/null
@@ -0,0 +1,7 @@
+begin 664 test_extract.cpio.Z
+M'YV0,&X$'`B#!@P8,0XJC)$0A@T;!A'>J+%PHL*%%P_&D`%CAHP;!F7,B*C0
+M1L:+(LVD85,F!H`Q;]S0*2-S#H@W9D"H9!G#A8*!`@46U)A11L.'$6-8U+CT
+M8D.G'#V"A"&#!L6+)D\>3+FRC(R7,6?6O)ESIU>?0`EJ7<N6[=.V:V/,@$M%
+A2I`D3(I("<$7@-^_@`,+'DRXL.'#B!,K7LRXL>/'D!4#
+`
+end
diff --git a/cpio/test/test_extract.cpio.bz2.uu b/cpio/test/test_extract.cpio.bz2.uu
new file mode 100644 (file)
index 0000000..228a957
--- /dev/null
@@ -0,0 +1,7 @@
+begin 664 test_extract.cpio.bz2
+M0EIH.3%!629365?=.4@``#G_@G*0(`#@`7^`(B04``LEC```!"``E`E(>I,H
+M::'J&@_4C3:@E$AD#0&@&@%"E;V/1!XIP>#C9T[41`4PQ1A`@S*4F&BD@B0T
+MBA$$-:\/@BQGNKU1G@%#`G+N0R%$JTHG(XBRB%1$V8F4#F_IWT=S4+ERVL(?
+40V!'@1L4+AO_B[DBG"A(*^Z<I```
+`
+end
diff --git a/cpio/test/test_extract.cpio.gz.uu b/cpio/test/test_extract.cpio.gz.uu
new file mode 100644 (file)
index 0000000..7ddccad
--- /dev/null
@@ -0,0 +1,7 @@
+begin 664 test_extract.cpio.gz
+M'XL("`5X<E```W1E<W1?97AT<F%C="YC<&EO`#,P-P!!`Q,#`T,#$#`$4F9F
+M(*ZYJ0&,-(#)&A@:&1@;F9L8&!F;@/EF!C!@9)R6F9-JR)"<GU>2FE=2K)"?
+MI@`6T>,R0+?$B$A+3$RQ6F*$88D1PA*"P!"[J#$2)R3(T=/'-4A149%AF`,`
+(305ZBP`"````
+`
+end
diff --git a/cpio/test/test_extract.cpio.lrz.uu b/cpio/test/test_extract.cpio.lrz.uu
new file mode 100644 (file)
index 0000000..563f797
--- /dev/null
@@ -0,0 +1,8 @@
+begin 664 test_extract.cpio.lrz
+M3%):20`&``(``````````%T````!`0```@$`$`,`````#@`#`````"\``QH`
+M&@````!W``$G`&4``#,``2(``0``#0$````U<-`Y!F$`MP$````8#=\$8#<1
+MR/BL39$D4M>["H7&@4%L/4*_(*VGB*YU>?RX.9]HL86'.A)H@Y;Z\^$?M^8_
+M!/-;62G.*7*A&A!_ENZ8$7]O-M7_.FTRC%BCGC95:6'9ZH3)QSCR4RX42P!`
+/-E>/7"L[:OY"/A924S4$
+`
+end
diff --git a/cpio/test/test_extract.cpio.lz.uu b/cpio/test/test_extract.cpio.lz.uu
new file mode 100644 (file)
index 0000000..67e41e9
--- /dev/null
@@ -0,0 +1,6 @@
+begin 664 test_extract.cpio.lz
+M3%I)4`$,`!@-WP1@-Q'(^*Q-D212U[L*A<:!06P]0K\@K:>(KG5Y_+@YGVBQ
+MA8<Z$FB#EOKSX1^WYC\$\UM9*<XI<J$:$'^B>;_>8N3MLP="$0SJ#QKYB?@8
+G]@'$$7\&W^T*+9?6B=?__M$G@$T%>HL``@```````($`````````
+`
+end
diff --git a/cpio/test/test_extract.cpio.lzma.uu b/cpio/test/test_extract.cpio.lzma.uu
new file mode 100644 (file)
index 0000000..449403e
--- /dev/null
@@ -0,0 +1,6 @@
+begin 664 test_extract.cpio.lzma
+M70``@`#__________P`8#=\$8#<1R/BL39$D4M>["H7&@4%L/4*_(*VGB*YU
+M>?RX.9]HL86'.A)H@Y;Z\^$?M^8_!/-;62G.*7*A&A!_HGF_WF+D[;.+!OW3
+:T_2I)V(;K[FNL#'W%T+L;ATS`A*3__[1Z```
+`
+end
diff --git a/cpio/test/test_extract.cpio.lzo.uu b/cpio/test/test_extract.cpio.lzo.uu
new file mode 100644 (file)
index 0000000..8ce87c7
--- /dev/null
@@ -0,0 +1,9 @@
+begin 664 test_extract.cpio.lzo
+MB4Q:3P`-"AH*$#`@8`E``04#```!``"!M%!R>-T`````$71E<W1?97AT<F%C
+M="YC<&EOOH$+9````@````"DIR,^[`HP-S`W,#<P,#0P,#$P8``#,3$P,#8V
+M>`$#-S4P,#`QE`!@`7`#"C`P,3(P,S(W-#`R,S2!`C:4`'````(R,V9I;&4Q
+M`&-O;G1E;G1S(&]F((8"+@HOD0$R(`:1`31J$#`P+I$!,B^1`3(HD`%L$3L,
+M`+P<+HH`,3,I1``(5%)!24Q%4B$A(0`@JP````$`````````````````````
+*````$0``````````
+`
+end
diff --git a/cpio/test/test_extract.cpio.xz.uu b/cpio/test/test_extract.cpio.xz.uu
new file mode 100644 (file)
index 0000000..5c593cf
--- /dev/null
@@ -0,0 +1,7 @@
+begin 664 test_extract.cpio.xz
+M_3=Z6%H```3FUK1&`@`A`18```!T+^6CX`'_`&%=`!@-WP1@-Q'(^*Q-D212
+MU[L*A<:!06P]0K\@K:>(KG5Y_+@YGVBQA8<Z$FB#EOKSX1^WYC\$\UM9*<XI
+M<J$:$'^B>;_>8N3MLXL&_=/3]*DG8ANON:ZP,?<70NQN'3"CP@``````J9FA
+=#1$]4L<``7V`!`````?M;4JQQ&?[`@`````$65H`
+`
+end
diff --git a/cpio/test/test_extract_cpio_Z.c b/cpio/test/test_extract_cpio_Z.c
new file mode 100644 (file)
index 0000000..f908fc5
--- /dev/null
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2012 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_Z)
+{
+       const char *reffile = "test_extract.cpio.Z";
+
+       extract_reference_file(reffile);
+       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");
+}
diff --git a/cpio/test/test_extract_cpio_bz2.c b/cpio/test/test_extract_cpio_bz2.c
new file mode 100644 (file)
index 0000000..bc4c11f
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_bz2)
+{
+       const char *reffile = "test_extract.cpio.bz2";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canBunzip2()) {
+               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 bzip2 is not supported on this platform");
+       }
+}
diff --git a/cpio/test/test_extract_cpio_gz.c b/cpio/test/test_extract_cpio_gz.c
new file mode 100644 (file)
index 0000000..19cee51
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_gz)
+{
+       const char *reffile = "test_extract.cpio.gz";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canGzip()) {
+               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 gzip is not supported on this platform");
+       }
+}
diff --git a/cpio/test/test_extract_cpio_lrz.c b/cpio/test/test_extract_cpio_lrz.c
new file mode 100644 (file)
index 0000000..6766758
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_lrz)
+{
+       const char *reffile = "test_extract.cpio.lrz";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canLrzip()) {
+               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 lrzip is not supported on this platform");
+       }
+}
diff --git a/cpio/test/test_extract_cpio_lz.c b/cpio/test/test_extract_cpio_lz.c
new file mode 100644 (file)
index 0000000..14775d9
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_lz)
+{
+       const char *reffile = "test_extract.cpio.lz";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canLunzip()) {
+               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 lzma is not supported on this platform");
+       }
+}
diff --git a/cpio/test/test_extract_cpio_lzma.c b/cpio/test/test_extract_cpio_lzma.c
new file mode 100644 (file)
index 0000000..b90e35b
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_lzma)
+{
+       const char *reffile = "test_extract.cpio.lzma";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canUnlzma()) {
+               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 lzma is not supported on this platform");
+       }
+}
diff --git a/cpio/test/test_extract_cpio_lzo.c b/cpio/test/test_extract_cpio_lzo.c
new file mode 100644 (file)
index 0000000..7685664
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_lzo)
+{
+       const char *reffile = "test_extract.cpio.lrz";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canLzop()) {
+               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 lrzip is not supported on this platform");
+       }
+}
diff --git a/cpio/test/test_extract_cpio_xz.c b/cpio/test/test_extract_cpio_xz.c
new file mode 100644 (file)
index 0000000..fd3c13f
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_xz)
+{
+       const char *reffile = "test_extract.cpio.xz";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canUnxz()) {
+               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 xz is not supported on this platform");
+       }
+}
index 03ab7c19effa3dc9d0ee6daa357c46ee22cb8fcd..c14baf0a8a5bba9f10d77dd1994cf7095067f27f 100644 (file)
@@ -12,11 +12,13 @@ IF(ENABLE_TAR AND ENABLE_TEST)
     test_basic.c
     test_copy.c
     test_empty_mtree.c
+    test_extract_tar_Z.c
     test_extract_tar_bz2.c
     test_extract_tar_gz.c
     test_extract_tar_lrz.c
     test_extract_tar_lz.c
     test_extract_tar_lzma.c
+    test_extract_tar_lzo.c
     test_extract_tar_xz.c
     test_format_newc.c
     test_help.c
diff --git a/tar/test/test_extract.tar.Z.uu b/tar/test/test_extract.tar.Z.uu
new file mode 100644 (file)
index 0000000..92713a5
--- /dev/null
@@ -0,0 +1,9 @@
+begin 664 test_extract.tar.Z
+M'YV09M*P*1,#@,&#"!,J7,BPH<.'$",BA$'1A@T:(`!0C'&C!HR,&SM^U$BQ
+M9$D9,T#$D`%CAHP;-&"@Q`@C1HP9-FH```%#HL^?0(,*!5!G#ITP<DB.J5-F
+M:,.E39TN-$D1)-6,4K-JW<JUZ]`Q;]S0*2-V#H@W9D`$'!C#A0*O<./*G4NW
+MKMV[>//JW<O7X=HR,OH*=EC2(D:2'#U:33R2JDF4*EFZA"F31@V>-F?<Z,ES
+ML.>'18\FI0@5;FFOCJV:Q/JYM>NM8,62I6,6K5J!@-V^WLV[M^_?P(,+'TZ\
+0N/'CR),K7\Z\N?/GT*,K!P``
+`
+end
diff --git a/tar/test/test_extract.tar.lzo.uu b/tar/test/test_extract.tar.lzo.uu
new file mode 100644 (file)
index 0000000..29dd8d8
--- /dev/null
@@ -0,0 +1,9 @@
+begin 664 test_extract.tar.lzo
+MB4Q:3P`-"AH*$#`@8`E``04#```!``"!M%!R@T``````$'1E<W1?97AT<F%C
+M="YT87*FJ0IM```,`````+BYG#.C`V9I;&4Q`"`]```+,#`P-C8T(``P,#$W
+M-3`J'0`PH```!C(S(#$R,#,R-S0P,C,T(#`Q,3,V-0`@,"`]6`*T"PAU<W1A
+M<@`P,&-U9:`"-10`/GP`I!EP&V4!(#44`2!P6``)8V]N=&5N=',@;V8@CD$N
+M"B!PC`(@`#Q``FT^,B`^@`4@#/X/-#6>?S<P(`!6_0\R(`#/_`\@/N@/(```
+=`')X`0X``````````````````````!$`````````
+`
+end
diff --git a/tar/test/test_extract_tar_Z.c b/tar/test/test_extract_tar_Z.c
new file mode 100644 (file)
index 0000000..7c994b4
--- /dev/null
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2012 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_Z)
+{
+       const char *reffile = "test_extract.tar.Z";
+
+       extract_reference_file(reffile);
+       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");
+}
index dd38d7f74ed98bf2e4714c75ee64dfd25d0212c9..56a0fb88231ef0a18c0f9e9783f27d19c818041e 100644 (file)
@@ -41,7 +41,7 @@ DEFINE_TEST(test_extract_tar_lrz)
                assertFileExists("file2");
                assertTextFileContents("contents of file2.\n", "file2");
                assertEmptyFile("test.out");
-               /*assertEmptyFile("test.err");*/
+               assertEmptyFile("test.err");
        } else {
                skipping("It seems lrzip is not supported on this platform");
        }
diff --git a/tar/test/test_extract_tar_lzo.c b/tar/test/test_extract_tar_lzo.c
new file mode 100644 (file)
index 0000000..eba2f53
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2012 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_lzo)
+{
+       const char *reffile = "test_extract.tar.lzo";
+       int f;
+
+       extract_reference_file(reffile);
+       f = systemf("%s -tf %s >test.out 2>test.err", testprog, reffile);
+       if (f == 0 || canLzop()) {
+               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 lrzip is not supported on this platform");
+       }
+}