]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a case in test_fuzzer.c causing transformations from the wrong ruleset to be...
authordan <dan@noemail.net>
Mon, 20 Feb 2012 19:36:09 +0000 (19:36 +0000)
committerdan <dan@noemail.net>
Mon, 20 Feb 2012 19:36:09 +0000 (19:36 +0000)
FossilOrigin-Name: cb5f5ebc563b8d3e47bc30b6dbb374bb91efd3ef

manifest
manifest.uuid
src/test_fuzzer.c
test/fuzzer1.test

index 70772b6d2991986a61156e14c99fefc9bae4083a..a05f010578dbf90d9a88dac320934237a21dc139 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Increase\sthe\smaximum\sruleset\sid\sin\sthe\sfuzzer\sfrom\s50\sto\s2^31-1.
-D 2012-02-14T18:56:01.799
+C Fix\sa\scase\sin\stest_fuzzer.c\scausing\stransformations\sfrom\sthe\swrong\sruleset\sto\sbe\sapplied\sin\ssome\scases.
+D 2012-02-20T19:36:09.428
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -206,7 +206,7 @@ F src/test_config.c a036a69b550ebc477ab9ca2b37269201f888436e
 F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094
 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
 F src/test_func.c 6232d722a4ddb193035aa13a03796bf57d6c12fd
-F src/test_fuzzer.c 2f5d4cf96e54c96c88560cd04ba533e8749efb4b
+F src/test_fuzzer.c 5c34fdb55c4fa3090d076886139b1f633327a2c5
 F src/test_hexio.c c4773049603151704a6ab25ac5e936b5109caf5a
 F src/test_init.c 3cbad7ce525aec925f8fda2192d576d47f0d478a
 F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
@@ -504,7 +504,7 @@ F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
 F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5
 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
 F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
-F test/fuzzer1.test ff725a0eec070dfc2b2acc13b21a52a139382929
+F test/fuzzer1.test d5638894ffd89cb01e1276e2a52707b0b1261fe2
 F test/hook.test 5f3749de6462a6b87b4209b74adf7df5ac2df639
 F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4
 F test/in.test a7b8a0f43da81cd08645b7a710099ffe9ad1126b
@@ -989,7 +989,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P a82938731b21d6166d7d482994cb065c8b725083
-R 72ac1f4c7362fe7e245ef7893bc4161c
-U drh
-Z f9c57e19d8929af663421df88756961b
+P 760e009adc6d0fffb8e6f64c7ec283938a417a77
+R 2f925ccdeb58b2c1514de71ba4c4df79
+U dan
+Z 2c1d8a850f278c0cc6fb31de180d043b
index 76a7bdb9660e79a3d75597437dfde663c9e15f6d..df025c264140928ed9e2b18a25cb9d4aaa6a624f 100644 (file)
@@ -1 +1 @@
-760e009adc6d0fffb8e6f64c7ec283938a417a77
\ No newline at end of file
+cb5f5ebc563b8d3e47bc30b6dbb374bb91efd3ef
\ No newline at end of file
index 892249b9563a1d3ac106aab2b2e4779a1599d8d3..4402a245efe77621f63c8e8d2d64e0e55b007ebd 100644 (file)
@@ -480,6 +480,7 @@ static int fuzzerSeen(fuzzer_cursor *pCur, fuzzer_stem *pStem){
 static int fuzzerAdvance(fuzzer_cursor *pCur, fuzzer_stem *pStem){
   const fuzzer_rule *pRule;
   while( (pRule = pStem->pRule)!=0 ){
+    assert( pRule==&pCur->nullRule || pRule->iRuleset==pCur->iRuleset );
     while( pStem->n < pStem->nBasis - pRule->nFrom ){
       pStem->n++;
       if( pRule->nFrom==0
@@ -626,6 +627,9 @@ static fuzzer_stem *fuzzerNewStem(
   pNew->nBasis = strlen(zWord);
   memcpy(pNew->zBasis, zWord, pNew->nBasis+1);
   pNew->pRule = pCur->pVtab->pRule;
+  while( pNew->pRule && pNew->pRule->iRuleset!=pCur->iRuleset ){
+    pNew->pRule = pNew->pRule->pNext;
+  }
   pNew->n = -1;
   pNew->rBaseCost = pNew->rCostX = rBaseCost;
   h = fuzzerHash(pNew->zBasis);
index d3199697e8df36937d7f8b7fa68aa51eabbc48c3..05c00bc025b8c42597a0f6eecfdd03a205e7a2f2 100644 (file)
@@ -64,7 +64,7 @@ do_test fuzzer1-1.7 {
   db eval {
     SELECT word, distance FROM f1 WHERE word MATCH 'abcde' AND ruleset=1
   }
-} {abcde 0 axcde 1 axcda 2 abcye 10 abcya 11 axcye 11 axcya 12 abcze 110 abcza 111 axcze 111 axcza 112}
+} {abcde 0 axcde 1 abcye 10 axcye 11 abcze 110 axcze 111}
 do_test fuzzer1-1.8 {
   db eval {
     SELECT word, distance FROM f1 WHERE word MATCH 'abcde' AND distance<100
@@ -90,16 +90,15 @@ do_test fuzzer1-1.11 {
 do_test fuzzer1-1.12 {
   db eval {
     SELECT word, distance FROM f1
-     WHERE word MATCH 'abcde' AND distance<12 AND ruleset=1
+     WHERE word MATCH 'abcde' AND distance<11 AND ruleset=1
   }
-} {abcde 0 axcde 1 axcda 2 abcye 10 abcya 11 axcye 11}
+} {abcde 0 axcde 1 abcye 10}
 do_test fuzzer1-1.13 {
   db eval {
     SELECT word, distance FROM f1
-    WHERE word MATCH 'abcde' AND distance<=12 AND ruleset=1
+    WHERE word MATCH 'abcde' AND distance<=11 AND ruleset=1
   }
-} {abcde 0 axcde 1 axcda 2 abcye 10 abcya 11 axcye 11 axcya 12}
-
+} {abcde 0 axcde 1 abcye 10 axcye 11}
 
 do_test fuzzer1-2.0 {
   execsql {
@@ -1437,4 +1436,12 @@ do_test fuzzer1-2.3 {
 } {{tyler finley} trailer taymouth steelewood tallia tallu talwyn thelema}
 
 
+do_execsql_test fuzzer1-3.1 {
+  CREATE VIRTUAL TABLE temp.f3 USING fuzzer;
+  CREATE TABLE f3(ruleset, cfrom, cto, cost);
+  INSERT INTO f3(ruleset, cfrom, cto, cost) VALUES(0, 'x','y', 10);
+  INSERT INTO f3(ruleset, cfrom, cto, cost) VALUES(1, 'a','b', 10);
+  SELECT word FROM f3 WHERE word MATCH 'ax'
+} {ax ay}
+
 finish_test