aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fuzzcheck.c6
-rw-r--r--test/fuzzinvariants.c40
2 files changed, 23 insertions, 23 deletions
diff --git a/test/fuzzcheck.c b/test/fuzzcheck.c
index 65dd2fa72..9f509306b 100644
--- a/test/fuzzcheck.c
+++ b/test/fuzzcheck.c
@@ -1001,12 +1001,14 @@ static int recoverSqlCb(void *pCtx, const char *zSql){
*/
static int recoverDatabase(sqlite3 *db){
int rc; /* Return code from this routine */
+ const char *zRecoveryDb = ""; /* Name of "recovery" database */
const char *zLAF = "lost_and_found"; /* Name of "lost_and_found" table */
int bFreelist = 1; /* True to scan the freelist */
int bRowids = 1; /* True to restore ROWID values */
- sqlite3_recover *p; /* The recovery object */
+ sqlite3_recover *p = 0; /* The recovery object */
p = sqlite3_recover_init_sql(db, "main", recoverSqlCb, 0);
+ sqlite3_recover_config(p, 789, (void*)zRecoveryDb);
sqlite3_recover_config(p, SQLITE_RECOVER_LOST_AND_FOUND, (void*)zLAF);
sqlite3_recover_config(p, SQLITE_RECOVER_ROWIDS, (void*)&bRowids);
sqlite3_recover_config(p, SQLITE_RECOVER_FREELIST_CORRUPT,(void*)&bFreelist);
@@ -1038,7 +1040,7 @@ static int runDbSql(sqlite3 *db, const char *zSql, unsigned int *pBtsFlags){
printf("RUNNING-SQL: [%s]\n", zSql);
fflush(stdout);
}
- (*pBtsFlags) &= ~BTS_BADPRAGMA;
+ (*pBtsFlags) &= BTS_BADPRAGMA;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
if( rc==SQLITE_OK ){
int nRow = 0;
diff --git a/test/fuzzinvariants.c b/test/fuzzinvariants.c
index 883f8cdfc..0a5f60714 100644
--- a/test/fuzzinvariants.c
+++ b/test/fuzzinvariants.c
@@ -115,6 +115,8 @@ int fuzz_invariant(
if( rc==SQLITE_DONE ){
/* No matching output row found */
sqlite3_stmt *pCk = 0;
+ int iOrigRSO;
+
/* This is not a fault if the database file is corrupt, because anything
** can happen with a corrupt database file */
@@ -136,28 +138,24 @@ int fuzz_invariant(
}
sqlite3_finalize(pCk);
- if( sqlite3_strlike("%group%by%",sqlite3_sql(pStmt),0)==0 ){
- /*
- ** If there is a GROUP BY clause, it might not cover every term in the
- ** output. And then non-covered terms can take on a value from any
- ** row in the result set. This can cause differing answers.
- */
- goto not_a_fault;
+ /*
+ ** If inverting the scan order also results in a miss, assume that the
+ ** query is ambiguous and do not report a fault.
+ */
+ sqlite3_db_config(db, SQLITE_DBCONFIG_REVERSE_SCANORDER, -1, &iOrigRSO);
+ sqlite3_db_config(db, SQLITE_DBCONFIG_REVERSE_SCANORDER, !iOrigRSO, 0);
+ sqlite3_prepare_v2(db, sqlite3_sql(pStmt), -1, &pCk, 0);
+ sqlite3_db_config(db, SQLITE_DBCONFIG_REVERSE_SCANORDER, iOrigRSO, 0);
+ while( (rc = sqlite3_step(pCk))==SQLITE_ROW ){
+ for(i=0; i<nCol; i++){
+ if( !sameValue(pStmt, i, pTestStmt, i, 0) ) break;
+ }
+ if( i>=nCol ) break;
}
-
- if( sqlite3_strlike("%limit%)%order%by%", sqlite3_sql(pTestStmt),0)==0 ){
- /* crash-89bd6a6f8c6166e9a4c5f47b3e70b225f69b76c6
- ** Original statement is:
- **
- ** SELECT a,b,c* FROM t1 LIMIT 1%5<4
- **
- ** When running:
- **
- ** SELECT * FROM (...) ORDER BY 1
- **
- ** A different subset of the rows come out
- */
- goto not_a_fault;
+ sqlite3_finalize(pCk);
+ if( rc==SQLITE_DONE ){
+ sqlite3_finalize(pTestStmt);
+ return SQLITE_DONE;
}
/* The original sameValue() comparison assumed a collating sequence