From: stephan Date: Sun, 27 Aug 2023 14:47:45 +0000 (+0000) Subject: Generic cleanups in Tester1.java. X-Git-Tag: version-3.44.0~264 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0639c5883606632cc47c685518306a43726d8e2e;p=thirdparty%2Fsqlite.git Generic cleanups in Tester1.java. FossilOrigin-Name: fbc1b6310b01f4f79439bb6ce59b2aaabd126da7201f36d4fc5d7ef95118a494 --- diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index a8e1712331..496a90a428 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -30,6 +30,13 @@ import java.util.concurrent.Future; @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) @interface ManualTest{} +/** + Annotation for Tester1 tests which mark those which must be skipped + in multi-threaded mode. +*/ +@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) +@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) +@interface SingleThreadOnly{} public class Tester1 implements Runnable { //! True when running in multi-threaded mode. @@ -692,7 +699,9 @@ public class Tester1 implements Runnable { sqlite3_close_v2(db); } + @SingleThreadOnly private void testUdfJavaObject(){ + affirm( !mtMode ); final sqlite3 db = createNewDb(); final ValueHolder testResult = new ValueHolder<>(db); final ValueHolder boundObj = new ValueHolder<>(42); @@ -1096,7 +1105,7 @@ public class Tester1 implements Runnable { This test is functionally identical to testUpdateHook(), only with a different callback type. */ - private synchronized void testPreUpdateHook(){ + private void testPreUpdateHook(){ if( !sqlite3_compileoption_used("ENABLE_PREUPDATE_HOOK") ){ //outln("Skipping testPreUpdateHook(): no pre-update hook support."); return; @@ -1206,8 +1215,8 @@ public class Tester1 implements Runnable { it throws. */ @SuppressWarnings("unchecked") - @ManualTest /* because the Fts5 parts are not yet known to be - thread-safe */ + @SingleThreadOnly /* because the Fts5 parts are not yet known to be + thread-safe */ private void testFts5() throws Exception { if( !sqlite3_compileoption_used("ENABLE_FTS5") ){ //outln("SQLITE_ENABLE_FTS5 is not set. Skipping FTS5 tests."); @@ -1258,8 +1267,8 @@ public class Tester1 implements Runnable { sqlite3_close(db); } - @ManualTest/* because multiple threads legitimately make these - results unpredictable */ + @SingleThreadOnly /* because multiple threads legitimately make these + results unpredictable */ private synchronized void testAutoExtension(){ final ValueHolder val = new ValueHolder<>(0); final ValueHolder toss = new ValueHolder<>(null); @@ -1406,10 +1415,6 @@ public class Tester1 implements Runnable { } if( !fromThread ){ testBusy(); - if( !mtMode ){ - testAutoExtension() /* threads rightfully muck up these results */; - testFts5(); - } } synchronized( this.getClass() ){ ++nTestRuns; @@ -1501,7 +1506,9 @@ public class Tester1 implements Runnable { testMethods.add(m); } }else if( !m.isAnnotationPresent( ManualTest.class ) ){ - if( name.startsWith("test") ){ + if( nThread>1 && m.isAnnotationPresent( SingleThreadOnly.class ) ){ + outln("Skipping test in multi-thread mode: ",name,"()"); + }else if( name.startsWith("test") ){ testMethods.add(m); } } @@ -1563,6 +1570,8 @@ public class Tester1 implements Runnable { outln("Running ",nRepeat," loop(s) with ",nThread," thread(s) each."); if( takeNaps ) outln("Napping between tests is enabled."); for( int n = 0; n < nRepeat; ++n ){ + ++nLoop; + out((1==nLoop ? "" : " ")+nLoop); if( nThread<=1 ){ new Tester1(0).runTests(false); continue; @@ -1570,8 +1579,6 @@ public class Tester1 implements Runnable { Tester1.mtMode = true; final ExecutorService ex = Executors.newFixedThreadPool( nThread ); //final List> futures = new ArrayList<>(); - ++nLoop; - out((1==nLoop ? "" : " ")+nLoop); for( int i = 0; i < nThread; ++i ){ ex.submit( new Tester1(i), i ); } diff --git a/manifest b/manifest index 663f1823ab..e193cadd55 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sJNI\ssqlite3_column_java_object(),\sas\sthe\sprotection\srules\sof\ssqlite3_values\smakes\sit\simpossible\sto\simplement\ssafely.\sAdd\sJNI\ssqlite3_bind_java_object(). -D 2023-08-27T13:43:45.514 +C Generic\scleanups\sin\sTester1.java. +D 2023-08-27T14:47:45.944 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -264,7 +264,7 @@ F ext/jni/src/org/sqlite/jni/SQLFunction.java d060f302b2cc4cf7a4f5a6b2d36458a2e6 F ext/jni/src/org/sqlite/jni/SQLite3CallbackProxy.java 13c4ea6f35871261eba63fa4117715515e0beecbdebfb879ec5b1f340ed36904 F ext/jni/src/org/sqlite/jni/SQLite3Jni.java b22b02b51eab5bab2e9068757c94c0978a7c2ccaf4c2ffa93b3b958c2f9e7dc9 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 21301a947e49f0dd9c682dfe2cc8a6518226c837253dd791cd512f847eeca52c -F ext/jni/src/org/sqlite/jni/Tester1.java ff13dc4babfa7a3f8bf91862c12a7f837db611bb66fcd82f7f8728c3e297a188 +F ext/jni/src/org/sqlite/jni/Tester1.java 8653c7b0b50116cf9bd8bf19b83b3e76896b75df09f5debe57a70c556d90203b F ext/jni/src/org/sqlite/jni/TesterFts5.java 6f135c60e24c89e8eecb9fe61dde0f3bb2906de668ca6c9186bcf34bdaf94629 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java 25a45e800b0c57f506c237d111bcfd09da584e936fee395d4bd802100ebeff8c F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java f5eadfa44462c050658230884b41477274f34306accd85c8201a7afbc00d2429 @@ -2103,8 +2103,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 77f6e70f17c0cb6d031f983c458c9ec2e88d92b4716397533a029af39da2d128 -R 6ff41c97b17d551a7d85c6dd457042a1 +P 29bd4a23a4afd96b2cc06d2b91a4f30c0bbf2347af0b0d18f8d4cf8aafa63160 +R 63350485eb725e6c23f0f10ae456a835 U stephan -Z 98f8ce6b232c9712186c8841f85ec5e1 +Z f3b6506c5c2f32d6bb27133665c4317a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 04a026cc7d..049a1a5d4e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -29bd4a23a4afd96b2cc06d2b91a4f30c0bbf2347af0b0d18f8d4cf8aafa63160 \ No newline at end of file +fbc1b6310b01f4f79439bb6ce59b2aaabd126da7201f36d4fc5d7ef95118a494 \ No newline at end of file