Subject: | [PATCH] Test failures on Win32/Cygwin |
The following test failure occurs on Cygwin and Win32.
t/10....ok
t/11....Unlink of existing share file c:\sharefile-10208-1183534601
failed: Permission denied at
/home/cwill1is/perl588/.cpanplus/5.8.8/build/Cache-FastMmap-1.16/blib/lib/Cache/FastMmap.pm
line 515.
# Looks like you planned 7 tests but only ran 4.
# Looks like your test died just after 4.
dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 5-7
Failed 3/7 tests, 57.14% okay
t/2.....ok
t/3.....ok
t/4.....ok
This is due to some oddities of the Win32 file systems. The problem
relates to remove() and the speed at which Win32 file systems are
updated. This leads to odd failures in deletes if a file is created and
deleted in rapid succession. The attached patch uses the Windows API on
Windows and Cygwin to resolve this problem.
--- Cache-FastMmap-CImpl/mmap_cache.c.orig 2007-08-27
13:59:12.015625000 -0
500
+++ Cache-FastMmap-CImpl/mmap_cache.c 2007-08-27 14:07:53.937500000 -0500
@@ -24,6 +24,9 @@
#include <time.h>
#include <errno.h>
#include <stdarg.h>
+#if defined(WIN32) || defined(__CYGWIN__)
+# include <Windows.h>
+#endif
#include "mmap_cache.h"
#ifdef DEBUG
@@ -244,8 +247,12 @@
/* Remove if different size or remove requested */
if (!res &&
(cache->init_file || (statbuf.st_size != c_size))) {
+#if defined(WIN32) || defined(__CYGWIN__)
+ res = DeleteFile(cache->share_file);
+#else
res = remove(cache->share_file);
- if (res == -1 && errno != ENOENT) {
+#endif
+ if (res != 0 && errno != ENOENT) {
_mmc_set_error(cache, errno, "Unlink of existing share file %s
failed", cache->share_file);
return -1;
}