SQLite

Check-in [18680989b5]
Login

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

Overview
Comment:Fix a problem in loadext.test causing an error on OSX. This is not a real problem, just a case of the test script expecting a slightly different error message than the one returned. (CVS 6361)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 18680989b5365b0e35fadca5919dfced22433ff4
User & Date: danielk1977 2009-03-20 09:09:37.000
Context
2009-03-20
10:24
Fix a problem in thread005.test cause errors on osx. (CVS 6362) (check-in: 56e6fca1a9 user: danielk1977 tags: trunk)
09:09
Fix a problem in loadext.test causing an error on OSX. This is not a real problem, just a case of the test script expecting a slightly different error message than the one returned. (CVS 6361) (check-in: 18680989b5 user: danielk1977 tags: trunk)
2009-03-19
18:51
Fix a couple of fairly obscure cases where an assert() could fail following a malloc failure. (CVS 6360) (check-in: cc0d925669 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/loadext.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2006 July 14
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is extension loading.
#
# $Id: loadext.test,v 1.16 2008/10/13 17:09:11 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !load_ext {
  finish_test
  return













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2006 July 14
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is extension loading.
#
# $Id: loadext.test,v 1.17 2009/03/20 09:09:37 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !load_ext {
  finish_test
  return
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79

80
81
82
83
84
85
86
set dlerror_nosuchfile \
    {%s: cannot open shared object file: No such file or directory}
set dlerror_notadll    {%s: file too short}
set dlerror_nosymbol   {%s: undefined symbol: %s}

if {$::tcl_platform(os) eq "Darwin"} {
  set dlerror_nosuchfile {dlopen(%s, 10): image not found}
  set dlerror_notadll    {dlopen(%1$s, 10): no suitable image found.  Did find:
	%1$s: file to short}
  set dlerror_nosymbol   {dlsym(XXX, %2$s): symbol not found}
}

# Make sure the test extension actually exists.  If it does not
# exist, try to create it.  If unable to create it, then skip this
# test file.
#
if {![file exists $testextension]} {
  set srcdir [file dir $testdir]/src
  set testextsrc $srcdir/test_loadext.c
  if {[catch {

    exec gcc {*}[set gcc_shared] -Wall -I$srcdir -I. -g $testextsrc -o $testextension
  } msg]} {

    puts "Skipping loadext tests: Test extension not built..."
    puts $msg
    finish_test
    return
  }
}








|
<










|
>
|
|
>







58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
set dlerror_nosuchfile \
    {%s: cannot open shared object file: No such file or directory}
set dlerror_notadll    {%s: file too short}
set dlerror_nosymbol   {%s: undefined symbol: %s}

if {$::tcl_platform(os) eq "Darwin"} {
  set dlerror_nosuchfile {dlopen(%s, 10): image not found}
  set dlerror_notadll    {dlopen(%1$s, 10): no suitable image found.*}

  set dlerror_nosymbol   {dlsym(XXX, %2$s): symbol not found}
}

# Make sure the test extension actually exists.  If it does not
# exist, try to create it.  If unable to create it, then skip this
# test file.
#
if {![file exists $testextension]} {
  set srcdir [file dir $testdir]/src
  set testextsrc $srcdir/test_loadext.c

  set cmdline [concat exec gcc $gcc_shared]
  lappend cmdline -Wall -I$srcdir -I. -g $testextsrc -o $testextension
  
  if {[catch $cmdline msg]} {
    puts "Skipping loadext tests: Test extension not built..."
    puts $msg
    finish_test
    return
  }
}

145
146
147
148
149
150
151

152
153
154
155
156
157
158
159
160
do_test loadext-2.2 {
  set fd [open "${testextension}xx" w]
  puts $fd blah
  close $fd
  set rc [catch {
    sqlite3_load_extension db "${testextension}xx"
  } msg]

  list $rc $msg
} [list 1 [format $dlerror_notadll ${testextension}xx]]

# Try to load an extension for which the file is present but the
# entry point is not.
#
do_test loadext-2.3 {
  set rc [catch {
    sqlite3_load_extension db $testextension icecream







>
|
|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
do_test loadext-2.2 {
  set fd [open "${testextension}xx" w]
  puts $fd blah
  close $fd
  set rc [catch {
    sqlite3_load_extension db "${testextension}xx"
  } msg]
  set expected_error_pattern [format $dlerror_notadll ${testextension}xx]
  list $rc [string match $expected_error_pattern $msg]
} [list 1 1]

# Try to load an extension for which the file is present but the
# entry point is not.
#
do_test loadext-2.3 {
  set rc [catch {
    sqlite3_load_extension db $testextension icecream