]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
On Windows, pass test_gcpio_compat in bsdcpio_test.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 6 Mar 2009 16:05:49 +0000 (11:05 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 6 Mar 2009 16:05:49 +0000 (11:05 -0500)
SVN-Revision: 738

cpio/test/main.c
cpio/test/test_gcpio_compat.c

index 2bfcd72f2de127ab28c6fe63df1b06beff77fe86..1c26e1c938c8fc1b5d924bcbcd04097db8f18c84 100644 (file)
@@ -874,6 +874,10 @@ int main(int argc, char **argv)
 
        (void)argc; /* UNUSED */
 
+#ifdef _WIN32
+       /* Make sure open() function will be used with a binary mode. */
+       _set_fmode(_O_BINARY);
+#endif
        /*
         * Name of this program, used to build root of our temp directory
         * tree.
index e36198fcf932e1ce3179380bc80d10c77da0457c..d4acf0d7e6e50eeaa6a1da03a946feb5c428312e 100644 (file)
@@ -62,7 +62,11 @@ unpack_test(const char *from, const char *options, const char *se)
        assertEqualInt(r, 0);
        if (r == 0) {
                assert(S_ISREG(st.st_mode));
+#ifdef _WIN32
+               assertEqualInt(0600, st.st_mode & 0700);
+#else
                assertEqualInt(0644, st.st_mode & 0777);
+#endif
                failure("file %s/file", from);
                assertEqualInt(10, st.st_size);
                failure("file %s/file", from);
@@ -75,7 +79,11 @@ unpack_test(const char *from, const char *options, const char *se)
        assertEqualInt(r, 0);
        if (r == 0) {
                assert(S_ISREG(st2.st_mode));
+#ifdef _WIN32
+               assertEqualInt(0600, st2.st_mode & 0700);
+#else
                assertEqualInt(0644, st2.st_mode & 0777);
+#endif
                failure("file %s/file", from);
                assertEqualInt(10, st2.st_size);
                failure("file %s/file", from);
@@ -109,7 +117,11 @@ unpack_test(const char *from, const char *options, const char *se)
        if (r == 0) {
                assertEqualInt(r, 0);
                assert(S_ISDIR(st.st_mode));
+#ifdef _WIN32
+               assertEqualInt(0700, st.st_mode & 0700);
+#else
                assertEqualInt(0775, st.st_mode & 0777);
+#endif
        }
 
        chdir("..");
@@ -122,11 +134,11 @@ DEFINE_TEST(test_gcpio_compat)
        oldumask = umask(0);
 
        /* Dearchive sample files with a variety of options. */
-       unpack_test("test_gcpio_compat_ref.bin", "", "1 block\n");
-       unpack_test("test_gcpio_compat_ref.crc", "", "2 blocks\n");
-       unpack_test("test_gcpio_compat_ref.newc", "", "2 blocks\n");
+       unpack_test("test_gcpio_compat_ref.bin", "", "1 block" NL);
+       unpack_test("test_gcpio_compat_ref.crc", "", "2 blocks" NL);
+       unpack_test("test_gcpio_compat_ref.newc", "", "2 blocks" NL);
        /* gcpio-2.9 only reads 6 blocks here */
-       unpack_test("test_gcpio_compat_ref.ustar", "", "7 blocks\n");
+       unpack_test("test_gcpio_compat_ref.ustar", "", "7 blocks" NL);
 
        umask(oldumask);
 }