/ Check-in [189cd854]
Login

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

Overview
Comment:Changes to loadext.test so that it works on osx as well as linux. (CVS 5329)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 189cd85413a2e00696752bb82e7a442e86e621ac
User & Date: danielk1977 2008-06-30 15:09:29
Context
2008-06-30
18:12
Call the query flattener while processing the parent query. Previously, it was called while processing the sub-queries. (CVS 5330) check-in: 6fcb3bff user: danielk1977 tags: trunk
15:09
Changes to loadext.test so that it works on osx as well as linux. (CVS 5329) check-in: 189cd854 user: danielk1977 tags: trunk
10:16
Fix a malloc() failure related problem in os_unix.c. (CVS 5328) check-in: ba8819a6 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqlite3ext.h.

    11     11   *************************************************************************
    12     12   ** This header file defines the SQLite interface for use by
    13     13   ** shared libraries that want to be imported as extensions into
    14     14   ** an SQLite instance.  Shared libraries that intend to be loaded
    15     15   ** as extensions by SQLite should #include this file instead of 
    16     16   ** sqlite3.h.
    17     17   **
    18         -** @(#) $Id: sqlite3ext.h,v 1.23 2008/06/27 00:52:45 drh Exp $
           18  +** @(#) $Id: sqlite3ext.h,v 1.24 2008/06/30 15:09:29 danielk1977 Exp $
    19     19   */
    20     20   #ifndef _SQLITE3EXT_H_
    21     21   #define _SQLITE3EXT_H_
    22     22   #include "sqlite3.h"
    23     23   
    24     24   typedef struct sqlite3_api_routines sqlite3_api_routines;
    25     25   
................................................................................
   362    362   #define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
   363    363   #define sqlite3_limit                  sqlite3_api->limit
   364    364   #define sqlite3_next_stmt              sqlite3_api->next_stmt
   365    365   #define sqlite3_sql                    sqlite3_api->sql
   366    366   #define sqlite3_status                 sqlite3_api->status
   367    367   #endif /* SQLITE_CORE */
   368    368   
   369         -#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api;
          369  +#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;
   370    370   #define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;
   371    371   
   372    372   #endif /* _SQLITE3EXT_H_ */

Changes to test/loadext.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is extension loading.
    13     13   #
    14         -# $Id: loadext.test,v 1.12 2008/06/19 15:44:00 drh Exp $
           14  +# $Id: loadext.test,v 1.13 2008/06/30 15:09:29 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   ifcapable !load_ext {
    20     20     finish_test
    21     21     return
................................................................................
    24     24   # The name of the test extension varies by operating system.
    25     25   #
    26     26   if {$::tcl_platform(platform) eq "windows"} {
    27     27     set testextension ./testloadext.dll
    28     28   } else {
    29     29     set testextension ./libtestloadext.so
    30     30   }
           31  +set gcc_shared -shared
           32  +if {$::tcl_platform(os) eq "Darwin"} {
           33  +  set gcc_shared -dynamiclib
           34  +}
    31     35   
    32     36   # The error messages tested by this file are operating system dependent
    33     37   # (because they are returned by sqlite3OsDlError()). For now, they only
    34     38   # work with UNIX (and probably only certain kinds of UNIX).
    35     39   #
    36     40   # When a shared-object cannot be opened because it does not exist, the
    37     41   # format of the message returned is:
................................................................................
    51     55   # The exact error messages are not important. The important bit is
    52     56   # that SQLite is correctly copying the message from xDlError().
    53     57   #
    54     58   set dlerror_nosuchfile \
    55     59       {%s: cannot open shared object file: No such file or directory}
    56     60   set dlerror_notadll    {%s: file too short}
    57     61   set dlerror_nosymbol   {%s: undefined symbol: %s}
           62  +
           63  +if {$::tcl_platform(os) eq "Darwin"} {
           64  +  set dlerror_nosuchfile {dlopen(%s, 10): image not found}
           65  +  set dlerror_notadll    {dlopen(%1$s, 10): no suitable image found.  Did find:
           66  +	%1$s: file to short}
           67  +  set dlerror_nosymbol   {dlsym(XXX, %2$s): symbol not found}
           68  +}
    58     69   
    59     70   # Make sure the test extension actually exists.  If it does not
    60     71   # exist, try to create it.  If unable to create it, then skip this
    61     72   # test file.
    62     73   #
    63     74   if {![file exists $testextension]} {
    64     75     set srcdir [file dir $testdir]/src
    65     76     set testextsrc $srcdir/test_loadext.c
    66     77     if {[catch {
    67         -    exec gcc -Wall -I$srcdir -I. -g -shared $testextsrc -o $testextension
           78  +    exec gcc $gcc_shared -Wall -I$srcdir -I. -g $testextsrc -o $testextension
    68     79     } msg]} {
    69     80       puts "Skipping loadext tests: Test extension not built..."
    70     81       puts $msg
    71     82       finish_test
    72     83       return
    73     84     }
    74     85   }
................................................................................
   144    155   # Try to load an extension for which the file is present but the
   145    156   # entry point is not.
   146    157   #
   147    158   do_test loadext-2.3 {
   148    159     set rc [catch {
   149    160       sqlite3_load_extension db $testextension icecream
   150    161     } msg]
          162  +  if {$::tcl_platform(os) eq "Darwin"} {
          163  +    regsub {0x[1234567890abcdefABCDEF]*} $msg XXX msg
          164  +  }
   151    165     list $rc $msg
   152    166   } [list 1 [format $dlerror_nosymbol $testextension icecream]]
   153    167   
   154    168   # Try to load an extension for which the entry point fails (returns non-zero) 
   155    169   #
   156    170   do_test loadext-2.4 {
   157    171     set rc [catch {
................................................................................
   169    183   sqlite3_enable_load_extension db 1
   170    184   do_test loadext-3.1 {
   171    185     catchsql {
   172    186       SELECT half(5);
   173    187     }
   174    188   } {1 {no such function: half}}
   175    189   do_test loadext-3.2 {
   176         -  catchsql {
          190  +  set res [catchsql {
   177    191       SELECT load_extension($::testextension)
          192  +  }]
          193  +  if {$::tcl_platform(os) eq "Darwin"} {
          194  +    regsub {0x[1234567890abcdefABCDEF]*} $res XXX res
   178    195     }
          196  +  set res
   179    197   } [list 1 [format $dlerror_nosymbol $testextension sqlite3_extension_init]]
   180    198   do_test loadext-3.3 {
   181    199     catchsql {
   182    200       SELECT load_extension($::testextension,'testloadext_init')
   183    201     }
   184    202   } {0 {{}}}
   185    203   do_test loadext-3.4 {