Unverified 提交 5bc2dcbb authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1172 from h2database/reduce-test-time

Yet another attempt to tighten that testing loop
......@@ -402,7 +402,7 @@ java org.h2.test.TestAll timer
/**
* The THROTTLE value to use.
*/
int throttle;
public int throttle;
/**
* The THROTTLE value to use by default.
......
......@@ -327,6 +327,9 @@ public class TestTempTables extends TestBase {
* transaction table in the MVStore
*/
private void testLotsOfTables() throws SQLException {
if (config.networked || config.throttle > 0) {
return; // just to save some testing time
}
deleteDb("tempTables");
Connection conn = getConnection("tempTables");
Statement stat = conn.createStatement();
......
......@@ -11,7 +11,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.DbException;
import org.h2.test.TestBase;
import org.h2.util.IOUtils;
......@@ -41,6 +40,11 @@ public class TestMvccMultiThreaded2 extends TestBase {
test.test();
}
private int getTestDuration() {
// to save some testing time
return config.big ? TEST_TIME_SECONDS : TEST_TIME_SECONDS / 10;
}
@Override
public void test() throws SQLException, InterruptedException {
if (!config.mvcc) {
......@@ -106,7 +110,7 @@ public class TestMvccMultiThreaded2 extends TestBase {
"+ INFO: TestMvccMultiThreaded2 RUN STATS threads=%d, minProcessed=%d, maxProcessed=%d, "
+ "totalProcessed=%d, averagePerThread=%d, averagePerThreadPerSecond=%d\n",
TEST_THREAD_COUNT, minProcessed, maxProcessed, totalProcessed, totalProcessed / TEST_THREAD_COUNT,
totalProcessed / (TEST_THREAD_COUNT * TEST_TIME_SECONDS)));
totalProcessed / (TEST_THREAD_COUNT * getTestDuration())));
}
IOUtils.closeSilently(conn);
......@@ -142,7 +146,6 @@ public class TestMvccMultiThreaded2 extends TestBase {
PreparedStatement ps = conn.prepareStatement(
"SELECT * FROM test WHERE entity_id = ? FOR UPDATE");
while (!done) {
try {
String id;
int value;
if ((iterationsProcessed & 1) == 0) {
......@@ -162,12 +165,9 @@ public class TestMvccMultiThreaded2 extends TestBase {
iterationsProcessed++;
long now = System.currentTimeMillis();
if (now - start > 1000 * TEST_TIME_SECONDS) {
if (now - start > 1000 * getTestDuration()) {
done = true;
}
} catch (JdbcSQLException e1) {
throw e1;
}
}
} catch (SQLException e) {
TestBase.logError("SQL error from thread "+getName(), e);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论