]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
test: add joliet iso with versioned files testcase.
authorAndreas Henriksson <andreas@fatal.se>
Tue, 29 Jun 2010 15:47:14 +0000 (11:47 -0400)
committerAndreas Henriksson <andreas@fatal.se>
Tue, 29 Jun 2010 15:47:14 +0000 (11:47 -0400)
Add test code and a Nero ISO image for testing joliet
code with isos that always append version numbers.

SVN-Revision: 2513

Makefile.am
libarchive/test/CMakeLists.txt
libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu [new file with mode: 0644]
libarchive/test/test_read_format_isojoliet_versioned.c [new file with mode: 0644]

index 3499d7da273a9103401809e10f26a9b899d76c7d..271b28793bc2de71e65777e5ef715a1bcabedb28 100644 (file)
@@ -292,6 +292,7 @@ libarchive_test_SOURCES=                                    \
        libarchive/test/test_read_format_isojoliet_bz2.c        \
        libarchive/test/test_read_format_isojoliet_long.c       \
        libarchive/test/test_read_format_isojoliet_rr.c         \
+       libarchive/test/test_read_format_isojoliet_versioned.c  \
        libarchive/test/test_read_format_isorr_bz2.c            \
        libarchive/test/test_read_format_isorr_ce.c             \
        libarchive/test/test_read_format_isorr_new_bz2.c        \
index b6608c264683dfb45305f8d6499877a98b8a8448..d0e0071f83ea984b228b35512b8dfb9055e79d92 100644 (file)
@@ -66,6 +66,7 @@ IF(ENABLE_TEST)
     test_read_format_isojoliet_bz2.c
     test_read_format_isojoliet_long.c
     test_read_format_isojoliet_rr.c
+    test_read_format_isojoliet_versioned.c
     test_read_format_isorr_bz2.c
     test_read_format_isorr_ce.c
     test_read_format_isorr_new_bz2.c
diff --git a/libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu b/libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu
new file mode 100644 (file)
index 0000000..8a5a263
--- /dev/null
@@ -0,0 +1,64 @@
+begin 600 test_read_format_iso_joliet_by_nero.iso.Z
+M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$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:XS[WN=\_[WOO^
+M]\`/OO"'3_SB&__XR$^^\I?/_.8[__G0C[[TIT_]ZEO_^MC/OO:WS_WN>__[
+MX`^_^,=/_O*;__SH3[_ZU\_^]KO__?"/O_SG3__ZV__^^,^__O?/__[[__\`
+M&(`".(`$6(`&>(`(F(`*N(`,V(`.^(`0&($2.($46($6>($8F($:N($<V($>
+M^($@&((B.((D6((F>((HF((JN((LV((N^((P&(,R.(,T6(,V>(,XF(,ZN(,\
+MV(,^^(-`&(1".(1$6(1&>(1(F(1*N(1,V(1.^(10&(52.(546(56>(58F(5:
+MN(5<V(5>^(5@&(9B.(9D6(9F>(9HF(9JN(9LV(9N^(9P&(=R.(=T6(=V>(=X
+MF(=ZN(=\V(=^^(>`&(B".(B$6(B&>(B(F(B*N(B,V(B.^(B0&(F2.(F46(F6
+M>(F8F(F:N(F<V(F>^(F@&(JB.(JD6(JF>(JHF(JJN(JLV(JN^(JP&(NR.(NT
+M6(NV>(NXF(NZN(N\V(N^^(O`&(S".(S$6(S&>(S(F(S*N(S,V(S.^(S0&(W2
+M.(W46(W6>(W8F(W:N(W<V(W>^(W@&([B.([D6([F>([HF([JN([LV([N^([P
+F&(_R.(_T6(_V>(_XF(_ZN(_\V(_^^(\`&9`".9`$69`&>9`(V6X`
+`
+end
diff --git a/libarchive/test/test_read_format_isojoliet_versioned.c b/libarchive/test/test_read_format_isojoliet_versioned.c
new file mode 100644 (file)
index 0000000..9e0e5b7
--- /dev/null
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Based on libarchive/test/test_read_format_isojoliet_bz2.c with
+ * bugs introduced by Andreas Henriksson <andreas@fatal.se> for
+ * testing ISO9660 image with Joliet extension and versioned files.
+ *
+ * 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: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+/*
+ * The data for this testcase was provided by Mike Qin <mikeandmore@gmail.com>
+ * and created with Nero.
+ */
+
+DEFINE_TEST(test_read_format_isojoliet_versioned)
+{
+       const char *refname = "test_read_format_iso_joliet_by_nero.iso.Z";
+       struct archive_entry *ae;
+       struct archive *a;
+
+       extract_reference_file(refname);
+       assert((a = archive_read_new()) != NULL);
+       assertEqualInt(0, archive_read_support_compression_all(a));
+       assertEqualInt(0, archive_read_support_format_all(a));
+       assertEqualInt(ARCHIVE_OK,
+           archive_read_set_options(a, "iso9660:!rockridge"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_read_open_filename(a, refname, 10240));
+
+       /* First entry is '.' root directory. */
+       assertEqualInt(0, archive_read_next_header(a, &ae));
+       assertEqualString(".", archive_entry_pathname(ae));
+       assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
+
+       /* A directory. */
+       assertEqualInt(0, archive_read_next_header(a, &ae));
+       assertEqualString("test", archive_entry_pathname(ae));
+       assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
+
+       /* A regular file which is called test.txt and has
+        * ;1 appended to it because apparently Nero always
+        * appends versions to all files in the joliet extension.
+        *
+        * We test to make sure the version has been stripped.
+        */
+       assertEqualInt(0, archive_read_next_header(a, &ae));
+       assertEqualString("test/test.txt",
+           archive_entry_pathname(ae));
+       assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
+
+       /* End of archive. */
+       assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+       /* Verify archive format. */
+       assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS);
+
+       /* Close the archive. */
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+