]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Re-enable SQLITE_THREADSAFE=0 in the JNI build and add multitest target which builds...
authorstephan <stephan@noemail.net>
Fri, 25 Aug 2023 12:29:59 +0000 (12:29 +0000)
committerstephan <stephan@noemail.net>
Fri, 25 Aug 2023 12:29:59 +0000 (12:29 +0000)
FossilOrigin-Name: 6b1c816f6aae9face07ed7ead969257cf915c21ff9cdad9a21b7cf0e7496e09e

ext/jni/GNUmakefile
ext/jni/src/c/sqlite3-jni.c
ext/jni/src/org/sqlite/jni/SQLite3Jni.java
ext/jni/src/org/sqlite/jni/Tester1.java
manifest
manifest.uuid

index 366c6329e950f2b8a50865484c54d19ba7db3b5f..a7d23193255de55cf6434aad592943db8ee37f1d 100644 (file)
@@ -161,6 +161,7 @@ $(sqlite3.h):
        $(MAKE) -C $(dir.top) sqlite3.c
 $(sqlite3.c): $(sqlite3.h)
 
+opt.threadsafe ?= 1
 SQLITE_OPT = \
   -DSQLITE_ENABLE_RTREE \
   -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
@@ -174,7 +175,7 @@ SQLITE_OPT = \
   -DSQLITE_OMIT_LOAD_EXTENSION \
   -DSQLITE_OMIT_DEPRECATED \
   -DSQLITE_OMIT_SHARED_CACHE \
-  -DSQLITE_THREADSAFE=1 \
+  -DSQLITE_THREADSAFE=$(opt.threadsafe) \
   -DSQLITE_TEMP_STORE=2 \
   -DSQLITE_USE_URI=1 \
   -DSQLITE_C=$(sqlite3.c) \
@@ -280,6 +281,17 @@ endif
 tester-ext: tester-local
 tester: tester-ext
 tests: test tester
+
+########################################################################
+# Build each SQLITE_THREADMODE variant and run all tests against them.
+multitest: clean
+       $(MAKE) opt.threadsafe=0 tests clean
+       $(MAKE) opt.threadsafe=1 tests clean
+       $(MAKE) opt.threadsafe=2 tests clean
+
+
+########################################################################
+# jar bundle...
 package.jar.in := $(abspath $(dir.src)/jar.in)
 CLEAN_FILES += $(package.jar.in)
 $(package.jar.in): $(MAKEFILE) $(CLASS_FILES.main)
@@ -293,6 +305,8 @@ $(package.jar): $(CLASS_FILES) $(MAKEFILE) $(package.jar.in)
 
 jar: $(package.jar)
 
+########################################################################
+# javadoc...
 dir.doc   := $(dir.jni)/javadoc
 doc.index := $(dir.doc)/index.html
 $(doc.index): $(JAVA_FILES.main) $(MAKEFILE)
index 4c9f5e6e5bac493636e232fe39a1cb5b06c7e2ba..45e02f79eb501631089107d7c13c32b694e2684a 100644 (file)
 ** 2023-08-25: initial attempts at running with SQLITE_THREADSAFE=0
 ** lead to as-yet-uninvestigated bad reference errors from JNI.
 */
-#if SQLITE_THREADSAFE==0
+#if 0 && SQLITE_THREADSAFE==0
 # error "This code currently requires SQLITE_THREADSAFE!=0."
 #endif
 
@@ -2383,7 +2383,7 @@ S3JniApi(sqlite3_compileoption_used(),jboolean,1compileoption_1used)(
   return rc;
 }
 
