]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
bsdcpio_test builds cleanly on VS9 and MinGW with this revision.
authorTim Kientzle <kientzle@gmail.com>
Thu, 6 Aug 2009 04:52:37 +0000 (00:52 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 6 Aug 2009 04:52:37 +0000 (00:52 -0400)
SVN-Revision: 1342

cpio/test/CMakeLists.txt
cpio/test/main.c
cpio/test/test.h
cpio/test/test_option_a.c
cpio/test/test_owner_parse.c

index 072e68f009ae8d7db56fca3d659abc2e03c1180a..22bfd7ad6dbbb4a210b324bc0af861f5f748f0c4 100644 (file)
@@ -39,7 +39,6 @@ IF(ENABLE_CPIO AND ENABLE_TEST)
     test_pathmatch.c
   )
   IF(WIN32 AND NOT CYGWIN)
-    LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.c)
     LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h)
   ENDIF(WIN32 AND NOT CYGWIN)
 
index 068821e709208a4f6f6401871cd179f3ba527f76..1f6877a28a2e21bf40c020642b046a73799ad76f 100644 (file)
@@ -1753,3 +1753,16 @@ int main(int argc, char **argv)
 
        return (tests_failed);
 }
+
+void
+sleepUntilAfter(time_t t)
+{
+       /* If utime() is supported above, there's no sleep here which
+        * makes the test faster. */
+       while (t >= time(NULL))
+#if defined(_WIN32) && !defined(__CYGWIN__)
+               Sleep(500);
+#else
+               sleep(1);
+#endif
+}
index 13dd380dadb75b1d9eb5d19cc8cb94fa2fe21fca..ad504770ce5031f6c51c05e0d03c8691fae85aa6 100644 (file)
@@ -221,6 +221,9 @@ void test_skipping(const char *fmt, ...);
 /* Like sprintf, then system() */
 int systemf(const char * fmt, ...);
 
+/* Delay until time() returns a value after this. */
+void sleepUntilAfter(time_t);
+
 /* Suck file into string allocated via malloc(). Call free() when done. */
 /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
 char *slurpfile(size_t *, const char *fmt, ...);
index a597bd8d6bd3b164295b91d2dfbc04e8b361875c..815845736fda6fe2c5dc533188a200804726a204 100644 (file)
@@ -83,10 +83,7 @@ test_create(void)
        }
 
        /* Wait until the atime on the last file is actually in the past. */
-       /* If utime() is supported above, there's no sleep here which
-        * makes the test faster. */
-       while (files[numfiles - 1].atime_sec >= time(NULL))
-               sleep(1);
+       sleepUntilAfter(files[numfiles - 1].atime_sec);
 }
 
 DEFINE_TEST(test_option_a)
index 7288bb496d5ac3dbc985eeb95e01c1277a40ecba..e63ba894936c1d7bd75a958a34cccf1428b34d06 100644 (file)
@@ -28,7 +28,11 @@ __FBSDID("$FreeBSD$");
 #include "../cpio.h"
 #include "err.h"
 
-#if defined(__CYGWIN__)
+#if !defined(_WIN32)
+#define ROOT "root"
+static int root_uids[] = { 0 };
+static int root_gids[] = { 0 };
+#elif defined(__CYGWIN__)
 /* On cygwin, the Administrator user most likely exists (unless
  * it has been renamed or is in a non-English localization), but
  * its primary group membership depends on how the user set up
@@ -40,12 +44,9 @@ __FBSDID("$FreeBSD$");
 #define ROOT "Administrator"
 static int root_uids[] = { 500 };
 static int root_gids[] = { 513, 545, 544 };
-#else
-#define ROOT "root"
-static int root_uids[] = { 0 };
-static int root_gids[] = { 0 };
 #endif
 
+#if defined(ROOT)
 static int
 int_in_list(int i, int *l, size_t n)
 {
@@ -55,12 +56,12 @@ int_in_list(int i, int *l, size_t n)
        failure("%d", i);
        return (0);
 }
+#endif
 
 DEFINE_TEST(test_owner_parse)
 {
-#if defined(_WIN32) && !defined(__CYGWIN__)
-       /* TODO: Does this need cygwin style handling of uid/gid ? */
-       skipping("Windows cannot handle uid/gid as UNIX like system");
+#if !defined(ROOT)
+       skipping("No uid/gid configuration for this OS");
 #else
        int uid, gid;