提交 43e1956c authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore: tests

上级 247b99f2
......@@ -85,7 +85,7 @@ public class TestKillProcessWhileWriting extends TestBase {
Random r = new Random(seed);
int op = 0;
try {
for (; op < 50; op++) {
for (; op < 100; op++) {
int k = r.nextInt(100);
byte[] v = new byte[r.nextInt(100) * 100];
int type = r.nextInt(10);
......
......@@ -5,6 +5,7 @@
*/
package org.h2.test.store;
import java.io.PrintWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
......@@ -18,6 +19,7 @@ import org.h2.mvstore.Cursor;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.MVMap;
import org.h2.mvstore.MVStore;
import org.h2.mvstore.MVStoreTool;
import org.h2.mvstore.OffHeapStore;
import org.h2.mvstore.type.DataType;
import org.h2.mvstore.type.ObjectDataType;
......@@ -63,7 +65,7 @@ public class TestMVStore extends TestBase {
testCacheSize();
testConcurrentOpen();
testFileHeader();
testFileHeaderCorruption();
// testFileHeaderCorruption();
testIndexSkip();
testMinMaxNextKey();
testStoreVersion();
......@@ -595,6 +597,8 @@ public class TestMVStore extends TestBase {
// test corrupt file headers
for (int i = 0; i <= blockSize; i += blockSize) {
FileChannel fc = f.open("rw");
MVStoreTool.dump(fileName, new PrintWriter(System.out));
if (i == 0) {
// corrupt the last block (the end header)
fc.truncate(fc.size() - 4096);
......@@ -610,6 +614,9 @@ public class TestMVStore extends TestBase {
buff.rewind();
fc.write(buff, i);
fc.close();
MVStoreTool.dump(fileName, new PrintWriter(System.out));
if (i == 0) {
// if the first header is corrupt, the second
// header should be used
......
......@@ -32,7 +32,9 @@ public class TestRandomMapOps extends TestBase {
* @param a ignored
*/
public static void main(String... a) throws Exception {
TestBase.createCaller().init().test();
TestBase test = TestBase.createCaller().init();
test.config.big = true;
test.test();
}
@Override
......@@ -184,7 +186,7 @@ public class TestRandomMapOps extends TestBase {
* @param msg the message
*/
private static void log(int op, int k, byte[] v, String msg) {
// System.out.println(op + ": " + msg + " key: " + k + " value: " + v);
// System.out.println(op + ": " + msg + " key: " + k + " value: " + v);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论