2 * Copyright (c) 2003-2007 Tim Kientzle
5 * Based on libarchive/test/test_read_format_isojoliet_bz2.c with
6 * bugs introduced by Andreas Henriksson <andreas@fatal.se> for
7 * testing ISO9660 image with Joliet extension and versioned files.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 __FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c 201247 2009-12-30 05:59:21Z kientzle $");
33 * The data for this testcase was provided by Mike Qin <mikeandmore@gmail.com>
34 * and created with Nero.
37 DEFINE_TEST(test_read_format_isojoliet_versioned)
39 const char *refname = "test_read_format_iso_joliet_by_nero.iso.Z";
40 struct archive_entry *ae;
43 extract_reference_file(refname);
44 assert((a = archive_read_new()) != NULL);
45 assertEqualInt(0, archive_read_support_filter_all(a));
46 assertEqualInt(0, archive_read_support_format_all(a));
47 assertEqualInt(ARCHIVE_OK,
48 archive_read_set_option(a, "iso9660", "rockridge", NULL));
49 assertEqualInt(ARCHIVE_OK,
50 archive_read_open_filename(a, refname, 10240));
52 /* First entry is '.' root directory. */
53 assertEqualInt(0, archive_read_next_header(a, &ae));
54 assertEqualString(".", archive_entry_pathname(ae));
55 assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
58 assertEqualInt(0, archive_read_next_header(a, &ae));
59 assertEqualString("test", archive_entry_pathname(ae));
60 assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
62 /* A regular file which is called test.txt and has
63 * ;1 appended to it because apparently Nero always
64 * appends versions to all files in the joliet extension.
66 * We test to make sure the version has been stripped.
68 assertEqualInt(0, archive_read_next_header(a, &ae));
69 assertEqualString("test/test.txt",
70 archive_entry_pathname(ae));
71 assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
74 assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
76 /* Verify archive format. */
77 assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS);
79 /* Close the archive. */
80 assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
81 assertEqualInt(ARCHIVE_OK, archive_read_free(a));