mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Generic cleanups and fixes in SQLTester.
FossilOrigin-Name: fc5d3cc30d2b96da42ea10dfb39f1631ff93b8384514fffd641b343df51da2a6
This commit is contained in:
@ -224,7 +224,7 @@ test: $(SQLite3Jni.class) $(sqlite3-jni.dll)
|
||||
org.sqlite.jni.Tester1 $(if $(test.flags),-- $(test.flags),)
|
||||
|
||||
tester.scripts := $(sort $(wildcard $(dir.src)/tests/*.test))
|
||||
tester.flags ?= --verbose
|
||||
tester.flags ?= # --verbose
|
||||
.PHONY: tester
|
||||
ifeq (1,$(enable.tester))
|
||||
tester: $(CLASS_FILES.tester) $(sqlite3-jni.dll)
|
||||
|
@ -166,7 +166,7 @@
|
||||
https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/design.html#jni_interface_functions_and_pointers
|
||||
*/
|
||||
#define JENV_OSELF JNIEnv * const env, jobject jSelf
|
||||
#define JENV_CSELF JNIEnv * const env, jclass jSelf
|
||||
#define JENV_CSELF JNIEnv * const env, jclass jKlazz
|
||||
/* Helpers to account for -Xcheck:jni warnings about not having
|
||||
checked for exceptions. */
|
||||
#define IFTHREW if((*env)->ExceptionCheck(env))
|
||||
@ -4203,7 +4203,7 @@ Java_org_sqlite_jni_SQLite3Jni_uncacheJniEnv(JENV_CSELF){
|
||||
sqlite3.c instead of sqlite3.h.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_sqlite_jni_SQLite3Jni_init(JENV_CSELF, jclass klazzSjni){
|
||||
Java_org_sqlite_jni_SQLite3Jni_init(JENV_CSELF){
|
||||
enum JType {
|
||||
JTYPE_INT,
|
||||
JTYPE_BOOL
|
||||
@ -4266,16 +4266,16 @@ Java_org_sqlite_jni_SQLite3Jni_init(JENV_CSELF, jclass klazzSjni){
|
||||
|
||||
for( pConfFlag = &aLimits[0]; pConfFlag->zName; ++pConfFlag ){
|
||||
char const * zSig = (JTYPE_BOOL == pConfFlag->jtype) ? "Z" : "I";
|
||||
fieldId = (*env)->GetStaticFieldID(env, klazzSjni, pConfFlag->zName, zSig);
|
||||
fieldId = (*env)->GetStaticFieldID(env, jKlazz, pConfFlag->zName, zSig);
|
||||
EXCEPTION_IS_FATAL("Missing an expected static member of the SQLite3Jni class.");
|
||||
//MARKER(("Setting %s (field=%p) = %d\n", pConfFlag->zName, fieldId, pConfFlag->value));
|
||||
assert(fieldId);
|
||||
switch(pConfFlag->jtype){
|
||||
case JTYPE_INT:
|
||||
(*env)->SetStaticIntField(env, klazzSjni, fieldId, (jint)pConfFlag->value);
|
||||
(*env)->SetStaticIntField(env, jKlazz, fieldId, (jint)pConfFlag->value);
|
||||
break;
|
||||
case JTYPE_BOOL:
|
||||
(*env)->SetStaticBooleanField(env, klazzSjni, fieldId,
|
||||
(*env)->SetStaticBooleanField(env, jKlazz, fieldId,
|
||||
pConfFlag->value ? JNI_TRUE : JNI_FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -758,10 +758,10 @@ extern "C" {
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: init
|
||||
* Signature: (Ljava/lang/Class;)V
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_init
|
||||
(JNIEnv *, jclass, jclass);
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
|
@ -126,7 +126,7 @@ public final class SQLite3Jni {
|
||||
//! Not used
|
||||
private SQLite3Jni(){}
|
||||
//! Called from static init code.
|
||||
private static native void init(@NotNull Class<SQLite3Jni> c);
|
||||
private static native void init();
|
||||
|
||||
/**
|
||||
Each thread which uses the SQLite3 JNI APIs should call
|
||||
@ -1457,6 +1457,6 @@ public final class SQLite3Jni {
|
||||
static {
|
||||
// This MUST come after the SQLITE_MAX_... values or else
|
||||
// attempting to modify them silently fails.
|
||||
init(SQLite3Jni.class);
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
@ -47,27 +47,56 @@ enum ResultRowMode {
|
||||
NEWLINE
|
||||
};
|
||||
|
||||
/**
|
||||
Base exception type for test-related failures.
|
||||
*/
|
||||
class SQLTesterException extends RuntimeException {
|
||||
public SQLTesterException(String msg){
|
||||
private boolean bFatal = false;
|
||||
|
||||
SQLTesterException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
|
||||
protected SQLTesterException(String msg, boolean fatal){
|
||||
super(msg);
|
||||
bFatal = fatal;
|
||||
}
|
||||
|
||||
/**
|
||||
Indicates whether the framework should consider this exception
|
||||
type as immediately fatal to the test run or not.
|
||||
*/
|
||||
final boolean isFatal(){ return bFatal; }
|
||||
}
|
||||
|
||||
/**
|
||||
Generic test-failed exception.
|
||||
*/
|
||||
class TestScriptFailed extends SQLTesterException {
|
||||
public TestScriptFailed(TestScript ts, String msg){
|
||||
super(ts.getOutputPrefix()+": "+msg);
|
||||
super(ts.getOutputPrefix()+": "+msg, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Thrown when an unknown test command is encountered in a script.
|
||||
*/
|
||||
class UnknownCommand extends SQLTesterException {
|
||||
public UnknownCommand(TestScript ts, String cmd){
|
||||
super(ts.getOutputPrefix()+": unknown command: "+cmd);
|
||||
super(ts.getOutputPrefix()+": unknown command: "+cmd, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Thrown when an "incompatible directive" is found in a script. This
|
||||
can be the presence of a C-preprocessor construct, specific
|
||||
metadata tags within a test script's header, or specific test
|
||||
constructs which are incompatible with this particular
|
||||
implementation.
|
||||
*/
|
||||
class IncompatibleDirective extends SQLTesterException {
|
||||
public IncompatibleDirective(TestScript ts, String line){
|
||||
super(ts.getOutputPrefix()+": incompatible directive: "+line);
|
||||
super(ts.getOutputPrefix()+": incompatible directive: "+line, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,6 +153,12 @@ class Outer {
|
||||
test-script-interpreter.md.
|
||||
|
||||
This is a work in progress.
|
||||
|
||||
|
||||
An instance of this application provides a core set of services
|
||||
which TestScript instances use for processing testing logic.
|
||||
TestScripts, in turn, delegate the concrete test work to Command
|
||||
objects, which the TestScript parses on their behalf.
|
||||
*/
|
||||
public class SQLTester {
|
||||
//! List of input script files.
|
||||
@ -205,17 +240,10 @@ public class SQLTester {
|
||||
outln("----->>>>> running [",f,"]");
|
||||
try{
|
||||
ts.run(this);
|
||||
}catch(UnknownCommand e){
|
||||
/* currently not fatal */
|
||||
outln(e);
|
||||
}catch(SQLTesterException e){
|
||||
outln("EXCEPTION: ",e.getClass().getSimpleName(),": ",e.getMessage());
|
||||
++nAbortedScript;
|
||||
}catch(IncompatibleDirective e){
|
||||
/* not fatal */
|
||||
outln(e);
|
||||
++nAbortedScript;
|
||||
}catch(Exception e){
|
||||
++nAbortedScript;
|
||||
throw e;
|
||||
if( e.isFatal() ) throw e;
|
||||
}finally{
|
||||
outln("<<<<<----- ",nTest," test(s) in ",ts.getFilename());
|
||||
}
|
||||
@ -266,7 +294,7 @@ public class SQLTester {
|
||||
|
||||
SQLTester affirmDbId(int n) throws IndexOutOfBoundsException {
|
||||
if(n<0 || n>=aDb.length){
|
||||
throw new IndexOutOfBoundsException("illegal db number.");
|
||||
throw new IndexOutOfBoundsException("illegal db number: "+n);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -325,10 +353,13 @@ public class SQLTester {
|
||||
tracking running totals.
|
||||
*/
|
||||
void reset(){
|
||||
clearInputBuffer();
|
||||
clearResultBuffer();
|
||||
closeAllDbs();
|
||||
nTest = 0;
|
||||
nullView = "nil";
|
||||
clearInputBuffer();
|
||||
closeAllDbs();
|
||||
emitColNames = false;
|
||||
iCurrentDb = 0;
|
||||
}
|
||||
|
||||
void setNullValue(String v){nullView = v;}
|
||||
|
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Change\sthe\sSQLite3Jni\sAPI\sannotations\sto\suse\sSOURCE\sretention\s(used\sonly\sat\scompile-time).
|
||||
D 2023-08-10T02:09:12.500
|
||||
C Generic\scleanups\sand\sfixes\sin\sSQLTester.
|
||||
D 2023-08-10T04:24:12.767
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -231,10 +231,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 dcaf23ca24ee2ec2d2e36afdc58886fcf147830c25989a669599c69d38796493
|
||||
F ext/jni/GNUmakefile ce6c7af0a6f0d9ab1502606d191ea7025969b37bc6de67ae93e294ac2ac5d736
|
||||
F ext/jni/README.md e965674505e105626127ad45e628e4d19fcd379cdafc4d23c814c1ac2c55681d
|
||||
F ext/jni/src/c/sqlite3-jni.c bae09ff8bf45f19a506a4eaaf693d26b81f0dd0a410b82475e04dde4b1c5a520
|
||||
F ext/jni/src/c/sqlite3-jni.h 84a3fc3d308e347a2f6b24e4cb8bbafdfa8e75361302047d788e51a307cb2328
|
||||
F ext/jni/src/c/sqlite3-jni.c 3fda1e271054835adec606b4dbaaa6db5ae120b59a72308e4b906739c0a27a87
|
||||
F ext/jni/src/c/sqlite3-jni.h b19a104e0566440af566366cea72188bd994a96ba85c3f196acaa6f4a4609a55
|
||||
F ext/jni/src/org/sqlite/jni/Authorizer.java 1308988f7f40579ea0e4deeaec3c6be971630566bd021c31367fe3f5140db892
|
||||
F ext/jni/src/org/sqlite/jni/AutoExtension.java 3409ad8954d6466bf772e6be9379e0e337312b446b668287062845755a16844d
|
||||
F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c
|
||||
@ -253,7 +253,7 @@ F ext/jni/src/org/sqlite/jni/ProgressHandler.java 6f62053a828a572de809828b1ee495
|
||||
F ext/jni/src/org/sqlite/jni/ResultCode.java 7cdf993f2037ab7bd244c9a34dbaef2ace3beb5da5d7e7fda5c6f67634ceb647
|
||||
F ext/jni/src/org/sqlite/jni/RollbackHook.java b04c8abcc6ade44a8a57129e33765793f69df0ba909e49ba18d73f4268d92564
|
||||
F ext/jni/src/org/sqlite/jni/SQLFunction.java 09ce81c1c637e31c3a830d4c859cce95d65f5e02ff45f8bd1985b3479381bc46
|
||||
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 5f0a9fc79a5c1c1c595f54018dbb8435c8715ff008d68c1834c0c95132178f5d
|
||||
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 578fb62013bbffefc0c37afcbf07dddd290b32147fe6f0d995bc55d044c714ce
|
||||
F ext/jni/src/org/sqlite/jni/Tester1.java 22dca3ab0d93951382230f71e3cfb65898b80f12704a018c8ab9062df609b4fe
|
||||
F ext/jni/src/org/sqlite/jni/TesterFts5.java cf2d687baafffdeba219b77cf611fd47a0556248820ea794ae3e8259bfbdc5ee
|
||||
F ext/jni/src/org/sqlite/jni/Tracer.java a5cece9f947b0af27669b8baec300b6dd7ff859c3e6a6e4a1bd8b50f9714775d
|
||||
@ -266,7 +266,7 @@ F ext/jni/src/org/sqlite/jni/sqlite3.java 62b1b81935ccf3393472d17cb883dc5ff39c38
|
||||
F ext/jni/src/org/sqlite/jni/sqlite3_context.java d26573fc7b309228cb49786e9078597d96232257defa955a3425d10897bca810
|
||||
F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java 78e6d1b95ac600a9475e9db4623f69449322b0c93d1bd4e1616e76ed547ed9fc
|
||||
F ext/jni/src/org/sqlite/jni/sqlite3_value.java 3d1d4903e267bc0bc81d57d21f5e85978eff389a1a6ed46726dbe75f85e6914a
|
||||
F ext/jni/src/org/sqlite/jni/tester/SQLTester.java e7148d734ee13baa8a49508a9a7890914d8d57ff8353fce78b60a875f407cf91
|
||||
F ext/jni/src/org/sqlite/jni/tester/SQLTester.java 5b940aec0939ef766d11f5123b899248e0a3c05f2dc2bd0df26d07b0964c11c0
|
||||
F ext/jni/src/org/sqlite/jni/tester/test-script-interpreter.md ab7169b08566a082ef55c9ef8a553827f99958ed3e076f31eef757563fae51ba
|
||||
F ext/jni/src/tests/000-000-sanity.test de89692155bee1bb35120aced6871dd6562014d0cd7c1dcf173297d8bbc03002
|
||||
F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70
|
||||
@ -2089,8 +2089,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 2815d676951abdab674c374fd903486ea5796f8ee4cb338d41f19693419f8471
|
||||
R c74f8964f3325f83e2be6d2e051bbaac
|
||||
P 3c3fea6bf284721ac376e2ab5a757cf30245dd39264aaf98a8d6cd5575484275
|
||||
R e0dcea60ec5219f4cbd640eec233c812
|
||||
U stephan
|
||||
Z bd78d11df277c77344c8874eae1308fe
|
||||
Z df3f8d652fff3c111483e31409cde9e4
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
3c3fea6bf284721ac376e2ab5a757cf30245dd39264aaf98a8d6cd5575484275
|
||||
fc5d3cc30d2b96da42ea10dfb39f1631ff93b8384514fffd641b343df51da2a6
|
Reference in New Issue
Block a user