summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-04-08 10:19:33 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2015-04-25 12:46:08 +1000
commit4f3da019e893b18ec392025845dd5b839c820893 (patch)
treee4651ddb168fc5dc0b3da9e8eef1ac22df4879ff
parent701741129032b1af1bf34b00797f3b628084f974 (diff)
downloadmongo-4f3da019e893b18ec392025845dd5b839c820893.tar.gz
Enable test/fops for Windows, and add to CI
- Added Windows shim for gettimeofday
-rw-r--r--SConstruct11
-rw-r--r--test/fops/t.c19
-rw-r--r--test/fops/thread.h10
-rw-r--r--test/mciproject.yml20
-rw-r--r--test/windows/windows_shim.c17
-rw-r--r--test/windows/windows_shim.h10
6 files changed, 78 insertions, 9 deletions
diff --git a/SConstruct b/SConstruct
index 8e9fae28ac6..9d9a3918a2e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -338,11 +338,12 @@ t = env.Program("t_huge",
LIBS=[wtlib] + wtlibs)
Default(t)
-#env.Program("t_fops",
- #["test/fops/file.c",
- #"test/fops/fops.c",
- #"test/fops/t.c"],
- #LIBS=[wtlib])
+t = env.Program("t_fops",
+ ["test/fops/file.c",
+ "test/fops/fops.c",
+ "test/fops/t.c"],
+ LIBS=[wtlib, shim] + wtlibs)
+Default(t)
if useBdb:
benv = env.Clone()
diff --git a/test/fops/t.c b/test/fops/t.c
index 1522b5941f7..be98310be38 100644
--- a/test/fops/t.c
+++ b/test/fops/t.c
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
return (usage());
/* Use line buffering on stdout so status updates aren't buffered. */
- (void)setvbuf(stdout, NULL, _IOLBF, 0);
+ (void)setvbuf(stdout, NULL, _IOLBF, 32);
/* Clean up on signal. */
(void)signal(SIGINT, onint);
@@ -156,7 +156,14 @@ wt_startup(char *config_open)
int ret;
char config_buf[128];
- if ((ret = system("rm -rf WT_TEST && mkdir WT_TEST")) != 0)
+#undef CMD
+#ifdef _WIN32
+#define CMD "rd /s /q WT_TEST & mkdir WT_TEST"
+#else
+#define CMD "rm -rf WT_TEST && mkdir WT_TEST"
+#endif
+
+ if ((ret = system(CMD)) != 0)
die(ret, "directory cleanup call failed");
snprintf(config_buf, sizeof(config_buf),
@@ -192,7 +199,13 @@ shutdown(void)
{
int ret;
- if ((ret = system("rm -rf WT_TEST")) != 0)
+#undef CMD
+#ifdef _WIN32
+#define CMD "if exist WT_TEST rd /s /q WT_TEST"
+#else
+#define CMD "rm -rf WT_TEST"
+#endif
+ if ((ret = system(CMD)) != 0)
die(ret, "directory cleanup call failed");
}
diff --git a/test/fops/thread.h b/test/fops/thread.h
index 3b49a45d9bb..72333f5f710 100644
--- a/test/fops/thread.h
+++ b/test/fops/thread.h
@@ -27,16 +27,26 @@
*/
#include <sys/types.h>
+#ifndef _WIN32
#include <sys/time.h>
+#endif
#include <errno.h>
#include <inttypes.h>
+#ifndef _WIN32
#include <pthread.h>
+#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef _WIN32
#include <unistd.h>
+#endif
+
+#ifdef _WIN32
+#include "windows_shim.h"
+#endif
#include <wiredtiger.h>
diff --git a/test/mciproject.yml b/test/mciproject.yml
index 64007bdbd92..49caa44438d 100644
--- a/test/mciproject.yml
+++ b/test/mciproject.yml
@@ -72,6 +72,23 @@ tasks:
scons.bat ${smp_command|} "CFLAGS=/Gv /wd4090 /wd4996 /we4047 /we4024 /TC /we4100" wiredtiger.dll libwiredtiger.lib
+ - name: fops-windows
+ commands:
+ - func: "fetch source"
+ - command: git.apply_patch
+ params:
+ directory: wiredtiger
+ - command: shell.exec
+ params:
+ working_dir: "wiredtiger"
+ script: |
+ set -o errexit
+ set -o verbose
+
+ scons.bat --enable-python=c:\\swigwin-3.0.2\\swig.exe ${smp_command|}
+
+ cmd.exe /c t_fops.exe
+
buildvariants:
- name: ubuntu1404
display_name: Ubuntu 14.04
@@ -99,12 +116,13 @@ buildvariants:
- name: windows-64
display_name: Windows 64-bit
run_on:
- - windows-64-vs2013-compile
+ - windows-64-vs2013-test
expansions:
smp_command: -j$(grep -c ^processor /proc/cpuinfo)
tasks:
- name: compile-windows
- name: compile-windows-alt
+ - name: fops-windows
- name: osx-108
display_name: OS X 10.8
diff --git a/test/windows/windows_shim.c b/test/windows/windows_shim.c
index 8b0f05bfe2d..2c2a562fbe7 100644
--- a/test/windows/windows_shim.c
+++ b/test/windows/windows_shim.c
@@ -56,6 +56,23 @@ usleep(useconds_t useconds)
return (0);
}
+int gettimeofday(struct timeval* tp, void* tzp)
+{
+ uint64_t ns100;
+ FILETIME time;
+
+ tzp = tzp;
+
+ GetSystemTimeAsFileTime(&time);
+
+ ns100 = (((int64_t)time.dwHighDateTime << 32) + time.dwLowDateTime)
+ - 116444736000000000LL;
+ tp->tv_sec = ns100 / 10000000;
+ tp->tv_usec = (long)((ns100 % 10000000) / 10);
+
+ return (0);
+}
+
int
pthread_rwlock_destroy(pthread_rwlock_t *lock)
{
diff --git a/test/windows/windows_shim.h b/test/windows/windows_shim.h
index 97d1e996eaa..c124cda6092 100644
--- a/test/windows/windows_shim.h
+++ b/test/windows/windows_shim.h
@@ -60,6 +60,16 @@ _Check_return_opt_ int __cdecl _wt_snprintf(
#define mkdir(path, mode) _mkdir(path)
/*
+ * Emulate <sys/time.h>
+ */
+struct timeval {
+ time_t tv_sec;
+ int64_t tv_usec;
+};
+
+int gettimeofday(struct timeval* tp, void* tzp);
+
+/*
* Emulate <sched.h>
*/
int sched_yield(void);