From: stephan Date: Wed, 9 Aug 2023 16:29:07 +0000 (+0000) Subject: Strip --oom commands from SQLTester input since (A) we can't currently do anything... X-Git-Tag: version-3.43.0~47^2~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=589857b96587797b33f673f81bce5698da731661;p=thirdparty%2Fsqlite.git Strip --oom commands from SQLTester input since (A) we can't currently do anything with them and (B) they can appear as body content of --testcase commands and the current parser cannot deal with that. If --verbose is provided once, emit the name and args of each command as it's run. If --verbose is used twice or more, also emit the command's body text, if any. FossilOrigin-Name: 0770e8467d4bb9490d9ed6e8a20766ffee7049cc3667db6d036c13fccbb6f3ab --- diff --git a/ext/jni/src/org/sqlite/jni/tester/SQLTester.java b/ext/jni/src/org/sqlite/jni/tester/SQLTester.java index 67e28dbc21..87f59f7632 100644 --- a/ext/jni/src/org/sqlite/jni/tester/SQLTester.java +++ b/ext/jni/src/org/sqlite/jni/tester/SQLTester.java @@ -80,21 +80,26 @@ public class SQLTester { private int iCurrentDb = 0; private final String initialDbName = "test.db"; private TestScript currentScript; + private int verbosity = 0; public SQLTester(){ reset(); } - public void setVerbose(boolean b){ - this.outer.setVerbose(b); + public void setVerbose(int level){ + verbosity = level; + this.outer.setVerbose( level!=0 ); + } + public int getVerbosity(){ + return verbosity; } public boolean isVerbose(){ - return this.outer.isVerbose(); + return verbosity>0; } @SuppressWarnings("unchecked") public void verbose(Object... vals){ - outer.verbose(vals); + if( verbosity > 0 ) outer.verbose(vals); } @SuppressWarnings("unchecked") @@ -110,7 +115,7 @@ public class SQLTester { //! Adds the given test script to the to-test list. public void addTestScript(String filename){ listInFiles.add(filename); - verbose("Added file ",filename); + //verbose("Added file ",filename); } public void setupInitialDb() throws Exception { @@ -401,10 +406,7 @@ public class SQLTester { if(a.startsWith("-")){ final String flag = a.replaceFirst("-+",""); if( flag.equals("verbose") ){ - t.setVerbose(true); - t.outln("Verbose mode is on."); - }else if( flag.equals("quiet") ) { - t.setVerbose(false); + ++t.verbosity; }else{ throw new IllegalArgumentException("Unhandled flag: "+flag); } diff --git a/ext/jni/src/org/sqlite/jni/tester/TestScript.java b/ext/jni/src/org/sqlite/jni/tester/TestScript.java index ce0fd9e237..06e2b0f6df 100644 --- a/ext/jni/src/org/sqlite/jni/tester/TestScript.java +++ b/ext/jni/src/org/sqlite/jni/tester/TestScript.java @@ -155,10 +155,17 @@ class TestScript { final String sCComment = "[/][*]([*](?![/])|[^*])*[*][/]"; final String s3Dash = "^---+[^\\n]*\\n"; final String sEmptyLine = "^\\n"; + final String sOom = "^--oom\\n" + /* Workaround: --oom is a top-level command in some contexts + and appears in --testcase blocks in others. We don't + do anything with --oom commands aside from ignore them, so + elide them all to fix the --testcase blocks which contain + them. */; final List lPats = new ArrayList<>(); lPats.add(sCComment); lPats.add(s3Dash); lPats.add(sEmptyLine); + lPats.add(sOom); //verbose("Content:").verbose(content).verbose(""); for( String s : lPats ){ final Pattern p = Pattern.compile( @@ -224,13 +231,21 @@ class TestScript { Runs this test script in the context of the given tester object. */ public void run(SQLTester tester) throws Exception { - this.setVerbose(tester.isVerbose()); + final int verbosity = tester.getVerbosity(); + this.setVerbose(verbosity>0); if( null==chunks ){ outer.outln("This test contains content which forces it to be skipped."); }else{ - //int n = 0; + int n = 0; for(CommandChunk chunk : chunks){ - //outer.verbose("CHUNK #",++n," ",chunk,""); + if(verbosity>0){ + outer.out("VERBOSE ",moduleName," #",++n," ",chunk.argv[0], + " ",Util.argvToString(chunk.argv)); + if(verbosity>1 && null!=chunk.content){ + outer.out("\nwith content: ", chunk.content); + } + outer.out("\n"); + } CommandDispatcher.dispatch(tester, chunk.argv, chunk.content); } } diff --git a/manifest b/manifest index 116f24efda..0d08b578df 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sdefinition\sof\s"special\scharacters"\sfor\sthe\sSQLTester\sand\scorrect\sthe\scode\sto\smatch\sit. -D 2023-08-09T16:03:12.027 +C Strip\s--oom\scommands\sfrom\sSQLTester\sinput\ssince\s(A)\swe\scan't\scurrently\sdo\sanything\swith\sthem\sand\s(B)\sthey\scan\sappear\sas\sbody\scontent\sof\s--testcase\scommands\sand\sthe\scurrent\sparser\scannot\sdeal\swith\sthat.\sIf\s--verbose\sis\sprovided\sonce,\semit\sthe\sname\sand\sargs\sof\seach\scommand\sas\sit's\srun.\sIf\s--verbose\sis\sused\stwice\sor\smore,\salso\semit\sthe\scommand's\sbody\stext,\sif\sany. +D 2023-08-09T16:29:07.987 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -266,8 +266,8 @@ F ext/jni/src/org/sqlite/jni/sqlite3_context.java d26573fc7b309228cb49786e907859 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/Outer.java 3d9c40f8ed58ec0df05ca160986ea06ec84ec1f338b069cfba9604bbba467a01 -F ext/jni/src/org/sqlite/jni/tester/SQLTester.java 7217172ff32f280c1bf62b174b57ffcae5c75552b643a784003c9f9719162656 -F ext/jni/src/org/sqlite/jni/tester/TestScript.java 3e284ba0ca456dd28e79f9283affbff870c0c58489c720e3cf9816299ab849cc +F ext/jni/src/org/sqlite/jni/tester/SQLTester.java fbaaaf3f04451a66d8031a6792945fa7396be0e522774f364c2cf1520b38003a +F ext/jni/src/org/sqlite/jni/tester/TestScript.java 91ee32908b837a561cd2820fa49476743823a7b5e13e43ea8fd577357900fd16 F ext/jni/src/org/sqlite/jni/tester/test-script-interpreter.md 44449866970341076cec355193f89646825270a2f4f4073b55150cc4a55100d4 F ext/jni/src/tests/000_first.test 66dd69f5412b87b063982d1aad6907fbe472bc627ca863ae33145e4f54499b8a F ext/jni/src/tests/010_ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 @@ -2090,8 +2090,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 4fcc8cb0cc2bbc0da71bdb99dacfdec54814af4c0e4c37619bad6a8e5fa62937 -R 50e013996507ced6d098ec0b617f8f6d +P 217f6e0c9c09c576b09ea59fce085a53d1a133927046102b4d00fd58109efc93 +R cabb506465cd0b0ec946cd352f846b65 U stephan -Z d066411b7d335d12f1361c829dcf4913 +Z 928111b17e4d371ea24b2ea94c9fa691 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7d5f2d3fc0..d076cf8dbe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -217f6e0c9c09c576b09ea59fce085a53d1a133927046102b4d00fd58109efc93 \ No newline at end of file +0770e8467d4bb9490d9ed6e8a20766ffee7049cc3667db6d036c13fccbb6f3ab \ No newline at end of file