/ Check-in [1f2fb777]
Login

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

Overview
Comment:In releasetest.tcl: (1) Add the Failure-Detection platform. (2) Re-add the --disable-shared argument on Default that was mistakenly removed by the previous commit. (3) Remove the -ftrapv tests, as we read that -ftrapv does not work in GCC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1f2fb77781a93427a2348f821b66dba7310c49b8
User & Date: drh 2015-01-08 02:15:11
Context
2015-01-08
02:28
Fix the extension tags on the "smoketest" makefile target for Windows. check-in: 826fd311 user: drh tags: trunk
02:15
In releasetest.tcl: (1) Add the Failure-Detection platform. (2) Re-add the --disable-shared argument on Default that was mistakenly removed by the previous commit. (3) Remove the -ftrapv tests, as we read that -ftrapv does not work in GCC. check-in: 1f2fb777 user: drh tags: trunk
01:05
In releasetest.tcl: add options --veryquick and pass-through compiler optimization settings (ex: -O0). Collect the SQLite version number from the main.test output and show it during the summary report at the end. check-in: e7e7bc1d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test1.c.

  6600   6600     zUser = Tcl_GetString(objv[2]);
  6601   6601     rc = sqlite3_user_delete(db, zUser);
  6602   6602     Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
  6603   6603     return TCL_OK;
  6604   6604   }
  6605   6605   #endif /* SQLITE_USER_AUTHENTICATION */
  6606   6606   
         6607  +/*
         6608  +** tclcmd: bad_behavior TYPE
         6609  +**
         6610  +** Do some things that should trigger a valgrind or -fsanitize=undefined
         6611  +** warning.  This is used to verify that errors and warnings output by those
         6612  +** tools are detected by the test scripts.
         6613  +**
         6614  +**       TYPE       BEHAVIOR
         6615  +**       1          Overflow a signed integer
         6616  +**       2          Jump based on an uninitialized variable
         6617  +**       3          Read after free
         6618  +*/
         6619  +static int test_bad_behavior(
         6620  +  ClientData clientData, /* Pointer to an integer containing zero */
         6621  +  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
         6622  +  int objc,              /* Number of arguments */
         6623  +  Tcl_Obj *CONST objv[]  /* Command arguments */
         6624  +){
         6625  +  int iType;
         6626  +  int xyz;
         6627  +  int i = *(int*)clientData;
         6628  +  int j;
         6629  +  int w[10];
         6630  +  int *a;
         6631  +  if( objc!=2 ){
         6632  +    Tcl_WrongNumArgs(interp, 1, objv, "TYPE");
         6633  +    return TCL_ERROR;
         6634  +  }
         6635  +  if( Tcl_GetIntFromObj(interp, objv[1], &iType) ) return TCL_ERROR;
         6636  +  switch( iType ){
         6637  +    case 1: {
         6638  +      xyz = 0x7fffff00 - i;
         6639  +      xyz += 0x100;
         6640  +      Tcl_SetObjResult(interp, Tcl_NewIntObj(xyz));
         6641  +      break;
         6642  +    }
         6643  +    case 2: {
         6644  +      w[1] = 5;
         6645  +      if( w[i]>0 ) w[1]++;
         6646  +      Tcl_SetObjResult(interp, Tcl_NewIntObj(w[1]));
         6647  +      break;
         6648  +    }
         6649  +    case 3: {
         6650  +      a = malloc( sizeof(int)*10 );
         6651  +      for(j=0; j<10; j++) a[j] = j;
         6652  +      free(a);
         6653  +      Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i]));
         6654  +      break;
         6655  +    }
         6656  +  }
         6657  +  return TCL_OK;
         6658  +}  
         6659  +  
         6660  +
  6607   6661   /*
  6608   6662   ** Register commands with the TCL interpreter.
  6609   6663   */
  6610   6664   int Sqlitetest1_Init(Tcl_Interp *interp){
  6611   6665     extern int sqlite3_search_count;
  6612   6666     extern int sqlite3_found_count;
  6613   6667     extern int sqlite3_interrupt_count;
................................................................................
  6616   6670     extern int sqlite3_current_time;
  6617   6671   #if SQLITE_OS_UNIX && defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
  6618   6672     extern int sqlite3_hostid_num;
  6619   6673   #endif
  6620   6674     extern int sqlite3_max_blobsize;
  6621   6675     extern int sqlite3BtreeSharedCacheReport(void*,
  6622   6676                                             Tcl_Interp*,int,Tcl_Obj*CONST*);
         6677  +  static int iZero = 0;
  6623   6678     static struct {
  6624   6679        char *zName;
  6625   6680        Tcl_CmdProc *xProc;
  6626   6681     } aCmd[] = {
  6627   6682        { "db_enter",                      (Tcl_CmdProc*)db_enter               },
  6628   6683        { "db_leave",                      (Tcl_CmdProc*)db_leave               },
  6629   6684        { "sqlite3_mprintf_int",           (Tcl_CmdProc*)sqlite3_mprintf_int    },
................................................................................
  6668   6723        { "clang_sanitize_address",        (Tcl_CmdProc*)clang_sanitize_address },
  6669   6724     };
  6670   6725     static struct {
  6671   6726        char *zName;
  6672   6727        Tcl_ObjCmdProc *xProc;
  6673   6728        void *clientData;
  6674   6729     } aObjCmd[] = {
         6730  +     { "bad_behavior",                  test_bad_behavior,  (void*)&iZero },
  6675   6731        { "sqlite3_connection_pointer",    get_sqlite_pointer, 0 },
  6676   6732        { "sqlite3_bind_int",              test_bind_int,      0 },
  6677   6733        { "sqlite3_bind_zeroblob",         test_bind_zeroblob, 0 },
  6678   6734        { "sqlite3_bind_int64",            test_bind_int64,    0 },
  6679   6735        { "sqlite3_bind_double",           test_bind_double,   0 },
  6680   6736        { "sqlite3_bind_null",             test_bind_null     ,0 },
  6681   6737        { "sqlite3_bind_text",             test_bind_text     ,0 },

Changes to test/main.test.

   516    516   }
   517    517   
   518    518   # Print the version number so that it can be picked up by releasetest.tcl.
   519    519   #
   520    520   puts [db one {SELECT 'VERSION: ' ||
   521    521                     sqlite_version() || ' ' ||
   522    522                     sqlite_source_id();}]
          523  +
          524  +# Do deliberate failures if the TEST_FAILURE environment variable is set.
          525  +# This is done to verify that failure notifications are detected by the
          526  +# releasetest.tcl script, or possibly by other scripts involved in automatic
          527  +# testing.
          528  +#
          529  +if {[info exists ::env(TEST_FAILURE)]} {
          530  +  set res 123
          531  +  if {$::env(TEST_FAILURE)==0} {set res 234}
          532  +  do_test main-99.1 {
          533  +     bad_behavior $::env(TEST_FAILURE)
          534  +     set x 123
          535  +  } $res
          536  +}
   523    537       
   524    538   finish_test

Changes to test/permutations.test.

   119    119     set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
   120    120   }
   121    121   if {[info exists ::env(QUICKTEST_OMIT)]} {
   122    122     foreach x [split $::env(QUICKTEST_OMIT) ,] {
   123    123       regsub -all \\y$x\\y $allquicktests {} allquicktests
   124    124     }
   125    125   }
          126  +
          127  +# If the TEST_FAILURE environment variable is set, it means that we what to
          128  +# deliberately provoke test failures in order to test the test infrastructure.
          129  +# Only the main.test module is needed for this.
          130  +#
          131  +if {[info exists ::env(TEST_FAILURE)]} {
          132  +  set allquicktests main.test
          133  +}
   126    134   
   127    135   #############################################################################
   128    136   # Start of tests
   129    137   #
   130    138   
   131    139   #-------------------------------------------------------------------------
   132    140   # Define the generic test suites:

