the db's result code.
appendMode specifies how/whether to append results to the result
- buffer. lineMode specifies whether to output all results in a
+ buffer. rowMode specifies whether to output all results in a
single line or one line per row. If appendMode is
- ResultBufferMode.NONE then lineMode is ignored and may be null.
+ ResultBufferMode.NONE then rowMode is ignored and may be null.
*/
public int execSql(sqlite3 db, boolean throwOnError,
- ResultBufferMode appendMode, ResultRowMode lineMode,
+ ResultBufferMode appendMode, ResultRowMode rowMode,
String sql) throws SQLTesterException {
if( null==db && null==aDb[0] ){
// Delay opening of the initial db to enable tests to change its
throw new SQLTesterException("Unhandled ResultBufferMode: "+appendMode);
}
}
- if( ResultRowMode.NEWLINE == lineMode ){
+ if( ResultRowMode.NEWLINE == rowMode ){
spacing = 0;
sb.append('\n');
}
}
public String getOutputPrefix(){
- String rc = "["+(moduleName==null ? filename : moduleName)+"]";
+ String rc = "["+(moduleName==null ? "<unnamed>" : moduleName)+"]";
if( null!=testCaseName ) rc += "["+testCaseName+"]";
+ if( null!=filename ) rc += "["+filename+"]";
return rc + " line "+ cur.lineNo;
}
}
private boolean checkRequiredProperties(SQLTester t, String[] props) throws SQLTesterException{
+ if( true ) return false;
int nOk = 0;
for(String rp : props){
verbose1("REQUIRED_PROPERTIES: ",rp);
t.appendDbInitSql("pragma temp_store=0;");
++nOk;
break;
+ case "AUTOVACUUM":
+ t.appendDbInitSql("pragma auto_vacuum=full;");
+ ++nOk;
+ case "INCRVACUUM":
+ t.appendDbInitSql("pragma auto_vacuum=incremental;");
+ ++nOk;
default:
break;
}
m = patternRequiredProperties.matcher(line);
if( m.find() ){
final String rp = m.group(1);
- //if( ! checkRequiredProperties( tester, rp.split("\\s+") ) ){
- throw new IncompatibleDirective(this, "REQUIRED_PROPERTIES: "+rp);
- //}
+ if( ! checkRequiredProperties( tester, rp.split("\\s+") ) ){
+ throw new IncompatibleDirective(this, "REQUIRED_PROPERTIES: "+rp);
+ }
}
m = patternMixedModuleName.matcher(line);
if( m.find() ){
}
this.name = 'SQLTesterException';
}
- /**
- If this overrideable method returns false (the default) then
- exceptions of that type are fatal to a whole test run, instead of
- just the test which triggered it. If the the "keep going" flag
- is set, this preference is ignored.
- */
isFatal() { return false; }
}
? function(){} : globalThis.SharedArrayBuffer;
+/* Frequently-reused regexes. */
const Rx = newObj({
requiredProperties: / REQUIRED_PROPERTIES:[ \t]*(\S.*)\s*$/,
scriptModuleName: / SCRIPT_MODULE_NAME:[ \t]*(\S+)\s*$/,
command: /^--(([a-z-]+)( .*)?)$/,
//! "Special" characters - we have to escape output if it contains any.
special: /[\x00-\x20\x22\x5c\x7b\x7d]/,
- //! Either of '{' or '}'.
squiggly: /[{}]/
});
argvToString: (list)=>{
const m = [...list];
- m.shift();
+ m.shift() /* strip command name */;
return m.join(" ")
},
}
}
+ static #verboseLabel = ["🔈",/*"🔉",*/"🔊","📢"];
verboseN(lvl, args){
if( this.#verbosity>=lvl ){
- this.#outlnImpl(lvl,'VERBOSE ',lvl,': ',...args);
+ this.#outlnImpl(lvl, Outer.#verboseLabel[lvl-1],': ',...args);
}
}
verbose1(...args){ return this.verboseN(1,args); }
this.#resultBuffer.push(line);
if( addNL ) this.#resultBuffer.push('\n');
}
+ appendDbInitSql(sql){
+ this.#db.initSql.push(sql);
+ if( this.currentDb() ){
+ this.execSql(null, true, ResultBufferMode.NONE, null, sql);
+ }
+ }
+
+ #runInitSql(pDb){
+ let rc = 0;
+ for(const sql of this.#db.initSql){
+ this.#outer.verbose2("RUNNING DB INIT CODE: ",sql);
+ rc = this.execSql(pDb, false, ResultBufferMode.NONE, null, sql);
+ if( rc ) break;
+ }
+ return rc;
+ }
- #clearBuffer(buffer){
+#clearBuffer(buffer){
buffer.length = 0;
return buffer;
}
}
nullValue(){
- if( 0==arguments.length ){
- return this.#nullView;
- }else{
- this.#nullView = ''+arguments[0];
- }
+ return (0==arguments.length)
+ ? this.#nullView
+ : (this.#nullView = ''+arguments[0]);
}
outputColumnNames(){
- if( 0==arguments.length ){
- return this.#emitColNames;
- }else{
- this.#emitColNames = !!arguments[0];
- }
+ return (0==arguments.length)
+ ? this.#emitColNames
+ : (this.#emitColNames = !!arguments[0]);
}
currentDbId(){
- if( 0==arguments.length ){
- return this.#db.iCurrentDb;
- }else{
- this.#affirmDbId(arguments[0]).#db.iCurrentDb = arguments[0];
- }
+ return (0==arguments.length)
+ ? this.#db.iCurrentDb
+ : (this.#affirmDbId(arguments[0]).#db.iCurrentDb = arguments[0]);
}
#affirmDbId(id){
if( 0==arguments.length ){
id = this.#db.iCurrentDb;
}
- const db = this.#affirmDbId(id).#db.list[id];
- if( db ){
- sqlite3.capi.sqlite3_close_v2(db);
+ const pDb = this.#affirmDbId(id).#db.list[id];
+ if( pDb ){
+ sqlite3.capi.sqlite3_close_v2(pDb);
this.#db.list[id] = null;
}
}
rc = sqlite3.capi.sqlite3_open_v2(name, ppOut, flags, null);
pDb = wasm.peekPtr(ppOut);
});
+ let sql;
if( 0==rc && this.#db.initSql.length > 0){
- this.#outer.verbose2("RUNNING DB INIT CODE: ",this.#db.initSql.toString());
- rc = this.execSql(pDb, false, ResultBufferMode.NONE,
- null, this.#db.initSql.join(''));
+ rc = this.#runInitSql(pDb);
}
if( 0!=rc ){
sqlite3.SQLite3Error.toss(
sqlite3.oo1.DB.checkRc(pDb, rc);
}
- execSql(pDb, throwOnError, appendMode, lineMode, sql){
+ execSql(pDb, throwOnError, appendMode, rowMode, sql){
if( !pDb && !this.#db.list[0] ){
this.#setupInitialDb();
}
}
}/* column loop */
}/* row loop */
- if( ResultRowMode.NEWLINE === lineMode ){
+ if( ResultRowMode.NEWLINE === rowMode ){
spacing = 0;
sb.push('\n');
}
}
getOutputPrefix() {
- let rc = "["+(this.#moduleName || this.#filename)+"]";
+ let rc = "["+(this.#moduleName || '<unnamed>')+"]";
if( this.#testCaseName ) rc += "["+this.#testCaseName+"]";
+ if( this.#filename ) rc += '['+this.#filename+']';
return rc + " line "+ this.#cursor.lineNo;
}
return args.length ? this : rc;
}
+ #checkRequiredProperties(tester, props){
+ if(true) return false;
+ let nOk = 0;
+ for(const rp of props){
+ this.verbose2("REQUIRED_PROPERTIES: ",rp);
+ switch(rp){
+ case "RECURSIVE_TRIGGERS":
+ tester.appendDbInitSql("pragma recursive_triggers=on;");
+ ++nOk;
+ break;
+ case "TEMPSTORE_FILE":
+ /* This _assumes_ that the lib is built with SQLITE_TEMP_STORE=1 or 2,
+ which we just happen to know is the case */
+ tester.appendDbInitSql("pragma temp_store=1;");
+ ++nOk;
+ break;
+ case "TEMPSTORE_MEM":
+ /* This _assumes_ that the lib is built with SQLITE_TEMP_STORE=1 or 2,
+ which we just happen to know is the case */
+ tester.appendDbInitSql("pragma temp_store=0;");
+ ++nOk;
+ break;
+ case "AUTOVACUUM":
+ tester.appendDbInitSql("pragma auto_vacuum=full;");
+ ++nOk;
+ break;
+ case "INCRVACUUM":
+ tester.appendDbInitSql("pragma auto_vacuum=incremental;");
+ ++nOk;
+ default:
+ break;
+ }
+ }
+ return props.length == nOk;
+ }
+
#checkForDirective(tester,line){
if(line.startsWith("#")){
throw new IncompatibleDirective(this, "C-preprocessor input: "+line);
m = Rx.requiredProperties.exec(line);
if( m ){
const rp = m[1];
- //if( ! checkRequiredProperties( tester, rp.split("\\s+") ) ){
- throw new IncompatibleDirective(this, "REQUIRED_PROPERTIES: "+rp);
- //}
+ if( !this.#checkRequiredProperties( tester, rp.split(/\s+/).filter(v=>!!v) ) ){
+ throw new IncompatibleDirective(this, "REQUIRED_PROPERTIES: "+rp);
+ }
}
m = Rx.mixedModuleName.exec(line);
-C When\sa\sJS\sSQLTester\sscript\sthrows,\sreport\sthe\sexception\sdetails\sback\sto\sthe\sUI\sregardless\sof\swhether\sit's\sfatal.
-D 2023-08-30T14:20:02.025
+C Further\stweaking\sin\sboth\sSQLTesters.
+D 2023-08-30T15:51:42.969
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/jni/src/org/sqlite/jni/sqlite3_context.java 66ca95ce904044263a4aff684abe262d56f73e6b06bca6cf650761d79d7779ad
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 e5a1a4b55ed940e61558be1292aa66563219f360c7c1f9d40d770307e6da3c07
+F ext/jni/src/org/sqlite/jni/tester/SQLTester.java a6863d0284c8ec8ca5abd3d40e1fb297e7ae57fb97282ba335cd896a770e3918
F ext/jni/src/org/sqlite/jni/tester/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e
-F ext/jni/src/tests/000-000-sanity.test cfe6dc1b950751d6096e3f5695becaadcdaa048bfe9567209d6eb676e693366d
+F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745
F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70
F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0
F ext/lsm1/Makefile a553b728bba6c11201b795188c5708915cc4290f02b7df6ba7e8c4c943fd5cd9
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
-F ext/wasm/SQLTester/SQLTester.mjs 20309ff838209601711087932b008734bab00176e6a47e41d95e11f6d363bae0
-F ext/wasm/SQLTester/SQLTester.run.mjs addeb962f33fb6bca723ab12f0b018303ff962dfc57ee969d051fcbf4f191569
+F ext/wasm/SQLTester/SQLTester.mjs ec2f6ba63a0f2f0562941a0fb8e46b7dc55589711513f1952349785966edfe50
+F ext/wasm/SQLTester/SQLTester.run.mjs c72b7fe2072d05992f7a3d8c6a1d34e95712513ceabe40849784e24e41c84638
F ext/wasm/SQLTester/index.html 3a12895015c165281307eb47786ce3c46b3c3f06383ad6a9fe3a8526105632f1
F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P b530792a514d95c4e8f93cf2170d9fc4de367055fa1704fc171551c946024fa9
-R 27c4b366fbb2810d013255774a7479ce
+P 273d3b05f630d399d42914e95c416b107b4746bbef129cfba9d00fd921666261
+R 137dd20583c129ec3973659fafa81f04
U stephan
-Z 3efc7b20eec1af6f89785f42be992e20
+Z b64a49daabb87406caca79373e21eb07
# Remove this line to create a well-formed Fossil manifest.