/ Check-in [c1cae7e7]
Login

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

Overview
Comment:Change the name of some internal testing interfaces to avoid a name conflict in AIX.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c1cae7e7f0a612508c8f82b334d9ebc423f443e99b13092d52e26b348c7cbc5e
User & Date: drh 2019-04-10 12:02:55
Context
2019-04-10
13:24
Further refinement of the sqlite3VdbeMEmExpandBlob() fix of check-in [df58774e994bd] to prevent a reference to an unused variable - problem discovered by Valgrind. check-in: 09435b57 user: drh tags: trunk
12:02
Change the name of some internal testing interfaces to avoid a name conflict in AIX. check-in: c1cae7e7 user: drh tags: trunk
00:58
Do not place arbitrary restrictions on the length of the failure message for a uniqueness constraint. check-in: 037da798 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test4.c.

    60     60   #define N_THREAD 26
    61     61   static Thread threadset[N_THREAD];
    62     62   
    63     63   
    64     64   /*
    65     65   ** The main loop for a thread.  Threads use busy waiting. 
    66     66   */
    67         -static void *thread_main(void *pArg){
           67  +static void *test_thread_main(void *pArg){
    68     68     Thread *p = (Thread*)pArg;
    69     69     if( p->db ){
    70     70       sqlite3_close(p->db);
    71     71     }
    72     72     sqlite3_open(p->zFilename, &p->db);
    73     73     if( SQLITE_OK!=sqlite3_errcode(p->db) ){
    74     74       p->zErr = strdup(sqlite3_errmsg(p->db));
................................................................................
   147    147       return TCL_ERROR;
   148    148     }
   149    149     threadset[i].busy = 1;
   150    150     sqlite3_free(threadset[i].zFilename);
   151    151     threadset[i].zFilename = sqlite3_mprintf("%s", argv[2]);
   152    152     threadset[i].opnum = 1;
   153    153     threadset[i].completed = 0;
   154         -  rc = pthread_create(&x, 0, thread_main, &threadset[i]);
          154  +  rc = pthread_create(&x, 0, test_thread_main, &threadset[i]);
   155    155     if( rc ){
   156    156       Tcl_AppendResult(interp, "failed to create the thread", 0);
   157    157       sqlite3_free(threadset[i].zFilename);
   158    158       threadset[i].busy = 0;
   159    159       return TCL_ERROR;
   160    160     }
   161    161     pthread_detach(x);
   162    162     return TCL_OK;
   163    163   }
   164    164   
   165    165   /*
   166    166   ** Wait for a thread to reach its idle state.
   167    167   */
   168         -static void thread_wait(Thread *p){
          168  +static void test_thread_wait(Thread *p){
   169    169     while( p->opnum>p->completed ) sched_yield();
   170    170   }
   171    171   
   172    172   /*
   173    173   ** Usage:  thread_wait ID
   174    174   **
   175    175   ** Wait on thread ID to reach its idle state.
................................................................................
   189    189     }
   190    190     i = parse_thread_id(interp, argv[1]);
   191    191     if( i<0 ) return TCL_ERROR;
   192    192     if( !threadset[i].busy ){
   193    193       Tcl_AppendResult(interp, "no such thread", 0);
   194    194       return TCL_ERROR;
   195    195     }
   196         -  thread_wait(&threadset[i]);
          196  +  test_thread_wait(&threadset[i]);
   197    197     return TCL_OK;
   198    198   }
   199    199   
   200    200   /*
   201    201   ** Stop a thread.
   202    202   */
   203         -static void stop_thread(Thread *p){
   204         -  thread_wait(p);
          203  +static void test_stop_thread(Thread *p){
          204  +  test_thread_wait(p);
   205    205     p->xOp = 0;
   206    206     p->opnum++;
   207         -  thread_wait(p);
          207  +  test_thread_wait(p);
   208    208     sqlite3_free(p->zArg);
   209    209     p->zArg = 0;
   210    210     sqlite3_free(p->zFilename);
   211    211     p->zFilename = 0;
   212    212     p->busy = 0;
   213    213   }
   214    214   
................................................................................
   229    229     if( argc!=2 ){
   230    230       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
   231    231          " ID", 0);
   232    232       return TCL_ERROR;
   233    233     }
   234    234     if( argv[1][0]=='*' && argv[1][1]==0 ){
   235    235       for(i=0; i<N_THREAD; i++){
   236         -      if( threadset[i].busy ) stop_thread(&threadset[i]);
          236  +      if( threadset[i].busy ) test_stop_thread(&threadset[i]);
   237    237       }
   238    238     }else{
   239    239       i = parse_thread_id(interp, argv[1]);
   240    240       if( i<0 ) return TCL_ERROR;
   241    241       if( !threadset[i].busy ){
   242    242         Tcl_AppendResult(interp, "no such thread", 0);
   243    243         return TCL_ERROR;
   244    244       }
   245         -    stop_thread(&threadset[i]);
          245  +    test_stop_thread(&threadset[i]);
   246    246     }
   247    247     return TCL_OK;
   248    248   }
   249    249   
   250    250   /*
   251    251   ** Usage: thread_argc  ID
   252    252   **
................................................................................
   269    269     }
   270    270     i = parse_thread_id(interp, argv[1]);
   271    271     if( i<0 ) return TCL_ERROR;
   272    272     if( !threadset[i].busy ){
   273    273       Tcl_AppendResult(interp, "no such thread", 0);
   274    274       return TCL_ERROR;
   275    275     }
   276         -  thread_wait(&threadset[i]);
          276  +  test_thread_wait(&threadset[i]);
   277    277     sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", threadset[i].argc);
   278    278     Tcl_AppendResult(interp, zBuf, 0);
   279    279     return TCL_OK;
   280    280   }
   281    281   
   282    282   /*
   283    283   ** Usage: thread_argv  ID   N
................................................................................
   302    302     i = parse_thread_id(interp, argv[1]);
   303    303     if( i<0 ) return TCL_ERROR;
   304    304     if( !threadset[i].busy ){
   305    305       Tcl_AppendResult(interp, "no such thread", 0);
   306    306       return TCL_ERROR;
   307    307     }
   308    308     if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;
   309         -  thread_wait(&threadset[i]);
          309  +  test_thread_wait(&threadset[i]);
   310    310     if( n<0 || n>=threadset[i].argc ){
   311    311       Tcl_AppendResult(interp, "column number out of range", 0);
   312    312       return TCL_ERROR;
   313    313     }
   314    314     Tcl_AppendResult(interp, threadset[i].argv[n], 0);
   315    315     return TCL_OK;
   316    316   }
................................................................................
   338    338     i = parse_thread_id(interp, argv[1]);
   339    339     if( i<0 ) return TCL_ERROR;
   340    340     if( !threadset[i].busy ){
   341    341       Tcl_AppendResult(interp, "no such thread", 0);
   342    342       return TCL_ERROR;
   343    343     }
   344    344     if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;
   345         -  thread_wait(&threadset[i]);
          345  +  test_thread_wait(&threadset[i]);
   346    346     if( n<0 || n>=threadset[i].argc ){
   347    347       Tcl_AppendResult(interp, "column number out of range", 0);
   348    348       return TCL_ERROR;
   349    349     }
   350    350     Tcl_AppendResult(interp, threadset[i].colv[n], 0);
   351    351     return TCL_OK;
   352    352   }
................................................................................
   373    373     }
   374    374     i = parse_thread_id(interp, argv[1]);
   375    375     if( i<0 ) return TCL_ERROR;
   376    376     if( !threadset[i].busy ){
   377    377       Tcl_AppendResult(interp, "no such thread", 0);
   378    378       return TCL_ERROR;
   379    379     }
   380         -  thread_wait(&threadset[i]);
          380  +  test_thread_wait(&threadset[i]);
   381    381     zName = sqlite3ErrName(threadset[i].rc);
   382    382     Tcl_AppendResult(interp, zName, 0);
   383    383     return TCL_OK;
   384    384   }
   385    385   
   386    386   /*
   387    387   ** Usage: thread_error  ID
................................................................................
   404    404     }
   405    405     i = parse_thread_id(interp, argv[1]);
   406    406     if( i<0 ) return TCL_ERROR;
   407    407     if( !threadset[i].busy ){
   408    408       Tcl_AppendResult(interp, "no such thread", 0);
   409    409       return TCL_ERROR;
   410    410     }
   411         -  thread_wait(&threadset[i]);
          411  +  test_thread_wait(&threadset[i]);
   412    412     Tcl_AppendResult(interp, threadset[i].zErr, 0);
   413    413     return TCL_OK;
   414    414   }
   415    415   
   416    416   /*
   417    417   ** This procedure runs in the thread to compile an SQL statement.
   418    418   */
................................................................................
   448    448     }
   449    449     i = parse_thread_id(interp, argv[1]);
   450    450     if( i<0 ) return TCL_ERROR;
   451    451     if( !threadset[i].busy ){
   452    452       Tcl_AppendResult(interp, "no such thread", 0);
   453    453       return TCL_ERROR;
   454    454     }
   455         -  thread_wait(&threadset[i]);
          455  +  test_thread_wait(&threadset[i]);
   456    456     threadset[i].xOp = do_compile;
   457    457     sqlite3_free(threadset[i].zArg);
   458    458     threadset[i].zArg = sqlite3_mprintf("%s", argv[2]);
   459    459     threadset[i].opnum++;
   460    460     return TCL_OK;
   461    461   }
   462    462   
