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)
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
+}
/* 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, ...);
}
/* 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)
#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
#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)
{
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;