Changes to test/releasetest.tcl.

    28     28   Every test begins with a fresh run of the configure script at the top
    29     29   of the SQLite source tree.
    30     30   }
    31     31   
    32     32   array set ::Configs {
    33     33     "Default" {
    34     34       -O2
    35         -    --disable-amalgamation
    36         -  }
    37         -  "Ftrapv" {
    38         -    -O2 -ftrapv
    39         -    -DSQLITE_MAX_ATTACHED=125
    40         -    -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
           35  +    --disable-amalgamation --disable-shared
    41     36     }
    42     37     "Sanitize" {
    43     38       CC=clang -fsanitize=undefined
    44     39       -DSQLITE_ENABLE_STAT4
    45     40     }
    46     41     "Unlock-Notify" {
    47     42       -O2
................................................................................
    84     79       -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
    85     80       -DSQLITE_ENABLE_FTS3=1
    86     81       -DSQLITE_ENABLE_RTREE=1
    87     82       -DSQLITE_ENABLE_MEMSYS5=1
    88     83       -DSQLITE_ENABLE_MEMSYS3=1
    89     84       -DSQLITE_ENABLE_COLUMN_METADATA=1
    90     85       -DSQLITE_ENABLE_STAT4
           86  +    -DSQLITE_MAX_ATTACHED=125
    91     87     }
    92     88     "Device-One" {
    93     89       -O2
    94     90       -DSQLITE_DEBUG=1
    95     91       -DSQLITE_DEFAULT_AUTOVACUUM=1
    96     92       -DSQLITE_DEFAULT_CACHE_SIZE=64
    97     93       -DSQLITE_DEFAULT_PAGE_SIZE=1024
................................................................................
   164    160       -DHAVE_USLEEP=1
   165    161     }
   166    162     "Valgrind" {
   167    163       -DSQLITE_ENABLE_STAT4
   168    164       -DSQLITE_ENABLE_FTS4
   169    165       -DSQLITE_ENABLE_RTREE
   170    166     }
          167  +  Fail0 {-O0}
          168  +  Fail2 {-O0}
          169  +  Fail3 {-O0}
   171    170   }
   172    171   
   173    172   array set ::Platforms {
   174    173     Linux-x86_64 {
   175    174       "Check-Symbols"           checksymbols
   176    175       "Debug-One"               "mptest test"
   177    176       "Secure-Delete"           test
   178    177       "Unlock-Notify"           "QUICKTEST_INCLUDE=notify2.test test"
   179    178       "Update-Delete-Limit"     test
   180    179       "Extra-Robustness"        test
   181    180       "Device-Two"              test
   182    181       "No-lookaside"            test
   183    182       "Devkit"                  test
   184         -    "Ftrapv"                  test
   185    183       "Sanitize"                {QUICKTEST_OMIT=func4.test,nan.test test}
   186    184       "Valgrind"                valgrindtest
   187    185       "Default"                 "threadtest fulltest"
   188    186       "Device-One"              fulltest
   189    187     }
   190    188     Linux-i686 {
   191    189       "Devkit"                  test
................................................................................
   201    199     Darwin-x86_64 {
   202    200       "Locking-Style"           "mptest test"
   203    201       "OS-X"                    "threadtest fulltest"
   204    202     }
   205    203     "Windows NT-intel" {
   206    204       "Default"                 "mptest fulltestonly"
   207    205     }
          206  +  Failure-Detection {
          207  +    Fail0     "TEST_FAILURE=0 test"
          208  +    Sanitize  "TEST_FAILURE=1 test"
          209  +    Fail2     "TEST_FAILURE=2 valgrindtest"
          210  +    Fail3     "TEST_FAILURE=3 valgrindtest"
          211  +  }
   208    212   }
   209    213   
   210    214   
   211    215   # End of configuration section.
   212    216   #########################################################################
   213    217   #########################################################################
   214    218