System.Data.SQLite

Check-in [a030a6c1db]
Login

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

Overview
Comment:Modify unit test infrastructure to work on Mono. Also, fix link in test procedures web page.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a030a6c1db12717d55cc1ca92775d5dbc5979d0e
User & Date: mistachkin 2011-10-03 02:23:42.197
Context
2011-10-03
02:27
Web page typo fix. check-in: 1bd067dda7 user: mistachkin tags: trunk
02:23
Modify unit test infrastructure to work on Mono. Also, fix link in test procedures web page. check-in: a030a6c1db user: mistachkin tags: trunk
00:51
Fix test for ticket [b4a7ddc83f] by making sure the SQLite core library is shutdown prior to running the tests. Also, more updates to test procedures web page. check-in: 26b210729a user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Externals/Eagle/lib/Eagle1.0/init.eagle.
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
    if {[isMono]} then {
      lappend command mono \
          [appendArgs \" [file nativename [info nameofexecutable]] \"]
    } else {
      lappend command [info nameofexecutable]
    }

    eval lappend command $args

    return [uplevel 1 $command]
  }

  proc ldifference { list1 list2 } {
    set result [list]








|







560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
    if {[isMono]} then {
      lappend command mono \
          [appendArgs \" [file nativename [info nameofexecutable]] \"]
    } else {
      lappend command [info nameofexecutable]
    }

    if {[llength $args] > 0} then {eval lappend command $args}

    return [uplevel 1 $command]
  }

  proc ldifference { list1 list2 } {
    set result [list]

Changes to Externals/Eagle/lib/Eagle1.0/test.eagle.
374
375
376
377
378
379
380













381












382
383
384
385
386
387
388

  proc testExec { commandName options args } {
    set command [list exec]

    if {[llength $options] > 0} then {eval lappend command $options}

    lappend command -- $commandName













    eval lappend command $args













    tputs $::test_channel [appendArgs "---- running command: " $command \n]

    return [uplevel 1 $command]
  }

  proc execTestShell { options args } {







>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413

  proc testExec { commandName options args } {
    set command [list exec]

    if {[llength $options] > 0} then {eval lappend command $options}

    lappend command -- $commandName

    if {[llength $args] > 0} then {eval lappend command $args}

    tputs $::test_channel [appendArgs "---- running command: " $command \n]

    return [uplevel 1 $command]
  }

  proc testClrExec { commandName options args } {
    set command [list exec]

    if {[llength $options] > 0} then {eval lappend command $options}

    lappend command --

    #
    # HACK: Assume that Mono is somewhere along the PATH.
    #
    if {[isMono]} then {
      lappend command mono \
          [appendArgs \" [file nativename $commandName] \"]
    } else {
      lappend command $commandName
    }

    if {[llength $args] > 0} then {eval lappend command $args}

    tputs $::test_channel [appendArgs "---- running command: " $command \n]

    return [uplevel 1 $command]
  }

  proc execTestShell { options args } {
Changes to Tests/basic.eagle.
50
51
52
53
54
55
56


57
58
59
60
61
62
63
64
65
}

###############################################################################

runTest {test basic-1.1 {unit tests from the 'test' project} -setup {
  catch {file delete [file join [file dirname $testExeFile] Test.db3]}
} -body {


  set code [catch {
    testExec $testExeFile [list -eventflags Wait -directory \
    [file dirname $testExeFile] -stdout output -success 0] -autoRun
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"








>
>

|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
}

###############################################################################

runTest {test basic-1.1 {unit tests from the 'test' project} -setup {
  catch {file delete [file join [file dirname $testExeFile] Test.db3]}
} -body {
  set output ""

  set code [catch {
    testClrExec $testExeFile [list -eventflags Wait -directory \
    [file dirname $testExeFile] -stdout output -success 0] -autoRun
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

83
84
85
86
87
88
89


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107
108
109
110
111
112
  #       same as when the 'testlinq.out' file was created.
  #
  set savedEncoding [object invoke Console OutputEncoding]
  set encoding [object invoke System.Text.Encoding GetEncoding Windows-1252]

  object invoke Console OutputEncoding $encoding
} -body {


  set code [catch {
    testExec $testLinqExeFile [list -eventflags Wait -directory \
    [file dirname $testLinqExeFile] -stdout output -success 0]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [string equal $output [readFile $testLinqOutFile]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}

  unset -nocomplain code output error savedEncoding encoding

} -constraints {eagle file_testlinq.exe file_northwindEF.db file_testlinq.out} \
-result {0 True {}}}

###############################################################################

runTest {test basic-1.3 {SELECT scalar/reader, CREATE, INSERT} -setup {
  setupDb [set fileName basic-1.3.db]
} -body {







>
>

|













>
|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  #       same as when the 'testlinq.out' file was created.
  #
  set savedEncoding [object invoke Console OutputEncoding]
  set encoding [object invoke System.Text.Encoding GetEncoding Windows-1252]

  object invoke Console OutputEncoding $encoding
} -body {
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
    [file dirname $testLinqExeFile] -stdout output -success 0]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [string equal $output [readFile $testLinqOutFile]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}

  unset -nocomplain code output error savedEncoding encoding
} -constraints \
{eagle monoToDo file_testlinq.exe file_northwindEF.db file_testlinq.out} \
-result {0 True {}}}

###############################################################################

runTest {test basic-1.3 {SELECT scalar/reader, CREATE, INSERT} -setup {
  setupDb [set fileName basic-1.3.db]
} -body {
Changes to Tests/common.eagle.
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
        # NOTE: Return the full path of the loaded file.
        #
        return $fileName
      }

      return ""
    }
  
    proc enumerableToList { enumerable } {
      set result [list]

      if {[string length $enumerable] == 0 || $enumerable eq "null"} then {
        return $result
      }








|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
        # NOTE: Return the full path of the loaded file.
        #
        return $fileName
      }

      return ""
    }

    proc enumerableToList { enumerable } {
      set result [list]

      if {[string length $enumerable] == 0 || $enumerable eq "null"} then {
        return $result
      }

Changes to Tests/tkt-00f86f9739.eagle.
41
42
43
44
45
46
47


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

###############################################################################

runTest {test tkt-00f86f9739-1.1 {LINQ with StartsWith} -body {
  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {


    set code [catch {
      testExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -startsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result value
} -constraints {eagle file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS FOLKO GALED KOENE LILAS MAGAA\
MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0 {}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue







>
>

|




















|











41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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

###############################################################################

runTest {test tkt-00f86f9739-1.1 {LINQ with StartsWith} -body {
  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -startsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result value
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS FOLKO GALED KOENE LILAS MAGAA\
MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0 {}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-59edc1018b.eagle.
41
42
43
44
45
46
47


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

###############################################################################

runTest {test tkt-59edc1018b-1.1 {LINQ with EndsWith} -body {
  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {


    set code [catch {
      testExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -endsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result value
} -constraints {eagle file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {FURIB GALED GODOS LAZYK LINOD PRINI REGGC WOLZA} 0 {} 0 ERNSH 0 {} 0\
{AROUT BSBEV CONSH EASTC NORTS SEVES} 0 {}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue







>
>

|




















|











41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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

###############################################################################

runTest {test tkt-59edc1018b-1.1 {LINQ with EndsWith} -body {
  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -endsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result value
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {FURIB GALED GODOS LAZYK LINOD PRINI REGGC WOLZA} 0 {} 0 ERNSH 0 {} 0\
{AROUT BSBEV CONSH EASTC NORTS SEVES} 0 {}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-8554170e09.eagle.
46
47
48
49
50
51
52
53
54
55
56
57
58
  set result [sql execute -execute reader -format list $db \
    "SELECT x, y FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} \
-returnCodes 1 -match glob -result {*.SQLiteConvert.ToDateTime(*}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue







|





46
47
48
49
50
51
52
53
54
55
56
57
58
  set result [sql execute -execute reader -format list $db \
    "SELECT x, y FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} \
-returnCodes 1 -match glob -result {*.SQLiteConvert.ToDateTime*}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-8b7d179c3c.eagle.
41
42
43
44
45
46
47


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

###############################################################################

runTest {test tkt-8b7d179c3c-1.1 {LINQ with Skip and Take} -body {
  set result [list]

  for {set pageSize 0} {$pageSize <= 2} {incr pageSize} {


    set code [catch {
      testExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -skip $pageSize
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result pageSize
} -constraints {eagle file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE MAISD\
FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK HUNGC GREAL\
LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG FURIB PRINI\
AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY BLAUS BONAP\
MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH PARIS SPECD\
LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS COMMI FAMIA\
QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB LACOR LAZYK\







>
>

|




















|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

###############################################################################

runTest {test tkt-8b7d179c3c-1.1 {LINQ with Skip and Take} -body {
  set result [list]

  for {set pageSize 0} {$pageSize <= 2} {incr pageSize} {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -skip $pageSize
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result pageSize
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE MAISD\
FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK HUNGC GREAL\
LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG FURIB PRINI\
AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY BLAUS BONAP\
MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH PARIS SPECD\
LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS COMMI FAMIA\
QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB LACOR LAZYK\
Changes to Tests/tkt-ccfa69fc32.eagle.
41
42
43
44
45
46
47


48
49
50
51
52
53
54
55
56
57
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

###############################################################################

runTest {test tkt-ccfa69fc32-1.1 {Entity Framework / Transaction Scope} -body {
  set result [list]

  foreach add [list false true false] {


    set code [catch {
      testExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -efTransaction $add
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result add
} -constraints {eagle file_testlinq.exe file_northwindEF.db} -match glob \
-result {0 {1581 1730 1833 2116 2139} 0 {System.Data.UpdateException: * --->\
System.Data.SQLite.SQLiteException: Abort due to constraint violation
PRIMARY KEY must be unique
*} 0 {1 2 3 4 5 6 7 8 9 10 1576 1577 1578 1579 1580 1581 1730 1833 2116 2139}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue







>
>

|




















|
|












41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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

###############################################################################

runTest {test tkt-ccfa69fc32-1.1 {Entity Framework / Transaction Scope} -body {
  set result [list]

  foreach add [list false true false] {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -efTransaction $add
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result add
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -match \
glob -result {0 {1581 1730 1833 2116 2139} 0 {System.Data.UpdateException: * --->\
System.Data.SQLite.SQLiteException: Abort due to constraint violation
PRIMARY KEY must be unique
*} 0 {1 2 3 4 5 6 7 8 9 10 1576 1577 1578 1579 1580 1581 1730 1833 2116 2139}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to www/test.wiki.
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  Follow these steps to unit test the System.Data.SQLite (SDS) binaries.
  Unless otherwise noted, all steps need to be done in the order specified.
</p>

<p>
  First, you will need a full source check-out for the System.Data.SQLite
  project, including the
  &quot;<a href="/dir?name=Externals/Eagle">Externals\Eagle</a>&quot;
  directory.
</p>

<p>
  The binaries to test must be [./build.wiki | built] or
  [./downloads.wiki | downloaded].  If the binaries are downloaded, they must be
  placed in the appropriate build output directory (e.g.







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  Follow these steps to unit test the System.Data.SQLite (SDS) binaries.
  Unless otherwise noted, all steps need to be done in the order specified.
</p>

<p>
  First, you will need a full source check-out for the System.Data.SQLite
  project, including the
  &quot;<a href="/index.html/dir?name=Externals/Eagle">Externals\Eagle</a>&quot;
  directory.
</p>

<p>
  The binaries to test must be [./build.wiki | built] or
  [./downloads.wiki | downloaded].  If the binaries are downloaded, they must be
  placed in the appropriate build output directory (e.g.