-S3JniApi(sqlite3_config(/*for a small subset of options.*/),
+S3JniApi(sqlite3_config() /*for a small subset of options.*/,
          jint,1config__I)(JniArgsEnvClass, jint n){
   switch( n ){
     case SQLITE_CONFIG_SINGLETHREAD:
@@ -4747,10 +4747,12 @@ Java_org_sqlite_jni_SQLite3Jni_init(JniArgsEnvClass){
   jclass klazz;
   const ConfigFlagEntry * pConfFlag;
 
+#if 0
   if( 0==sqlite3_threadsafe() ){
     (*env)->FatalError(env, "sqlite3 currently requires SQLITE_THREADSAFE!=0.");
     return;
   }
+#endif
   memset(&S3JniGlobal, 0, sizeof(S3JniGlobal));
   if( (*env)->GetJavaVM(env, &SJG.jvm) ){
     (*env)->FatalError(env, "GetJavaVM() failure shouldn't be possible.");
index 5a9e3c080536f1c9f48d1125c77c1402cfd05890..a4e63cb1e4978e95044b8ca5edb789e25ef7bd82 100644 (file)
@@ -32,14 +32,21 @@ import java.lang.annotation.ElementType;
 
 
   <p>Only functions which materially differ from their C counterparts
-  are documented here. The C documentation is otherwise applicable
-  for these APIs:
+  are documented here, and only those material differences are
+  documented. The C documentation is otherwise applicable for these
+  APIs:
 
   <p><a href="https://sqlite.org/c3ref/intro.html">https://sqlite.org/c3ref/intro.html</a>
 
   <p>A handful of Java-specific APIs have been added which are documented
   here.
 
+  <p>Though most of the {@code SQLITE_abc...} C macros represented by
+  this class are defined as final, a few are necessarily non-final
+  because they cannot be set until static class-level initialization
+  is run. Modifying them at runtime has no effect on the library but
+  may confuse any client-level code which uses them.
+
   <p>Notes regarding Java's Modified UTF-8 vs standard UTF-8:
 
   <p>SQLite internally uses UTF-8 encoding, whereas Java natively uses
index 1c452f720cbf922145d3d8c2322abe020da41382..50cecf6511262689d801799a1bebfe018fc96745 100644 (file)
@@ -1532,7 +1532,7 @@ public class Tester1 implements Runnable {
     int nLoop = 0;
     switch( SQLITE_THREADSAFE ){ /* Sanity checking */
       case 0:
-        affirm( 0==sqlite3_config( SQLITE_CONFIG_SINGLETHREAD ),
+        affirm( 0!=sqlite3_config( SQLITE_CONFIG_SINGLETHREAD ),
                 "Could not switch to single-thread mode." );
         affirm( 0!=sqlite3_config( SQLITE_CONFIG_MULTITHREAD ),
                 "Could switch to multithread mode."  );
@@ -1555,7 +1555,8 @@ public class Tester1 implements Runnable {
     }
     outln("libversion_number: ",
           sqlite3_libversion_number(),"\n",
-          sqlite3_libversion(),"\n",SQLITE_SOURCE_ID);
+          sqlite3_libversion(),"\n",SQLITE_SOURCE_ID,"\n",
+          "SQLITE_THREADSAFE=",SQLITE_THREADSAFE);
     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 ){
index 88ce877e9e7f6c61fec91ff238dee6a7cb273834..b05d08c480d63d7ae50667c8fd601dc4d2358bac 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Code\srestructuring.\sForce\sSQLITE_THREADSAFE\sin\sJNI\sbuilds\sfor\sthe\stime\sbeing,\sas\sthreadsafe==0\sleads\sto\sas-yet-mysterious\sJNI-level\sreference\serrors.
-D 2023-08-25T11:32:56.589
+C Re-enable\sSQLITE_THREADSAFE=0\sin\sthe\sJNI\sbuild\sand\sadd\smultitest\starget\swhich\sbuilds\sand\sruns\sthe\stests\sin\sall\s3\sthreading\smodes.
+D 2023-08-25T12:29:59.869
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -233,10 +233,10 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
 F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9
 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
-F ext/jni/GNUmakefile 2fe04e7a7534a069ea8448f42e95bb5f8fc279ea3c9883598acedc99bbc254a7
+F ext/jni/GNUmakefile 8ad3d9c7dbcedd24fac64298b0558c029cd8b6683211400e403b2e661ce99755
 F ext/jni/README.md 1332b1fa27918bd5d9ca2d0d4f3ac3a6ab86b9e3699dc5bfe32904a027f3d2a9
 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
-F ext/jni/src/c/sqlite3-jni.c 2d13c93fbf83feb2725922cc63e3157284848a435a9ff5faa8949d9157e1490f
+F ext/jni/src/c/sqlite3-jni.c 7a93269d26256e6adbdcb6bcdcbba8d1e39d21602e145e8d07d23979b4530219
 F ext/jni/src/c/sqlite3-jni.h 3d8cdacce26d20fd967d67a2e8539d38fc2e9fe13598147399db4b2c303a89c8
 F ext/jni/src/org/sqlite/jni/Fts5.java a45cd890202d72c3bfe8aea69b57b02b6dd588361af81d8b921954c37940b2f7
 F ext/jni/src/org/sqlite/jni/Fts5Context.java 0a5a02047a6a1dd3e4a38b0e542a8dd2de365033ba30e6ae019a676305959890
@@ -250,8 +250,8 @@ F ext/jni/src/org/sqlite/jni/Nullable.java b2f8755970e9dd0e917a505638d036ccc699c
 F ext/jni/src/org/sqlite/jni/OutputPointer.java 4ae06135decef35eb04498daa2868939d91a294e948747c580ef9ce31563a6b3
 F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7ce7797f2c6c7fca2004ff12ce20f86
 F ext/jni/src/org/sqlite/jni/SQLFunction.java 4d6291fa14fcca1a040609378f9f00a193145d79c3abbda98ba32c340904cbeb
-F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 582242f27aea55bce0d3b88dd63bea03e4cb49a8c40950ef99a7e19d9307dfb9
-F ext/jni/src/org/sqlite/jni/Tester1.java c2e3d18229e9443c3e6cf54a150cfa832219ba63a0b17f7bef102e5e4b2b2a8d
+F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 26d757281a6ba588f9146f15f89ab14c8dbe5367ac40bd23d6be6f8eef578f18
+F ext/jni/src/org/sqlite/jni/Tester1.java 449091bf0c225774733657df7fdbb5f357692aed0cb6e327ef94474c81a2d834
 F ext/jni/src/org/sqlite/jni/TesterFts5.java 6f135c60e24c89e8eecb9fe61dde0f3bb2906de668ca6c9186bcf34bdaf94629
 F ext/jni/src/org/sqlite/jni/ValueHolder.java f022873abaabf64f3dd71ab0d6037c6e71cece3b8819fa10bf26a5461dc973ee
 F ext/jni/src/org/sqlite/jni/authorizer_callback.java 1d2d7fd584f917afa507820644d95504bcc9c5d7363a7afeb58de3b256851bfe
@@ -2100,8 +2100,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 17d56c0207f63614b34ef3594d06602ab7a6e85604f3589b30aa79316f1744ee
-R 0d04424045f1de02bc280794aad48b2b
+P 5a099caa2c21bec647f0a521e7f5d0d1cc2f96d388d3d6c53d5ec80947f33e8d
+R fc74e77446b77e2790329feddc6b9d23
 U stephan
-Z a29af0815bfb2df6f8dd8b5fbb60db4d
+Z 1c734de9d457eba0b72974da78927307
 # Remove this line to create a well-formed Fossil manifest.
index 8c6286a678998826f9985943a11bb956a0d569da..8d12423ec622e4b82f16f5bb91143f2926701fa4 100644 (file)
@@ -1 +1 @@
-5a099caa2c21bec647f0a521e7f5d0d1cc2f96d388d3d6c53d5ec80947f33e8d
\ No newline at end of file
+6b1c816f6aae9face07ed7ead969257cf915c21ff9cdad9a21b7cf0e7496e09e
\ No newline at end of file