Unverified 提交 aad6a418 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1246 from katzyn/tests

Detect disabled tests
...@@ -8,6 +8,8 @@ package org.h2.test; ...@@ -8,6 +8,8 @@ package org.h2.test;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -430,6 +432,7 @@ java org.h2.test.TestAll timer ...@@ -430,6 +432,7 @@ java org.h2.test.TestAll timer
private Server server; private Server server;
HashMap<Class<? extends TestBase>, Boolean> executedTests = new HashMap<>();
/** /**
* Run all tests. * Run all tests.
...@@ -689,6 +692,12 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -689,6 +692,12 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
cipher = null; cipher = null;
test(); test();
} }
for (Entry<Class<? extends TestBase>, Boolean> entry : executedTests.entrySet()) {
if (!entry.getValue()) {
System.out.println("Warning: test " + entry.getKey().getName() + " was not executed.");
}
}
} }
private void runCoverage() throws SQLException { private void runCoverage() throws SQLException {
......
...@@ -41,7 +41,6 @@ import org.h2.store.fs.FilePath; ...@@ -41,7 +41,6 @@ import org.h2.store.fs.FilePath;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.utils.ProxyCodeGenerator; import org.h2.test.utils.ProxyCodeGenerator;
import org.h2.test.utils.ResultVerifier; import org.h2.test.utils.ResultVerifier;
import org.h2.util.Utils;
/** /**
* The base class for all tests. * The base class for all tests.
...@@ -128,16 +127,16 @@ public abstract class TestBase { ...@@ -128,16 +127,16 @@ public abstract class TestBase {
} }
try { try {
init(conf); init(conf);
if (!isEnabled()) {
if (!conf.executedTests.containsKey(getClass())) {
conf.executedTests.put(getClass(), false);
}
return;
}
conf.executedTests.put(getClass(), true);
start = System.nanoTime(); start = System.nanoTime();
test(); test();
if (!config.mvStore) {
/*
* This code is here to debug memory issues with PageStore testing on Travis.
*/
println("(" + (Utils.getMemoryUsed() >> 10) + " MiB used after)");
} else {
println(""); println("");
}
} catch (Throwable e) { } catch (Throwable e) {
println("FAIL " + e.toString()); println("FAIL " + e.toString());
logError("FAIL ("+conf+") " + e.toString(), e); logError("FAIL ("+conf+") " + e.toString(), e);
...@@ -438,6 +437,13 @@ public abstract class TestBase { ...@@ -438,6 +437,13 @@ public abstract class TestBase {
return s; return s;
} }
/**
* @return whether this test is enabled in the current configuration
*/
public boolean isEnabled() {
return true;
}
/** /**
* This method will be called by the test framework. * This method will be called by the test framework.
* *
......
...@@ -35,10 +35,15 @@ public class TestBackup extends TestDb { ...@@ -35,10 +35,15 @@ public class TestBackup extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
testConcurrentBackup(); testConcurrentBackup();
testBackupRestoreLobStatement(); testBackupRestoreLobStatement();
testBackupRestoreLob(); testBackupRestoreLob();
......
...@@ -31,13 +31,18 @@ public class TestBigDb extends TestDb { ...@@ -31,13 +31,18 @@ public class TestBigDb extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
} }
if (config.networked && config.big) { if (config.networked && config.big) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
testLargeTable(); testLargeTable();
testInsert(); testInsert();
testLeftSummary(); testLeftSummary();
......
...@@ -38,10 +38,15 @@ public class TestBigResult extends TestDb { ...@@ -38,10 +38,15 @@ public class TestBigResult extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
testLargeSubquery(); testLargeSubquery();
testSortingAndDistinct(); testSortingAndDistinct();
testLOB(); testLOB();
......
...@@ -35,6 +35,14 @@ public class TestCluster extends TestDb { ...@@ -35,6 +35,14 @@ public class TestCluster extends TestDb {
TestBase.createCaller().init().test(); TestBase.createCaller().init().test();
} }
@Override
public boolean isEnabled() {
if (config.memory || config.networked || config.cipher != null) {
return false;
}
return true;
}
@Override @Override
public void test() throws Exception { public void test() throws Exception {
testClob(); testClob();
...@@ -47,9 +55,6 @@ public class TestCluster extends TestDb { ...@@ -47,9 +55,6 @@ public class TestCluster extends TestDb {
} }
private void testClob() throws SQLException { private void testClob() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
deleteFiles(); deleteFiles();
org.h2.Driver.load(); org.h2.Driver.load();
...@@ -86,9 +91,6 @@ public class TestCluster extends TestDb { ...@@ -86,9 +91,6 @@ public class TestCluster extends TestDb {
} }
private void testRecover() throws SQLException { private void testRecover() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
deleteFiles(); deleteFiles();
org.h2.Driver.load(); org.h2.Driver.load();
...@@ -149,9 +151,6 @@ public class TestCluster extends TestDb { ...@@ -149,9 +151,6 @@ public class TestCluster extends TestDb {
} }
private void testRollback() throws SQLException { private void testRollback() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
deleteFiles(); deleteFiles();
org.h2.Driver.load(); org.h2.Driver.load();
...@@ -196,9 +195,6 @@ public class TestCluster extends TestDb { ...@@ -196,9 +195,6 @@ public class TestCluster extends TestDb {
} }
private void testCase() throws SQLException { private void testCase() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
deleteFiles(); deleteFiles();
org.h2.Driver.load(); org.h2.Driver.load();
...@@ -252,9 +248,6 @@ public class TestCluster extends TestDb { ...@@ -252,9 +248,6 @@ public class TestCluster extends TestDb {
} }
private void testClientInfo() throws SQLException { private void testClientInfo() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
deleteFiles(); deleteFiles();
org.h2.Driver.load(); org.h2.Driver.load();
...@@ -304,9 +297,6 @@ public class TestCluster extends TestDb { ...@@ -304,9 +297,6 @@ public class TestCluster extends TestDb {
} }
private void testCreateClusterAtRuntime() throws SQLException { private void testCreateClusterAtRuntime() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
deleteFiles(); deleteFiles();
org.h2.Driver.load(); org.h2.Driver.load();
...@@ -396,9 +386,6 @@ public class TestCluster extends TestDb { ...@@ -396,9 +386,6 @@ public class TestCluster extends TestDb {
} }
private void testStartStopCluster() throws SQLException { private void testStartStopCluster() throws SQLException {
if (config.memory || config.networked || config.cipher != null) {
return;
}
int port1 = 9193, port2 = 9194; int port1 = 9193, port2 = 9194;
String serverList = "localhost:" + port1 + ",localhost:" + port2; String serverList = "localhost:" + port1 + ",localhost:" + port2;
deleteFiles(); deleteFiles();
......
...@@ -29,10 +29,15 @@ public class TestEncryptedDb extends TestDb { ...@@ -29,10 +29,15 @@ public class TestEncryptedDb extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory || config.cipher != null) { if (config.memory || config.cipher != null) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
deleteDb("encrypted"); deleteDb("encrypted");
Connection conn = getConnection("encrypted;CIPHER=AES", "sa", "123 123"); Connection conn = getConnection("encrypted;CIPHER=AES", "sa", "123 123");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
......
...@@ -28,11 +28,15 @@ public class TestLargeBlob extends TestDb { ...@@ -28,11 +28,15 @@ public class TestLargeBlob extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.big || config.memory || config.mvStore || config.networked) { if (!config.big || config.memory || config.mvStore || config.networked) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("largeBlob"); deleteDb("largeBlob");
String url = getURL("largeBlob;TRACE_LEVEL_FILE=0", true); String url = getURL("largeBlob;TRACE_LEVEL_FILE=0", true);
Connection conn = getConnection(url); Connection conn = getConnection(url);
......
...@@ -39,10 +39,15 @@ public class TestListener extends TestDb implements DatabaseEventListener { ...@@ -39,10 +39,15 @@ public class TestListener extends TestDb implements DatabaseEventListener {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.networked || config.cipher != null) { if (config.networked || config.cipher != null) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
deleteDb("listener"); deleteDb("listener");
Connection conn; Connection conn;
conn = getConnection("listener"); conn = getConnection("listener");
......
...@@ -34,12 +34,16 @@ public class TestMergeUsing extends TestDb implements Trigger { ...@@ -34,12 +34,16 @@ public class TestMergeUsing extends TestDb implements Trigger {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
// TODO breaks in pagestore case // TODO breaks in pagestore case
if (!config.mvStore) { if (!config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
// Simple ID,NAME inserts, target table with PK initially empty // Simple ID,NAME inserts, target table with PK initially empty
testMergeUsing( testMergeUsing(
"CREATE TABLE PARENT(ID INT, NAME VARCHAR, PRIMARY KEY(ID) );", "CREATE TABLE PARENT(ID INT, NAME VARCHAR, PRIMARY KEY(ID) );",
......
...@@ -60,11 +60,16 @@ public class TestMultiThread extends TestDb implements Runnable { ...@@ -60,11 +60,16 @@ public class TestMultiThread extends TestDb implements Runnable {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
// pagestore and multithreaded was always experimental, we're not going to fix that // pagestore and multithreaded was always experimental, we're not going to fix that
if (!config.mvStore) { if (!config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testConcurrentSchemaChange(); testConcurrentSchemaChange();
testConcurrentLobAdd(); testConcurrentLobAdd();
testConcurrentView(); testConcurrentView();
......
...@@ -43,10 +43,15 @@ public class TestMultiThreadedKernel extends TestDb { ...@@ -43,10 +43,15 @@ public class TestMultiThreadedKernel extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.mvStore) { // FIXME can't see why test should not work in MVStore mode if (config.mvStore) { // FIXME can't see why test should not work in MVStore mode
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("multiThreadedKernel"); deleteDb("multiThreadedKernel");
testConcurrentRead(); testConcurrentRead();
testCache(); testCache();
......
...@@ -40,11 +40,16 @@ public class TestOutOfMemory extends TestDb { ...@@ -40,11 +40,16 @@ public class TestOutOfMemory extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.vmlens) { if (config.vmlens) {
// running out of memory will cause the vmlens agent to stop working // running out of memory will cause the vmlens agent to stop working
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
try { try {
if (!config.travis) { if (!config.travis) {
System.gc(); System.gc();
......
...@@ -39,10 +39,15 @@ public class TestPowerOff extends TestDb { ...@@ -39,10 +39,15 @@ public class TestPowerOff extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
if (config.big || config.googleAppEngine) { if (config.big || config.googleAppEngine) {
dir = getBaseDir(); dir = getBaseDir();
url = DB_NAME; url = DB_NAME;
......
...@@ -37,10 +37,15 @@ public class TestReadOnly extends TestDb { ...@@ -37,10 +37,15 @@ public class TestReadOnly extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testReadOnlyInZip(); testReadOnlyInZip();
testReadOnlyTempTableResult(); testReadOnlyTempTableResult();
testReadOnlyConnect(); testReadOnlyConnect();
......
...@@ -33,10 +33,15 @@ public class TestSQLInjection extends TestDb { ...@@ -33,10 +33,15 @@ public class TestSQLInjection extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.reopen) { if (config.reopen) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
deleteDb("sqlInjection"); deleteDb("sqlInjection");
reconnect("sqlInjection"); reconnect("sqlInjection");
stat.execute("DROP TABLE IF EXISTS USERS"); stat.execute("DROP TABLE IF EXISTS USERS");
......
...@@ -27,10 +27,15 @@ public class TestSessionsLocks extends TestDb { ...@@ -27,10 +27,15 @@ public class TestSessionsLocks extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.multiThreaded) { if (!config.multiThreaded) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testCancelStatement(); testCancelStatement();
if (!config.mvStore) { if (!config.mvStore) {
testLocks(); testLocks();
......
...@@ -28,10 +28,15 @@ public class TestSpaceReuse extends TestDb { ...@@ -28,10 +28,15 @@ public class TestSpaceReuse extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
deleteDb("spaceReuse"); deleteDb("spaceReuse");
long max = 0, now = 0, min = Long.MAX_VALUE; long max = 0, now = 0, min = Long.MAX_VALUE;
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
......
...@@ -53,16 +53,22 @@ public class TestSpatial extends TestDb { ...@@ -53,16 +53,22 @@ public class TestSpatial extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory && config.mvStore) { if (config.memory && config.mvStore) {
return; return false;
}
if (DataType.GEOMETRY_CLASS == null) {
return false;
}
return true;
} }
if (DataType.GEOMETRY_CLASS != null) {
@Override
public void test() throws SQLException {
deleteDb("spatial"); deleteDb("spatial");
testSpatial(); testSpatial();
deleteDb("spatial"); deleteDb("spatial");
} }
}
private void testSpatial() throws SQLException { private void testSpatial() throws SQLException {
testBug1(); testBug1();
......
...@@ -28,11 +28,15 @@ public class TestTwoPhaseCommit extends TestDb { ...@@ -28,11 +28,15 @@ public class TestTwoPhaseCommit extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.memory || config.networked) { if (config.memory || config.networked) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
deleteDb("twoPhaseCommit"); deleteDb("twoPhaseCommit");
prepare(); prepare();
......
...@@ -35,13 +35,18 @@ public class TestUpgrade extends TestDb { ...@@ -35,13 +35,18 @@ public class TestUpgrade extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.mvStore) { if (config.mvStore) {
return; return false;
} }
if (!Utils.isClassPresent("org.h2.upgrade.v1_1.Driver")) { if (!Utils.isClassPresent("org.h2.upgrade.v1_1.Driver")) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testLobs(); testLobs();
testErrorUpgrading(); testErrorUpgrading();
testNoDb(); testNoDb();
......
...@@ -28,12 +28,17 @@ public class TestTransactionIsolation extends TestDb { ...@@ -28,12 +28,17 @@ public class TestTransactionIsolation extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.mvStore) { if (config.mvStore) {
// no tests yet // no tests yet
} else { return false;
testTableLevelLocking();
} }
return true;
}
@Override
public void test() throws SQLException {
testTableLevelLocking();
} }
private void testTableLevelLocking() throws SQLException { private void testTableLevelLocking() throws SQLException {
......
...@@ -34,6 +34,14 @@ public class TestMvcc1 extends TestDb { ...@@ -34,6 +34,14 @@ public class TestMvcc1 extends TestDb {
test.test(); test.test();
} }
@Override
public boolean isEnabled() {
if (!config.mvStore) {
return false;
}
return true;
}
@Override @Override
public void test() throws SQLException { public void test() throws SQLException {
testCases(); testCases();
...@@ -41,9 +49,6 @@ public class TestMvcc1 extends TestDb { ...@@ -41,9 +49,6 @@ public class TestMvcc1 extends TestDb {
} }
private void testCases() throws SQLException { private void testCases() throws SQLException {
if (!config.mvStore) {
return;
}
ResultSet rs; ResultSet rs;
// TODO Prio 1: document: exclusive table lock still used when altering // TODO Prio 1: document: exclusive table lock still used when altering
......
...@@ -39,10 +39,15 @@ public class TestMvcc2 extends TestDb { ...@@ -39,10 +39,15 @@ public class TestMvcc2 extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.mvStore) { if (!config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("mvcc2"); deleteDb("mvcc2");
testConcurrentInsert(); testConcurrentInsert();
testConcurrentUpdate(); testConcurrentUpdate();
......
...@@ -33,10 +33,15 @@ public class TestMvcc4 extends TestDb { ...@@ -33,10 +33,15 @@ public class TestMvcc4 extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.networked || !config.mvStore) { if (config.networked || !config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
testSelectForUpdateAndUpdateConcurrency(); testSelectForUpdateAndUpdateConcurrency();
} }
......
...@@ -30,10 +30,15 @@ public class TestMvccMultiThreaded extends TestDb { ...@@ -30,10 +30,15 @@ public class TestMvccMultiThreaded extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.mvStore) { if (!config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testConcurrentSelectForUpdate(); testConcurrentSelectForUpdate();
testMergeWithUniqueKeyViolation(); testMergeWithUniqueKeyViolation();
testConcurrentMerge(); testConcurrentMerge();
......
...@@ -46,10 +46,15 @@ public class TestMvccMultiThreaded2 extends TestDb { ...@@ -46,10 +46,15 @@ public class TestMvccMultiThreaded2 extends TestDb {
} }
@Override @Override
public void test() throws SQLException, InterruptedException { public boolean isEnabled() {
if (!config.mvStore) { if (!config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException, InterruptedException {
testSelectForUpdateConcurrency(); testSelectForUpdateConcurrency();
} }
......
...@@ -28,10 +28,15 @@ public class RecoverLobTest extends TestDb { ...@@ -28,10 +28,15 @@ public class RecoverLobTest extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.mvStore || config.memory) { if (config.mvStore || config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testRecoverClob(); testRecoverClob();
} }
......
...@@ -85,10 +85,15 @@ public class TestScript extends TestDb { ...@@ -85,10 +85,15 @@ public class TestScript extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.networked && config.big) { if (config.networked && config.big) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
reconnectOften = !config.memory && config.big; reconnectOften = !config.memory && config.big;
testScript("testScript.sql"); testScript("testScript.sql");
......
...@@ -33,10 +33,15 @@ public class TestScriptSimple extends TestDb { ...@@ -33,10 +33,15 @@ public class TestScriptSimple extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.memory || config.big || config.networked) { if (config.memory || config.big || config.networked) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("scriptSimple"); deleteDb("scriptSimple");
reconnect(); reconnect();
String inFile = "org/h2/test/scripts/testSimple.in.txt"; String inFile = "org/h2/test/scripts/testSimple.in.txt";
......
...@@ -34,17 +34,21 @@ public class TestMVStoreBenchmark extends TestBase { ...@@ -34,17 +34,21 @@ public class TestMVStoreBenchmark extends TestBase {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.big) { if (!config.big) {
return; return false;
} }
if (config.codeCoverage) { if (config.codeCoverage) {
// run only when _not_ using a code coverage tool, // run only when _not_ using a code coverage tool,
// because the tool might instrument our code but not // because the tool might instrument our code but not
// java.util.* // java.util.*
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testPerformanceComparison(); testPerformanceComparison();
testMemoryUsageComparison(); testMemoryUsageComparison();
} }
......
...@@ -29,10 +29,15 @@ public class TestMVStoreStopCompact extends TestBase { ...@@ -29,10 +29,15 @@ public class TestMVStoreStopCompact extends TestBase {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.big) { if (!config.big) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
for(int retentionTime = 10; retentionTime < 1000; retentionTime *= 10) { for(int retentionTime = 10; retentionTime < 1000; retentionTime *= 10) {
for(int timeout = 100; timeout <= 1000; timeout *= 10) { for(int timeout = 100; timeout <= 1000; timeout *= 10) {
testStopCompact(retentionTime, timeout); testStopCompact(retentionTime, timeout);
......
...@@ -33,15 +33,20 @@ public class TestMVStoreTool extends TestBase { ...@@ -33,15 +33,20 @@ public class TestMVStoreTool extends TestBase {
test.test(); test.test();
} }
@Override
public boolean isEnabled() {
if (config.memory) {
return false;
}
return true;
}
@Override @Override
public void test() throws Exception { public void test() throws Exception {
testCompact(); testCompact();
} }
private void testCompact() { private void testCompact() {
if (config.memory) {
return;
}
String fileName = getBaseDir() + "/testCompact.h3"; String fileName = getBaseDir() + "/testCompact.h3";
String fileNameNew = fileName + ".new"; String fileNameNew = fileName + ".new";
String fileNameCompressed = fileNameNew + ".compress"; String fileNameCompressed = fileNameNew + ".compress";
......
...@@ -50,10 +50,15 @@ public class TestMVTableEngine extends TestDb { ...@@ -50,10 +50,15 @@ public class TestMVTableEngine extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.mvStore) { if (!config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testLobCopy(); testLobCopy();
testLobReuse(); testLobReuse();
testShutdownDuringLobCreation(); testShutdownDuringLobCreation();
......
...@@ -148,6 +148,14 @@ public class TestCrashAPI extends TestDb implements Runnable { ...@@ -148,6 +148,14 @@ public class TestCrashAPI extends TestDb implements Runnable {
} }
} }
@Override
public boolean isEnabled() {
if (config.networked) {
return false;
}
return true;
}
@Override @Override
public void test() throws Exception { public void test() throws Exception {
if (RECOVER_ALL) { if (RECOVER_ALL) {
......
...@@ -26,13 +26,18 @@ import org.h2.test.utils.SelfDestructor; ...@@ -26,13 +26,18 @@ import org.h2.test.utils.SelfDestructor;
public class TestKillRestart extends TestDb { public class TestKillRestart extends TestDb {
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.networked) { if (config.networked) {
return; return false;
} }
if (getBaseDir().indexOf(':') > 0) { if (getBaseDir().indexOf(':') > 0) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("killRestart"); deleteDb("killRestart");
String url = getURL("killRestart", true); String url = getURL("killRestart", true);
// String url = getURL( // String url = getURL(
......
...@@ -68,13 +68,18 @@ public class TestKillRestartMulti extends TestDb { ...@@ -68,13 +68,18 @@ public class TestKillRestartMulti extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.networked) { if (config.networked) {
return; return false;
} }
if (getBaseDir().indexOf(':') > 0) { if (getBaseDir().indexOf(':') > 0) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("killRestartMulti"); deleteDb("killRestartMulti");
url = getURL("killRestartMulti", true); url = getURL("killRestartMulti", true);
user = getUser(); user = getUser();
......
...@@ -123,10 +123,15 @@ public class TestMultiThreaded extends TestDb { ...@@ -123,10 +123,15 @@ public class TestMultiThreaded extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.mvStore) { if (config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("multiThreaded"); deleteDb("multiThreaded");
int size = getSize(2, 4); int size = getSize(2, 4);
Connection[] connList = new Connection[size]; Connection[] connList = new Connection[size];
......
...@@ -31,10 +31,15 @@ public class TestRandomSQL extends TestDb { ...@@ -31,10 +31,15 @@ public class TestRandomSQL extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.networked) { if (config.networked) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
int len = getSize(2, 6); int len = getSize(2, 6);
for (int a = 0; a < len; a++) { for (int a = 0; a < len; a++) {
int s = MathUtils.randomInt(Integer.MAX_VALUE); int s = MathUtils.randomInt(Integer.MAX_VALUE);
......
...@@ -27,13 +27,18 @@ public class TestExit extends TestDb { ...@@ -27,13 +27,18 @@ public class TestExit extends TestDb {
OPEN_WITHOUT_CLOSE_ON_EXIT = 2; OPEN_WITHOUT_CLOSE_ON_EXIT = 2;
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.codeCoverage || config.networked) { if (config.codeCoverage || config.networked) {
return; return false;
} }
if (getBaseDir().indexOf(':') > 0) { if (getBaseDir().indexOf(':') > 0) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("exit"); deleteDb("exit");
String url = getURL(OPEN_WITH_CLOSE_ON_EXIT); String url = getURL(OPEN_WITH_CLOSE_ON_EXIT);
String selfDestruct = SelfDestructor.getPropertyString(60); String selfDestruct = SelfDestructor.getPropertyString(60);
......
...@@ -50,10 +50,15 @@ public class TestFileLock extends TestDb implements Runnable { ...@@ -50,10 +50,15 @@ public class TestFileLock extends TestDb implements Runnable {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!getFile().startsWith(TestBase.BASE_TEST_DIR)) { if (!getFile().startsWith(TestBase.BASE_TEST_DIR)) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
testFsFileLock(); testFsFileLock();
testFutureModificationDate(); testFutureModificationDate();
testSimple(); testSimple();
......
...@@ -48,13 +48,18 @@ public class TestFileLockProcess extends TestDb { ...@@ -48,13 +48,18 @@ public class TestFileLockProcess extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.codeCoverage || config.networked) { if (config.codeCoverage || config.networked) {
return; return false;
} }
if (getBaseDir().indexOf(':') > 0) { if (getBaseDir().indexOf(':') > 0) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("lock"); deleteDb("lock");
String url = "jdbc:h2:"+getBaseDir()+"/lock"; String url = "jdbc:h2:"+getBaseDir()+"/lock";
......
...@@ -38,10 +38,15 @@ public class TestFileLockSerialized extends TestDb { ...@@ -38,10 +38,15 @@ public class TestFileLockSerialized extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.mvStore) { if (config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
println("testSequence"); println("testSequence");
testSequence(); testSequence();
println("testAutoIncrement"); println("testAutoIncrement");
......
...@@ -30,10 +30,15 @@ public class TestFtp extends TestBase implements FtpEventListener { ...@@ -30,10 +30,15 @@ public class TestFtp extends TestBase implements FtpEventListener {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (getBaseDir().indexOf(':') > 0) { if (getBaseDir().indexOf(':') > 0) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
FileUtils.delete(getBaseDir() + "/ftp"); FileUtils.delete(getBaseDir() + "/ftp");
test(getBaseDir()); test(getBaseDir());
FileUtils.delete(getBaseDir() + "/ftp"); FileUtils.delete(getBaseDir() + "/ftp");
......
...@@ -32,10 +32,15 @@ public class TestModifyOnWrite extends TestDb { ...@@ -32,10 +32,15 @@ public class TestModifyOnWrite extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!SysProperties.MODIFY_ON_WRITE) { if (!SysProperties.MODIFY_ON_WRITE) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("modifyOnWrite"); deleteDb("modifyOnWrite");
String dbFile = getBaseDir() + "/modifyOnWrite.h2.db"; String dbFile = getBaseDir() + "/modifyOnWrite.h2.db";
assertFalse(FileUtils.exists(dbFile)); assertFalse(FileUtils.exists(dbFile));
......
...@@ -33,10 +33,15 @@ public class TestMultiThreadedKernel extends TestDb implements Runnable { ...@@ -33,10 +33,15 @@ public class TestMultiThreadedKernel extends TestDb implements Runnable {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.networked || config.mvStore) { if (config.networked || config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb("multiThreadedKernel"); deleteDb("multiThreadedKernel");
int count = getSize(2, 5); int count = getSize(2, 5);
Thread[] list = new Thread[count]; Thread[] list = new Thread[count];
......
...@@ -40,10 +40,15 @@ public class TestOldVersion extends TestDb { ...@@ -40,10 +40,15 @@ public class TestOldVersion extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.mvStore) { if (config.mvStore) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
cl = getClassLoader("file:ext/h2-1.2.127.jar"); cl = getClassLoader("file:ext/h2-1.2.127.jar");
driver = getDriver(cl); driver = getDriver(cl);
if (driver == null) { if (driver == null) {
......
...@@ -50,10 +50,15 @@ public class TestPageStore extends TestDb { ...@@ -50,10 +50,15 @@ public class TestPageStore extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb(null); deleteDb(null);
testDropTempTable(); testDropTempTable();
testLogLimitFalsePositive(); testLogLimitFalsePositive();
......
...@@ -36,11 +36,16 @@ public class TestPageStoreCoverage extends TestDb { ...@@ -36,11 +36,16 @@ public class TestPageStoreCoverage extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
// TODO mvcc, 2-phase commit
if (config.memory) { if (config.memory) {
return; return false;
} }
return true;
}
@Override
public void test() throws Exception {
// TODO mvcc, 2-phase commit
deleteDb("pageStoreCoverage"); deleteDb("pageStoreCoverage");
testMoveRoot(); testMoveRoot();
testBasic(); testBasic();
......
...@@ -47,10 +47,15 @@ public class TestPgServer extends TestDb { ...@@ -47,10 +47,15 @@ public class TestPgServer extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!config.memory) { if (!config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
// testPgAdapter() starts server by itself without a wait so run it first // testPgAdapter() starts server by itself without a wait so run it first
testPgAdapter(); testPgAdapter();
testLowerCaseIdentifiers(); testLowerCaseIdentifiers();
......
...@@ -37,10 +37,15 @@ public class TestRecovery extends TestDb { ...@@ -37,10 +37,15 @@ public class TestRecovery extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.memory) { if (config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
if (!config.mvStore) { if (!config.mvStore) {
testRecoverTestMode(); testRecoverTestMode();
} }
......
...@@ -35,10 +35,15 @@ public class TestSampleApps extends TestDb { ...@@ -35,10 +35,15 @@ public class TestSampleApps extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (!getBaseDir().startsWith(TestBase.BASE_TEST_DIR)) { if (!getBaseDir().startsWith(TestBase.BASE_TEST_DIR)) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
deleteDb(getTestName()); deleteDb(getTestName());
InputStream in = getClass().getClassLoader().getResourceAsStream( InputStream in = getClass().getClassLoader().getResourceAsStream(
"org/h2/samples/optimizations.sql"); "org/h2/samples/optimizations.sql");
......
...@@ -345,10 +345,15 @@ public class TestServlet extends TestDb { ...@@ -345,10 +345,15 @@ public class TestServlet extends TestDb {
} }
@Override @Override
public void test() throws SQLException { public boolean isEnabled() {
if (config.networked || config.memory) { if (config.networked || config.memory) {
return; return false;
}
return true;
} }
@Override
public void test() throws SQLException {
DbStarter listener = new DbStarter(); DbStarter listener = new DbStarter();
TestServletContext context = new TestServletContext(); TestServletContext context = new TestServletContext();
......
...@@ -82,10 +82,15 @@ public class TestTools extends TestDb { ...@@ -82,10 +82,15 @@ public class TestTools extends TestDb {
} }
@Override @Override
public void test() throws Exception { public boolean isEnabled() {
if (config.networked) { if (config.networked) {
return; return false;
}
return true;
} }
@Override
public void test() throws Exception {
DeleteDbFiles.execute(getBaseDir(), null, true); DeleteDbFiles.execute(getBaseDir(), null, true);
org.h2.Driver.load(); org.h2.Driver.load();
testSimpleResultSet(); testSimpleResultSet();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论