CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
corrupt5.test51 linesDownload Raw Back to test
1# 2008 Jan 222#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11# This file implements regression tests for SQLite library.12#13# This file implements tests to make sure SQLite does not crash or14# segfault if it sees a corrupt database file.  Checks for 15# malformed schema.16#17# $Id: corrupt5.test,v 1.3 2009/06/04 02:47:04 shane Exp $18 19set testdir [file dirname $argv0]20source $testdir/tester.tcl21 22# These tests deal with corrupt database files23#24database_may_be_corrupt25 26# We must have the page_size pragma for these tests to work.27#28ifcapable !pager_pragmas {29  finish_test30  return31}32 33# Create a database with a freelist containing at least two pages.34#35do_test corrupt5-1.1 {36  sqlite3_db_config db DEFENSIVE 037  execsql {38    CREATE TABLE t1(a,b,c);39    CREATE INDEX i1 ON t1(a,b);40    PRAGMA writable_schema=ON;41    UPDATE sqlite_master SET name=NULL, sql=NULL WHERE name='i1';42  }43  db close44  sqlite3 db test.db45  catchsql {46    SELECT * FROM t147  }48} {1 {malformed database schema (?)}}49 50finish_test51