mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Minor Tester1.java cleanups.
FossilOrigin-Name: 70d936953ba55cfed32efe7e3a9d4b71da9a7ffc8818b6540471e0bf311bc688
This commit is contained in:
@ -24,13 +24,19 @@ import java.util.concurrent.Future;
|
||||
public class Tester1 implements Runnable {
|
||||
//! True when running in multi-threaded mode.
|
||||
private static boolean mtMode = false;
|
||||
//! True to sleep briefly between tests.
|
||||
private static boolean takeNaps = false;
|
||||
//! True to shuffle the order of the tests.
|
||||
private static boolean shuffle = false;
|
||||
//! True to dump the list of to-run tests to stdout.
|
||||
private static boolean listRunTests = false;
|
||||
//! List of test*() methods to run.
|
||||
private static List<java.lang.reflect.Method> testMethods = null;
|
||||
//! List of exceptions collected by run()
|
||||
private static List<Exception> listErrors = new ArrayList<>();
|
||||
private static final class Metrics {
|
||||
int dbOpen;
|
||||
//! Number of times createNewDb() (or equivalent) is invoked.
|
||||
volatile int dbOpen = 0;
|
||||
}
|
||||
|
||||
private Integer tId;
|
||||
@ -1173,7 +1179,7 @@ public class Tester1 implements Runnable {
|
||||
|
||||
private void nap() throws InterruptedException {
|
||||
if( takeNaps ){
|
||||
Thread.sleep(java.util.concurrent.ThreadLocalRandom.current().nextInt(3, 28), 0);
|
||||
Thread.sleep(java.util.concurrent.ThreadLocalRandom.current().nextInt(3, 17), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1256,7 +1262,10 @@ public class Tester1 implements Runnable {
|
||||
some chaos for cross-thread contention.
|
||||
|
||||
-list-tests: outputs the list of tests being run, minus some
|
||||
which are hard-coded,
|
||||
which are hard-coded. This is noisy in multi-threaded mode.
|
||||
|
||||
-fail: forces an exception to be thrown during the test run. Use
|
||||
with -shuffle to make its appearance unpredictable.
|
||||
|
||||
-v: emit some developer-mode info at the end.
|
||||
*/
|
||||
@ -1278,9 +1287,6 @@ public class Tester1 implements Runnable {
|
||||
nRepeat = Integer.parseInt(args[i++]);
|
||||
}else if(arg.equals("shuffle")){
|
||||
shuffle = true;
|
||||
outln("WARNING: -shuffle mode is known to run ",
|
||||
"the same number of tests but provide far ",
|
||||
"lower, unpredictable metrics for unknown reasons.");
|
||||
}else if(arg.equals("list-tests")){
|
||||
listRunTests = true;
|
||||
}else if(arg.equals("fail")){
|
||||
@ -1319,6 +1325,7 @@ public class Tester1 implements Runnable {
|
||||
sqlite3_libversion_number(),"\n",
|
||||
sqlite3_libversion(),"\n",SQLITE_SOURCE_ID);
|
||||
outln("Running ",nRepeat," loop(s) over ",nThread," thread(s).");
|
||||
if( takeNaps ) outln("Napping between tests is enabled.");
|
||||
for( int n = 0; n < nRepeat; ++n ){
|
||||
if( nThread==null || nThread<=1 ){
|
||||
new Tester1(0).runTests(false);
|
||||
|
@ -78,9 +78,7 @@ public class TesterFts5 {
|
||||
test1();
|
||||
final int affirmCount = Tester1.affirmCount - oldAffirmCount;
|
||||
final long timeEnd = System.currentTimeMillis();
|
||||
outln("FTS5 Tests done. Metrics:");
|
||||
outln("\tAssertions checked: ",affirmCount);
|
||||
outln("\tTotal time = "
|
||||
+(timeEnd - timeStart)+"ms");
|
||||
outln("FTS5 Tests done. Assertions checked = ",affirmCount,
|
||||
", Total time = ",(timeEnd - timeStart),"ms");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user