summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/libarchive/test/test_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/libarchive/files/libarchive/test/test_entry.c')
-rw-r--r--archivers/libarchive/files/libarchive/test/test_entry.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/archivers/libarchive/files/libarchive/test/test_entry.c b/archivers/libarchive/files/libarchive/test/test_entry.c
index 0ccc9e8fb35..0cf13e825af 100644
--- a/archivers/libarchive/files/libarchive/test/test_entry.c
+++ b/archivers/libarchive/files/libarchive/test/test_entry.c
@@ -27,6 +27,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/test_entry.c 201247 2009-12-30 05:5
#include <locale.h>
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h> /* for Linux file flags */
+#endif
+
#ifndef HAVE_WCSCPY
static wchar_t * wcscpy(wchar_t *s1, const wchar_t *s2)
{
@@ -336,17 +340,38 @@ DEFINE_TEST(test_entry)
/* Converting fflags bitmap to string is currently system-dependent. */
/* TODO: Make this system-independent. */
assertEqualString(archive_entry_fflags_text(e),
- "uappnd,nouchg,nodump,noopaque,uunlnk");
+ "uappnd,nouchg,nodump,noopaque,uunlnk,nosystem");
+#endif
+
+#if defined(__FreeBSD__) || defined(__APPLE__)
/* Test archive_entry_copy_fflags_text_w() */
- archive_entry_copy_fflags_text_w(e, L" ,nouappnd, nouchg, dump,uunlnk");
+ archive_entry_copy_fflags_text_w(e, L" ,nouappnd, nouchg, dump,hidden");
archive_entry_fflags(e, &set, &clear);
- assertEqualInt(16, set);
- assertEqualInt(7, clear);
+ assertEqualInt(UF_HIDDEN, set);
+ assertEqualInt(UF_NODUMP | UF_IMMUTABLE | UF_APPEND, clear);
/* Test archive_entry_copy_fflags_text() */
- archive_entry_copy_fflags_text(e, " ,nouappnd, nouchg, dump,uunlnk");
+ archive_entry_copy_fflags_text(e, " ,nouappnd, nouchg, dump,hidden");
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(UF_HIDDEN, set);
+ assertEqualInt(UF_NODUMP | UF_IMMUTABLE | UF_APPEND, clear);
+#elif defined(_WIN32) && !defined(CYGWIN)
+ archive_entry_copy_fflags_text_w(e, L"rdonly,hidden,nosystem");
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN, set);
+ assertEqualInt(FILE_ATTRIBUTE_SYSTEM, clear);
+ archive_entry_copy_fflags_text(e, "rdonly,hidden,nosystem");
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN, set);
+ assertEqualInt(FILE_ATTRIBUTE_SYSTEM, clear);
+#elif defined FS_IOC_GETFLAGS /* Linux */
+ archive_entry_copy_fflags_text_w(e, L"sappnd,schg,dump,noundel");
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(FS_APPEND_FL | FS_IMMUTABLE_FL, set);
+ assertEqualInt(FS_NODUMP_FL | FS_UNRM_FL, clear);
+ archive_entry_copy_fflags_text(e, "sappnd,schg,dump,noundel");
archive_entry_fflags(e, &set, &clear);
- assertEqualInt(16, set);
- assertEqualInt(7, clear);
+ assertEqualInt(FS_APPEND_FL | FS_IMMUTABLE_FL, set);
+ assertEqualInt(FS_NODUMP_FL | FS_UNRM_FL, clear);
#endif
/* See test_acl_basic.c for tests of ACL set/get consistency. */