diff options
author | joerg <joerg@pkgsrc.org> | 2017-02-25 20:53:51 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2017-02-25 20:53:51 +0000 |
commit | c8fcd52665c6781876ed54832bd7f6ea46348688 (patch) | |
tree | b5165a0dff599b0ae48d70b5104febf7f8732828 /archivers/libarchive/files/libarchive/test/test_read_format_raw.c | |
parent | f67a2b170587775e96627a49fc615267312586d3 (diff) | |
download | pkgsrc-c8fcd52665c6781876ed54832bd7f6ea46348688.tar.gz |
Import libarchive-3.3.1.
Diffstat (limited to 'archivers/libarchive/files/libarchive/test/test_read_format_raw.c')
-rw-r--r-- | archivers/libarchive/files/libarchive/test/test_read_format_raw.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_raw.c b/archivers/libarchive/files/libarchive/test/test_read_format_raw.c index 1310090cbc6..831bcec11de 100644 --- a/archivers/libarchive/files/libarchive/test/test_read_format_raw.c +++ b/archivers/libarchive/files/libarchive/test/test_read_format_raw.c @@ -35,6 +35,7 @@ DEFINE_TEST(test_read_format_raw) struct archive *a; const char *reffile1 = "test_read_format_raw.data"; const char *reffile2 = "test_read_format_raw.data.Z"; + const char *reffile3 = "test_read_format_raw.bufr"; /* First, try pulling data out of an uninterpretable file. */ extract_reference_file(reffile1); @@ -90,4 +91,30 @@ DEFINE_TEST(test_read_format_raw) assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* Third, try with file which fooled us in past - appeared to be tar. */ + extract_reference_file(reffile3); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_raw(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, reffile3, 1)); + + /* First (and only!) Entry */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("data", archive_entry_pathname(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + /* Most fields should be unset (unknown) */ + assert(!archive_entry_size_is_set(ae)); + assert(!archive_entry_atime_is_set(ae)); + assert(!archive_entry_ctime_is_set(ae)); + assert(!archive_entry_mtime_is_set(ae)); + + /* Test EOF */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } |