SQLite

Check-in [90f422ed81]
Login

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

Overview
Comment:Change the testfixture binary so that it explicitly enabled core files on a crash (on unix). Add a test case to verify that this works.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 90f422ed81311d7ab2a90a381d36cba9c20227fc
User & Date: drh 2015-01-09 21:54:58.894
Context
2015-01-10
14:27
Autoconf configure script updates: (1) remove the long-obsolete --enable-cross-thread-connections option. (2) remove the --with-hints= options. (3) Extension loading is enabled by default. (4) Check for strchrnull() (5) Update the --help text. (check-in: 5004063ce4 user: drh tags: trunk)
2015-01-09
21:54
Change the testfixture binary so that it explicitly enabled core files on a crash (on unix). Add a test case to verify that this works. (check-in: 90f422ed81 user: drh tags: trunk)
20:00
Add SQLITE_ENABLE_STMT_SCANSTATUS to the Update-Delete-Limit configuration in the releasetest.tcl script. (check-in: c70d5edaf6 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/tclsqlite.c.
3808
3809
3810
3811
3812
3813
3814





3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827











3828
3829
3830
3831
3832
3833
3834

#ifdef SQLITE_SSE
    Sqlitetestsse_Init(interp);
#endif
  }
#endif
}






#define TCLSH_MAIN main   /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
  Tcl_Interp *interp;

#if !defined(_WIN32_WCE)
  if( getenv("BREAK") ){
    fprintf(stderr,
        "attach debugger to process %d and press any key to continue.\n",
        GETPID());
    fgetc(stdin);
  }
#endif












  /* Call sqlite3_shutdown() once before doing anything else. This is to
  ** test that sqlite3_shutdown() can be safely called by a process before
  ** sqlite3_initialize() is. */
  sqlite3_shutdown();

  Tcl_FindExecutable(argv[0]);







>
>
>
>
>













>
>
>
>
>
>
>
>
>
>
>







3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850

#ifdef SQLITE_SSE
    Sqlitetestsse_Init(interp);
#endif
  }
#endif
}

/* Needed for the setrlimit() system call on unix */
#if defined(unix)
#include <sys/resource.h>
#endif

#define TCLSH_MAIN main   /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
  Tcl_Interp *interp;

#if !defined(_WIN32_WCE)
  if( getenv("BREAK") ){
    fprintf(stderr,
        "attach debugger to process %d and press any key to continue.\n",
        GETPID());
    fgetc(stdin);
  }
#endif

  /* Since the primary use case for this binary is testing of SQLite,
  ** be sure to generate core files if we crash */
#if defined(SQLITE_TEST) && defined(unix)
  { struct rlimit x;
    getrlimit(RLIMIT_CORE, &x);
    x.rlim_cur = x.rlim_max;
    setrlimit(RLIMIT_CORE, &x);
  }
#endif /* SQLITE_TEST && unix */


  /* Call sqlite3_shutdown() once before doing anything else. This is to
  ** test that sqlite3_shutdown() can be safely called by a process before
  ** sqlite3_initialize() is. */
  sqlite3_shutdown();

  Tcl_FindExecutable(argv[0]);
Changes to src/test1.c.
6614
6615
6616
6617
6618
6619
6620

6621
6622
6623
6624
6625
6626
6627
** warning.  This is used to verify that errors and warnings output by those
** tools are detected by the test scripts.
**
**       TYPE       BEHAVIOR
**       1          Overflow a signed integer
**       2          Jump based on an uninitialized variable
**       3          Read after free

*/
static int test_bad_behavior(
  ClientData clientData, /* Pointer to an integer containing zero */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){







>







6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
** warning.  This is used to verify that errors and warnings output by those
** tools are detected by the test scripts.
**
**       TYPE       BEHAVIOR
**       1          Overflow a signed integer
**       2          Jump based on an uninitialized variable
**       3          Read after free
**       4          Panic
*/
static int test_bad_behavior(
  ClientData clientData, /* Pointer to an integer containing zero */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
6651
6652
6653
6654
6655
6656
6657




6658
6659
6660
6661
6662
6663
6664
    }
    case 3: {
      a = malloc( sizeof(int)*10 );
      for(j=0; j<10; j++) a[j] = j;
      free(a);
      Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i]));
      break;




    }
  }
  return TCL_OK;
}  
  

/*







>
>
>
>







6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
    }
    case 3: {
      a = malloc( sizeof(int)*10 );
      for(j=0; j<10; j++) a[j] = j;
      free(a);
      Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i]));
      break;
    }
    case 4: {
      Tcl_Panic("Deliberate panic");
      break;
    }
  }
  return TCL_OK;
}  
  

/*
Changes to test/releasetest.tcl.
165
166
167
168
169
170
171

172
173
174
175
176
177
178
    -DSQLITE_ENABLE_STAT4
    -DSQLITE_ENABLE_FTS4
    -DSQLITE_ENABLE_RTREE
  }
  Fail0 {-O0}
  Fail2 {-O0}
  Fail3 {-O0}

}

array set ::Platforms {
  Linux-x86_64 {
    "Check-Symbols"           checksymbols
    "Debug-One"               "mptest test"
    "Secure-Delete"           test







>







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
    -DSQLITE_ENABLE_STAT4
    -DSQLITE_ENABLE_FTS4
    -DSQLITE_ENABLE_RTREE
  }
  Fail0 {-O0}
  Fail2 {-O0}
  Fail3 {-O0}
  Fail4 {-O0}
}

array set ::Platforms {
  Linux-x86_64 {
    "Check-Symbols"           checksymbols
    "Debug-One"               "mptest test"
    "Secure-Delete"           test
206
207
208
209
210
211
212

213
214
215
216
217
218
219
    "Default"                 "mptest fulltestonly"
  }
  Failure-Detection {
    Fail0     "TEST_FAILURE=0 test"
    Sanitize  "TEST_FAILURE=1 test"
    Fail2     "TEST_FAILURE=2 valgrindtest"
    Fail3     "TEST_FAILURE=3 valgrindtest"

  }
}


# End of configuration section.
#########################################################################
#########################################################################







>







207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
    "Default"                 "mptest fulltestonly"
  }
  Failure-Detection {
    Fail0     "TEST_FAILURE=0 test"
    Sanitize  "TEST_FAILURE=1 test"
    Fail2     "TEST_FAILURE=2 valgrindtest"
    Fail3     "TEST_FAILURE=3 valgrindtest"
    Fail4     "TEST_FAILURE=4 test"
  }
}


# End of configuration section.
#########################################################################
#########################################################################
274
275
276
277
278
279
280



281
282
283
284
285
286
287
      }
    }
  }
  close $fd
  if {!$seen} {
    set rc 1
    set errmsg "Test did not complete"



  }
}

proc run_test_suite {name testtarget config} {
  # Tcl variable $opts is used to build up the value used to set the
  # OPTS Makefile variable. Variable $cflags holds the value for
  # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but







>
>
>







276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
      }
    }
  }
  close $fd
  if {!$seen} {
    set rc 1
    set errmsg "Test did not complete"
    if {[file readable core]} {
      append errmsg " - core file exists"
    }
  }
}

proc run_test_suite {name testtarget config} {
  # Tcl variable $opts is used to build up the value used to set the
  # OPTS Makefile variable. Variable $cflags holds the value for
  # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
327
328
329
330
331
332
333

334
335
336
337
338
339
340

  set rc 0
  set tm1 [clock seconds]
  set origdir [pwd]
  trace_cmd file mkdir $dir
  trace_cmd cd $dir
  set errmsg {}

  set rc [catch [configureCommand $configOpts]]
  if {!$rc} {
    set rc [catch [makeCommand $testtarget $cflags $opts]]
    count_tests_and_errors test.log rc errmsg
  }
  trace_cmd cd $origdir
  set tm2 [clock seconds]







>







332
333
334
335
336
337
338
339
340
341
342
343
344
345
346

  set rc 0
  set tm1 [clock seconds]
  set origdir [pwd]
  trace_cmd file mkdir $dir
  trace_cmd cd $dir
  set errmsg {}
  catch {file delete core}
  set rc [catch [configureCommand $configOpts]]
  if {!$rc} {
    set rc [catch [makeCommand $testtarget $cflags $opts]]
    count_tests_and_errors test.log rc errmsg
  }
  trace_cmd cd $origdir
  set tm2 [clock seconds]