summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/test/test_write_disk_hardlink.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2009-04-12 05:33:34 +0000
committerkientzle <kientzle@FreeBSD.org>2009-04-12 05:33:34 +0000
commitfc11fa5eb364f981efd4df40925c0659f0315090 (patch)
treeea7abcf2cbb02747476436a0768d0136320ece2d /lib/libarchive/test/test_write_disk_hardlink.c
parent0cb01ac4efbe6bb5e86d45975514931ea0d7b400 (diff)
downloadFreeBSD-src-fc11fa5eb364f981efd4df40925c0659f0315090.zip
FreeBSD-src-fc11fa5eb364f981efd4df40925c0659f0315090.tar.gz
Merge from libarchive.googlecode.com: Mostly a bunch of
corrections to the Windows support to reconcile differences between Visual Studio and Cygwin. Includes parts of revisions 757, 774, 787, 815, 817, 819, 820, 844, and 886. Of particular note, r886 overhauled the UTF-8/Unicode conversions to work correctly regardless of whether the local system uses 16-bit or 32-bit wchar_t. (I assume that systems with 16-bit wchar_t use UTF-16 and those with 32-bit wchar_t use UCS-4.) This revision also added a preference for wcrtomb() (which is thread-safe) on platforms that support it.
Diffstat (limited to 'lib/libarchive/test/test_write_disk_hardlink.c')
-rw-r--r--lib/libarchive/test/test_write_disk_hardlink.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libarchive/test/test_write_disk_hardlink.c b/lib/libarchive/test/test_write_disk_hardlink.c
index f9bcfae..2ab2420 100644
--- a/lib/libarchive/test/test_write_disk_hardlink.c
+++ b/lib/libarchive/test/test_write_disk_hardlink.c
@@ -25,7 +25,14 @@
#include "test.h"
__FBSDID("$FreeBSD$");
+#if defined(_WIN32) && !defined(__CYGWIN__)
+/* Execution bits, Group members bits and others bits do not work. */
+#define UMASK 0177
+#define E_MASK (~0177)
+#else
#define UMASK 022
+#define E_MASK (~0)
+#endif
/*
* Exercise hardlink recreation.
@@ -36,7 +43,7 @@ __FBSDID("$FreeBSD$");
*/
DEFINE_TEST(test_write_disk_hardlink)
{
-#if ARCHIVE_VERSION_NUMBER < 1009000 || defined(_WIN32)
+#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_write_disk_hardlink tests");
#else
static const char data[]="abcdefghijklmnopqrstuvwxyz";
@@ -175,7 +182,7 @@ DEFINE_TEST(test_write_disk_hardlink)
* doesn't carry data for it, we consider it to be
* non-authoritive for meta data as well. This is consistent
* with GNU tar and BSD pax. */
- assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK);
assertEqualInt(st.st_size, sizeof(data));
assertEqualInt(st.st_nlink, 2);
@@ -194,7 +201,7 @@ DEFINE_TEST(test_write_disk_hardlink)
* common file formats that store a size of zero for
* hardlinks. */
assert(0 == stat("link2a", &st));
- assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK);
assertEqualInt(st.st_size, sizeof(data));
assertEqualInt(st.st_nlink, 2);
@@ -207,12 +214,12 @@ DEFINE_TEST(test_write_disk_hardlink)
/* Test #3 */
assert(0 == stat("link3a", &st));
- assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK);
assertEqualInt(st.st_size, sizeof(data));
assertEqualInt(st.st_nlink, 2);
assert(0 == stat("link3b", &st2));
- assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st2.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK);
assertEqualInt(st2.st_size, sizeof(data));
assertEqualInt(st2.st_nlink, 2);
assertEqualInt(st.st_ino, st2.st_ino);
@@ -220,12 +227,12 @@ DEFINE_TEST(test_write_disk_hardlink)
/* Test #4 */
assert(0 == stat("link4a", &st));
- assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK);
assertEqualInt(st.st_size, sizeof(data));
assertEqualInt(st.st_nlink, 2);
assert(0 == stat("link4b", &st2));
- assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st2.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK);
assertEqualInt(st2.st_size, sizeof(data));
assertEqualInt(st2.st_nlink, 2);
assertEqualInt(st.st_ino, st2.st_ino);
OpenPOWER on IntegriCloud