summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-06-26 15:05:14 -0400
committerDwight <dmerriman@gmail.com>2008-06-26 15:05:14 -0400
commit9dbbf6065e0e1305388fc7eb2a9822ccea3ec7e4 (patch)
treea351bfaa2dd33b102c9d525e0d5d122bf2c10308
parent1620d7ebdf78eb171fffbd6f66401b475c8791ad (diff)
downloadmongo-9dbbf6065e0e1305388fc7eb2a9822ccea3ec7e4.tar.gz
test stub
-rw-r--r--db/db.cpp14
-rw-r--r--db/tests.cpp27
2 files changed, 34 insertions, 7 deletions
diff --git a/db/db.cpp b/db/db.cpp
index cc46393671b..6f826c3ee9d 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -861,14 +861,15 @@ int main(int argc, char* argv[], char *envp[] )
exit(0);
}
- cout << "usage:\n";
- cout << " quicktest just check basic assertions and exit" << endl;
- cout << " msg [msg] [port] send a request to the db server listening on port (or default)" << endl;
- cout << " msg end [port] shut down db server listening on port (or default)" << endl;
+ cout << "10gendb usage:\n";
cout << " run run db" << endl;
- cout << " dev run in dev mode (diff db loc, diff port #)" << endl;
- cout << " longmsg send a long test message to the db server" << endl;
+ cout << " msg end [port] shut down db server listening on port (or default)" << endl;
+ cout << " msg [msg] [port] send a request to the db server listening on port (or default)" << endl;
cout << " msglots send a bunch of test messages, and then wait for answer on the last one" << endl;
+ cout << " longmsg send a long test message to the db server" << endl;
+ cout << " quicktest just check basic assertions and exit" << endl;
+ cout << " test2 run test2() - see code" << endl;
+ cout << " dev run in dev mode (diff db loc, diff port #)" << endl;
cout << endl << "Alternate Usage :" << endl;
cout << " --port <portno> --dbpath <root> --appsrvpath <root of appsrv>" << endl << endl;
@@ -887,4 +888,3 @@ void dbexit(int rc) {
flushOpLog();
exit(rc);
}
-
diff --git a/db/tests.cpp b/db/tests.cpp
index 1eebe796b07..3d07fcf1aed 100644
--- a/db/tests.cpp
+++ b/db/tests.cpp
@@ -4,11 +4,38 @@
*/
#include "stdafx.h"
+#include "../util/mmap.h"
int test2() {
+ cout << "test2" << endl;
+ MemoryMappedFile f;
+ char *p = (char *) f.map("/tmp/test.dat", 64*1024*1024);
+ char *start = p;
+ char *end = p + 64*1024*1024-2;
+ end[1] = 'z';
+ int i;
+ while( p < end ) {
+ *p++ = ' ';
+ if( ++i%64 == 0 ) { *p++ = '\n'; *p++ = 'x'; }
+ }
+ *p = 'a';
+ f.flush(true);
+ cout << "done" << endl;
+
+ char *x = start + 32 * 1024 * 1024;
+ char *y = start + 48 * 1024 * 1024;
+ char *z = start + 62 * 1024 * 1024;
+
+ strcpy(z, "zfoo");
+ cout << "y" << endl;
+ strcpy(y, "yfoo");
+ strcpy(x, "xfoo");
+ strcpy(start, "xfoo");
+
+ exit(3);
return 1;
}