summaryrefslogtreecommitdiff
path: root/test/fops
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2015-05-01 12:24:27 +1000
committerDavid Hows <howsdav@gmail.com>2015-05-01 17:29:04 +1000
commit9925a414cd4af10c7533aa53e288c0b418c5e50e (patch)
tree68502f391d228cac75f149c1cb2aabb806de9971 /test/fops
parent809859d07c16dc6cde215c7d23628af903f4b942 (diff)
downloadmongo-9925a414cd4af10c7533aa53e288c0b418c5e50e.tar.gz
Code review Changes
Diffstat (limited to 'test/fops')
-rw-r--r--test/fops/file.c77
-rw-r--r--test/fops/fops.c5
-rw-r--r--test/fops/t.c14
-rw-r--r--test/fops/thread.h5
4 files changed, 48 insertions, 53 deletions
diff --git a/test/fops/file.c b/test/fops/file.c
index f98b4547e6a..7453b81860d 100644
--- a/test/fops/file.c
+++ b/test/fops/file.c
@@ -27,7 +27,6 @@
*/
#include "thread.h"
-#include "test_util.i"
static u_int uid = 1;
@@ -39,23 +38,23 @@ obj_bulk(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
if ((ret = session->create(session, uri, config)) != 0)
if (ret != EEXIST && ret != EBUSY)
- die(ret, "session.create");
+ testutil_die(ret, "session.create");
if (ret == 0) {
sched_yield();
if ((ret = session->open_cursor(
session, uri, NULL, "bulk", &c)) == 0) {
if ((ret = c->close(c)) != 0)
- die(ret, "cursor.close");
+ testutil_die(ret, "cursor.close");
} else if (ret != ENOENT && ret != EBUSY && ret != EINVAL)
- die(ret, "session.open_cursor");
+ testutil_die(ret, "session.open_cursor");
}
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -67,32 +66,32 @@ obj_bulk_unique(void)
char new_uri[64];
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
/* Generate a unique object name. */
if ((ret = pthread_rwlock_wrlock(&single)) != 0)
- die(ret, "pthread_rwlock_wrlock single");
+ testutil_die(ret, "pthread_rwlock_wrlock single");
(void)snprintf(new_uri, sizeof(new_uri), "%s.%u", uri, ++uid);
if ((ret = pthread_rwlock_unlock(&single)) != 0)
- die(ret, "pthread_rwlock_unlock single");
+ testutil_die(ret, "pthread_rwlock_unlock single");
if ((ret = session->create(session, new_uri, config)) != 0)
- die(ret, "session.create: %s", new_uri);
+ testutil_die(ret, "session.create: %s", new_uri);
sched_yield();
if ((ret =
session->open_cursor(session, new_uri, NULL, "bulk", &c)) != 0)
- die(ret, "session.open_cursor: %s", new_uri);
+ testutil_die(ret, "session.open_cursor: %s", new_uri);
if ((ret = c->close(c)) != 0)
- die(ret, "cursor.close");
+ testutil_die(ret, "cursor.close");
while ((ret = session->drop(session, new_uri, NULL)) != 0)
if (ret != EBUSY)
- die(ret, "session.drop: %s", new_uri);
+ testutil_die(ret, "session.drop: %s", new_uri);
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -103,18 +102,18 @@ obj_cursor(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
if ((ret =
session->open_cursor(session, uri, NULL, NULL, &cursor)) != 0) {
if (ret != ENOENT && ret != EBUSY)
- die(ret, "session.open_cursor");
+ testutil_die(ret, "session.open_cursor");
} else {
if ((ret = cursor->close(cursor)) != 0)
- die(ret, "cursor.close");
+ testutil_die(ret, "cursor.close");
}
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -124,14 +123,14 @@ obj_create(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
if ((ret = session->create(session, uri, config)) != 0)
if (ret != EEXIST && ret != EBUSY)
- die(ret, "session.create");
+ testutil_die(ret, "session.create");
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -142,25 +141,25 @@ obj_create_unique(void)
char new_uri[64];
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
/* Generate a unique object name. */
if ((ret = pthread_rwlock_wrlock(&single)) != 0)
- die(ret, "pthread_rwlock_wrlock single");
+ testutil_die(ret, "pthread_rwlock_wrlock single");
(void)snprintf(new_uri, sizeof(new_uri), "%s.%d", uri, ++uid);
if ((ret = pthread_rwlock_unlock(&single)) != 0)
- die(ret, "pthread_rwlock_unlock single");
+ testutil_die(ret, "pthread_rwlock_unlock single");
if ((ret = session->create(session, new_uri, config)) != 0)
- die(ret, "session.create");
+ testutil_die(ret, "session.create");
sched_yield();
while ((ret = session->drop(session, new_uri, NULL)) != 0)
if (ret != EBUSY)
- die(ret, "session.drop: %s", new_uri);
+ testutil_die(ret, "session.drop: %s", new_uri);
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -170,14 +169,14 @@ obj_drop(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
if ((ret = session->drop(session, uri, NULL)) != 0)
if (ret != ENOENT && ret != EBUSY)
- die(ret, "session.drop");
+ testutil_die(ret, "session.drop");
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -187,15 +186,15 @@ obj_checkpoint(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
/* Force the checkpoint so it has to be taken. */
if ((ret = session->checkpoint(session, "force")) != 0)
if (ret != ENOENT)
- die(ret, "session.checkpoint");
+ testutil_die(ret, "session.checkpoint");
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -205,14 +204,14 @@ obj_upgrade(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
if ((ret = session->upgrade(session, uri, NULL)) != 0)
if (ret != ENOENT && ret != EBUSY)
- die(ret, "session.upgrade");
+ testutil_die(ret, "session.upgrade");
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
void
@@ -222,12 +221,12 @@ obj_verify(void)
int ret;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "conn.session");
+ testutil_die(ret, "conn.session");
if ((ret = session->verify(session, uri, NULL)) != 0)
if (ret != ENOENT && ret != EBUSY)
- die(ret, "session.verify");
+ testutil_die(ret, "session.verify");
if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_die(ret, "session.close");
}
diff --git a/test/fops/fops.c b/test/fops/fops.c
index afedfaac0f1..170b63f3d36 100644
--- a/test/fops/fops.c
+++ b/test/fops/fops.c
@@ -27,7 +27,6 @@
*/
#include "thread.h"
-#include "test_util.i"
static void *fop(void *);
static void print_stats(u_int);
@@ -85,7 +84,7 @@ fop_start(u_int nthreads)
if ((run_stats = calloc(
(size_t)(nthreads), sizeof(*run_stats))) == NULL ||
(tids = calloc((size_t)(nthreads), sizeof(*tids))) == NULL)
- die(errno, "calloc");
+ testutil_die(errno, "calloc");
(void)gettimeofday(&start, NULL);
@@ -93,7 +92,7 @@ fop_start(u_int nthreads)
for (i = 0; i < nthreads; ++i)
if ((ret = pthread_create(
&tids[i], NULL, fop, (void *)(uintptr_t)i)) != 0)
- die(ret, "pthread_create");
+ testutil_die(ret, "pthread_create");
/* Wait for the threads. */
for (i = 0; i < nthreads; ++i)
diff --git a/test/fops/t.c b/test/fops/t.c
index 15a3a542635..ac2011203bf 100644
--- a/test/fops/t.c
+++ b/test/fops/t.c
@@ -27,7 +27,6 @@
*/
#include "thread.h"
-#include "test_util.i"
WT_CONNECTION *conn; /* WiredTiger connection */
pthread_rwlock_t single; /* Single thread */
@@ -71,16 +70,17 @@ main(int argc, char *argv[])
u_int nthreads;
int ch, cnt, ret, runs;
char *config_open, *working_dir;
+
working_dir = NULL;
- //Remove directories
+ /* Remove directories */
if ((progname = strrchr(argv[0], DIR_DELIM)) == NULL)
progname = argv[0];
else
++progname;
if ((ret = pthread_rwlock_init(&single, NULL)) != 0)
- die(ret, "pthread_rwlock_init: single");
+ testutil_die(ret, "pthread_rwlock_init: single");
config_open = NULL;
nops = 1000;
@@ -121,7 +121,7 @@ main(int argc, char *argv[])
return (usage());
if ((ret = testutil_work_dir_from_path(home, 512, working_dir)) != 0)
- die(ret, "provided directory name is too long");
+ testutil_die(ret, "provided directory name is too long");
/* Clean up on signal. */
(void)signal(SIGINT, onint);
@@ -173,7 +173,7 @@ wt_startup(char *config_open)
config_open == NULL ? "" : config_open);
if ((ret = wiredtiger_open(
home, &event_handler, config_buf, &conn)) != 0)
- die(ret, "wiredtiger_open");
+ testutil_die(ret, "wiredtiger_open");
}
/*
@@ -186,7 +186,7 @@ wt_shutdown(void)
int ret;
if ((ret = conn->close(conn, NULL)) != 0)
- die(ret, "conn.close");
+ testutil_die(ret, "conn.close");
}
/*
@@ -260,7 +260,7 @@ usage(void)
progname);
fprintf(stderr, "%s",
"\t-C specify wiredtiger_open configuration arguments\n"
- "\t-h home (default 'RUNDIR')\n"
+ "\t-h home (default 'WT_TEST')\n"
"\t-l specify a log file\n"
"\t-n set number of operations each thread does\n"
"\t-r set number of runs\n"
diff --git a/test/fops/thread.h b/test/fops/thread.h
index ac3b1af8801..4ae896902ec 100644
--- a/test/fops/thread.h
+++ b/test/fops/thread.h
@@ -44,10 +44,7 @@
#include <unistd.h>
#endif
-#ifdef _WIN32
-#include "windows_shim.h"
-#endif
-
+#include "test_util.i"
#include <wiredtiger.h>
extern WT_CONNECTION *conn; /* WiredTiger connection */