................................................................................
   501    501     }
   502    502     i = parse_thread_id(interp, argv[1]);
   503    503     if( i<0 ) return TCL_ERROR;
   504    504     if( !threadset[i].busy ){
   505    505       Tcl_AppendResult(interp, "no such thread", 0);
   506    506       return TCL_ERROR;
   507    507     }
   508         -  thread_wait(&threadset[i]);
          508  +  test_thread_wait(&threadset[i]);
   509    509     threadset[i].xOp = do_step;
   510    510     threadset[i].opnum++;
   511    511     return TCL_OK;
   512    512   }
   513    513   
   514    514   /*
   515    515   ** This procedure runs in the thread to finalize a virtual machine.
................................................................................
   543    543     }
   544    544     i = parse_thread_id(interp, argv[1]);
   545    545     if( i<0 ) return TCL_ERROR;
   546    546     if( !threadset[i].busy ){
   547    547       Tcl_AppendResult(interp, "no such thread", 0);
   548    548       return TCL_ERROR;
   549    549     }
   550         -  thread_wait(&threadset[i]);
          550  +  test_thread_wait(&threadset[i]);
   551    551     threadset[i].xOp = do_finalize;
   552    552     sqlite3_free(threadset[i].zArg);
   553    553     threadset[i].zArg = 0;
   554    554     threadset[i].opnum++;
   555    555     return TCL_OK;
   556    556   }
   557    557   
................................................................................
   575    575     }
   576    576     i = parse_thread_id(interp, argv[1]);
   577    577     if( i<0 ) return TCL_ERROR;
   578    578     if( !threadset[i].busy ){
   579    579       Tcl_AppendResult(interp, "no such thread", 0);
   580    580       return TCL_ERROR;
   581    581     }
   582         -  thread_wait(&threadset[i]);
          582  +  test_thread_wait(&threadset[i]);
   583    583     j = parse_thread_id(interp, argv[2]);
   584    584     if( j<0 ) return TCL_ERROR;
   585    585     if( !threadset[j].busy ){
   586    586       Tcl_AppendResult(interp, "no such thread", 0);
   587    587       return TCL_ERROR;
   588    588     }
   589         -  thread_wait(&threadset[j]);
          589  +  test_thread_wait(&threadset[j]);
   590    590     temp = threadset[i].db;
   591    591     threadset[i].db = threadset[j].db;
   592    592     threadset[j].db = temp;
   593    593     return TCL_OK;
   594    594   }
   595    595   
   596    596   /*
................................................................................
   616    616     }
   617    617     i = parse_thread_id(interp, argv[1]);
   618    618     if( i<0 ) return TCL_ERROR;
   619    619     if( !threadset[i].busy ){
   620    620       Tcl_AppendResult(interp, "no such thread", 0);
   621    621       return TCL_ERROR;
   622    622     }
   623         -  thread_wait(&threadset[i]);
          623  +  test_thread_wait(&threadset[i]);
   624    624     sqlite3TestMakePointerStr(interp, zBuf, threadset[i].db);
   625    625     threadset[i].db = 0;
   626    626     Tcl_AppendResult(interp, zBuf, (char*)0);
   627    627     return TCL_OK;
   628    628   }
   629    629   
   630    630   /*
................................................................................
   647    647     }
   648    648     i = parse_thread_id(interp, argv[1]);
   649    649     if( i<0 ) return TCL_ERROR;
   650    650     if( !threadset[i].busy ){
   651    651       Tcl_AppendResult(interp, "no such thread", 0);
   652    652       return TCL_ERROR;
   653    653     }
   654         -  thread_wait(&threadset[i]);
          654  +  test_thread_wait(&threadset[i]);
   655    655     assert( !threadset[i].db );
   656    656     threadset[i].db = (sqlite3*)sqlite3TestTextToPtr(argv[2]);
   657    657     return TCL_OK;
   658    658   }
   659    659   
   660    660   /*
   661    661   ** Usage: thread_stmt_get ID
................................................................................
   679    679     }
   680    680     i = parse_thread_id(interp, argv[1]);
   681    681     if( i<0 ) return TCL_ERROR;
   682    682     if( !threadset[i].busy ){
   683    683       Tcl_AppendResult(interp, "no such thread", 0);
   684    684       return TCL_ERROR;
   685    685     }
   686         -  thread_wait(&threadset[i]);
          686  +  test_thread_wait(&threadset[i]);
   687    687     sqlite3TestMakePointerStr(interp, zBuf, threadset[i].pStmt);
   688    688     threadset[i].pStmt = 0;
   689    689     Tcl_AppendResult(interp, zBuf, (char*)0);
   690    690     return TCL_OK;
   691    691   }
   692    692   
   693    693   /*