Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests and a fix for program "changesetfuzz". |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | changesetfuzz |
Files: | files | file ages | folders |
SHA3-256: |
09b90db56c2d5e3aceae59c6bf1eb07f |
User & Date: | dan 2018-11-08 14:59:51.259 |
Context
2018-11-10
| ||
17:36 | Merge latest trunk changes. (Closed-Leaf check-in: b6d549c988 user: dan tags: changesetfuzz) | |
2018-11-08
| ||
14:59 | Add tests and a fix for program "changesetfuzz". (check-in: 09b90db56c user: dan tags: changesetfuzz) | |
2018-11-07
| ||
20:13 | Merge latest trunk changes into this branch. (check-in: 53cd91d005 user: dan tags: changesetfuzz) | |
Changes
Changes to ext/session/changesetfuzz.c.
︙ | ︙ | |||
532 533 534 535 536 537 538 | int bPkOnly /* True if non-PK fields omitted */ ){ int rc = SQLITE_OK; FuzzChangesetGroup *pGrp = pParse->apGroup[pParse->nGroup-1]; int i; u8 *p = *ppRec; | | > | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | int bPkOnly /* True if non-PK fields omitted */ ){ int rc = SQLITE_OK; FuzzChangesetGroup *pGrp = pParse->apGroup[pParse->nGroup-1]; int i; u8 *p = *ppRec; for(i=0; rc==SQLITE_OK && i<pGrp->nCol; i++){ if( bPkOnly==0 || pGrp->aPK[i] ){ int sz; if( p>=pEnd ) break; if( (pParse->nVal & (pParse->nVal-1))==0 ){ int nNew = pParse->nVal ? pParse->nVal*2 : 4; u8 **apNew = (u8**)sqlite3_realloc(pParse->apVal, nNew*sizeof(u8*)); if( apNew==0 ) return SQLITE_NOMEM; pParse->apVal = apNew; } pParse->apVal[pParse->nVal++] = p; |
︙ | ︙ |
Added ext/session/changesetfuzz1.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | # 2018 November 08 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # if {![info exists testdir]} { set testdir [file join [file dirname [info script]] .. .. test] } source [file join [file dirname [info script]] session_common.tcl] source $testdir/tester.tcl ifcapable !session {finish_test; return} set testprefix changesetfuzz1 set CF [test_find_binary changesetfuzz] if {$CF==""} { finish_test return } proc writefile {zFile data} { set fd [open $zFile w] fconfigure $fd -translation binary -encoding binary puts -nonewline $fd $data close $fd } do_execsql_test 1.0 { CREATE TABLE t1(a, b, c, d, PRIMARY KEY(c, d)); CREATE TABLE t2(a INTEGER PRIMARY KEY, b, c); INSERT INTO t1 VALUES ('one', 'two', 'three', 'four'), ('five', 'six', 'seven', 'eight'), ('nine', 'ten', 'eleven', 'twelve'); INSERT INTO t2 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9); } set C [changeset_from_sql { INSERT INTO t2 VALUES(10, 11, 12); DELETE FROM t2 WHERE a=1; UPDATE t1 SET b='forty-five' WHERE a='one'; UPDATE t1 SET a='twenty-nine', b='seventy' WHERE a='five'; }] writefile c1.changeset $C do_test 1.1 { for {set j 0} {$j < 200} {incr j} { forcecopy c1.changeset input.changeset for {set i 0} {$i < 6} {incr i} { exec $CF input.changeset $i 1 exec $CF input.changeset-0 forcecopy input.changeset-0 input.changeset } } } {} set P [patchset_from_sql { INSERT INTO t2 VALUES(13, 14, 15); DELETE FROM t2 WHERE a=4; UPDATE t1 SET b='thirteen' WHERE a='one'; UPDATE t1 SET a='ninety-seven', b='twenty' WHERE a='five'; }] writefile p1.patchset $P do_test 1.2 { for {set j 0} {$j < 200} {incr j} { forcecopy p1.patchset input.patchset for {set i 0} {$i < 6} {incr i} { exec $CF input.patchset $i 1 exec $CF input.patchset-0 forcecopy input.patchset-0 input.patchset } } } {} finish_test |