/ Check-in [e128d72f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update test file func6.test so that it works with SQLITE_ENABLE_NULL_TRIM builds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:e128d72f1a565551d3b6fdb3807fcb1c2a2bf355f0c09d04562b62f49d01fdbc
User & Date: dan 2018-02-12 15:27:32
Context
2018-02-12
20:27
When compiling with VDBE_PROFILE, add the sqlite3NProfileCnt global variable which can be used to measure per-opcode values other than elapse time, if non-zero. check-in: d44d5936 user: drh tags: trunk
15:27
Update test file func6.test so that it works with SQLITE_ENABLE_NULL_TRIM builds. check-in: e128d72f user: dan tags: trunk
13:30
Fix a possible infinite loop in VACUUM that can come up when the schema has been carefully corrupted. Problem discovered by OSSFuzz. Test cases in TH3. check-in: 27754b74 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_config.c.

   496    496   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
   497    497     Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
   498    498   #else
   499    499     Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
   500    500   #endif
   501    501   
   502    502   Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
          503  +
          504  +#ifdef SQLITE_ENABLE_NULL_TRIM
          505  +  Tcl_SetVar2(interp, "sqlite_options", "null_trim", "1", TCL_GLOBAL_ONLY);
          506  +#else
          507  +  Tcl_SetVar2(interp, "sqlite_options", "null_trim", "0", TCL_GLOBAL_ONLY);
          508  +#endif
   503    509   
   504    510   #ifdef SQLITE_OMIT_OR_OPTIMIZATION
   505    511     Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY);
   506    512   #else
   507    513     Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
   508    514   #endif
   509    515   

Changes to test/func6.test.

    17     17   #
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   ifcapable !offset_sql_func {
    21     21     finish_test
    22     22     return
    23     23   }
           24  +
           25  +set bNullTrim 0
           26  +ifcapable null_trim {
           27  +  set bNullTrim 1
           28  +}
    24     29   
    25     30   do_execsql_test func6-100 {
    26     31     PRAGMA page_size=4096;
    27     32     PRAGMA auto_vacuum=NONE;
    28     33     CREATE TABLE t1(a,b,c,d);
    29     34     WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
    30     35      INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
................................................................................
    47     52   # Each argument is either an integer between 0 and 65535, a text value, or
    48     53   # an empty string representing an SQL NULL. This command builds an SQLite
    49     54   # record containing the values passed as arguments and returns it encoded
    50     55   # as a hex string.
    51     56   proc hexrecord {args} {
    52     57     set hdr ""
    53     58     set body ""
           59  +
           60  +  if {$::bNullTrim} {
           61  +    while {[llength $args] && [lindex $args end]=={}} {
           62  +      set args [lrange $args 0 end-1]
           63  +    }
           64  +  }
           65  +
    54     66     foreach x $args {
    55     67       if {$x==""} {
    56     68         append hdr 00
    57     69       } elseif {[string is integer $x]==0} {
    58     70         set n [string length $x]
    59     71         append hdr [format %02x [expr $n*2 + 13]]
    60     72         append body [binary encode hex $x]
................................................................................
    99    111     set rec [hexrecord {*}[lrange $args 1 end]]
   100    112     offset_contains_record $offset $::F $rec
   101    113   }
   102    114   set F [loadhex test.db]
   103    115   db func offrec offrec
   104    116   
   105    117   # Test the sanity of the tests.
          118  +if {$bNullTrim} {
          119  +  set offset 8180
          120  +} else {
          121  +  set offset 8179
          122  +}
   106    123   do_execsql_test func6-105 {
   107    124     SELECT sqlite_offset(d) FROM t1 ORDER BY rowid LIMIT 1;
   108         -} {8179}
          125  +} $offset
   109    126   do_test func6-106 {
   110    127     set r [hexrecord abc001 1 999 {}]
   111         -  offset_contains_record 8179 $F $r
          128  +  offset_contains_record $offset $F $r
   112    129   } 0
   113    130   
   114    131   set z100 [string trim [string repeat "0 " 100]]
   115    132   
   116    133   # Test offsets within table b-tree t1.
   117    134   do_execsql_test func6-110 {
   118    135     SELECT offrec(sqlite_offset(d), a, b, c, d) FROM t1 ORDER BY rowid