Index: Tests/basic.eagle ================================================================== --- Tests/basic.eagle +++ Tests/basic.eagle @@ -61,20 +61,31 @@ testExec winForms} -result {0 {}}} ############################################################################### runTest {test data-1.2 {unit tests from the 'testlinq' project} -setup { + proc getTestLinqOutFileName { encodingName } { + global testLinqExeFile + global testLinqOutUtf8File + + if {[regexp -nocase -- {^utf(?:-)?8$} $encodingName]} then { + return $testLinqOutUtf8File + } else { + return $testLinqExeFile + } + } + copySampleDatabaseFiles # # NOTE: We need to make 100% sure that the console output encoding is the # same as when the 'testlinq.out' file was created. # set savedEncoding [object invoke Console OutputEncoding] set encoding [object invoke System.Text.Encoding GetEncoding \ - [expr {[isDotNetCore] ? "iso-8859-1" : "Windows-1252"}]] + [getOutputEncodingName]] object invoke Console OutputEncoding $encoding } -body { set output "" @@ -85,35 +96,48 @@ tlog "---- BEGIN STDOUT OUTPUT\n" tlog $output tlog "\n---- END STDOUT OUTPUT\n" - list $code [string equal $output [readFile $testLinqOutFile]] \ - [expr {$code == 0 ? "" : $error}] + list $code [string equal $output [readFile [getTestLinqOutFileName \ + [getOutputEncodingName]]]] [expr {$code == 0 ? "" : $error}] } -cleanup { catch {object invoke Console OutputEncoding $savedEncoding} catch {info previouspid true} unset -nocomplain code output error savedEncoding encoding + + rename getTestLinqOutFileName "" } -constraints \ {eagle command.object monoToDo SQLite file_System.Data.SQLite.dll\ file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db\ file_testlinq.out testExec} -result {0 True {}}} ############################################################################### runTest {test data-1.3 {unit tests from the 'testef6' project} -setup { + proc getTestLinqOutFileName { encodingName } { + global testLinqExeFile + global testLinqOutUtf8File + + if {[regexp -nocase -- {^utf(?:-)?8$} $encodingName]} then { + return $testLinqOutUtf8File + } else { + return $testLinqExeFile + } + } + copySampleDatabaseFiles # # NOTE: We need to make 100% sure that the console output encoding is the # same as when the 'testlinq.out' file was created. # set savedEncoding [object invoke Console OutputEncoding] set encoding [object invoke System.Text.Encoding GetEncoding \ - [expr {[isDotNetCore] ? "iso-8859-1" : "Windows-1252"}]] + [getOutputEncodingName]] object invoke Console OutputEncoding $encoding } -body { set output "" @@ -124,17 +148,19 @@ tlog "---- BEGIN STDOUT OUTPUT\n" tlog $output tlog "\n---- END STDOUT OUTPUT\n" - list $code [string equal $output [readFile $testLinqOutFile]] \ - [expr {$code == 0 ? "" : $error}] + list $code [string equal $output [readFile [getTestLinqOutFileName \ + [getOutputEncodingName]]]] [expr {$code == 0 ? "" : $error}] } -cleanup { catch {object invoke Console OutputEncoding $savedEncoding} catch {info previouspid true} unset -nocomplain code output error savedEncoding encoding + + rename getTestLinqOutFileName "" } -constraints \ {eagle command.object monoToDo SQLite file_EntityFramework.dll\ file_System.Data.SQLite.dll file_System.Data.SQLite.EF6.dll file_testef6.exe\ file_northwindEF.db file_testlinq.out testExec} -result {0 True {}}} Index: lib/System.Data.SQLite/common.eagle ================================================================== --- lib/System.Data.SQLite/common.eagle +++ lib/System.Data.SQLite/common.eagle @@ -2704,10 +2704,32 @@ return [list \ [sql execute -execute scalar $db "PRAGMA page_size;"] \ [sql execute -execute scalar $db "PRAGMA cache_size;"]] } + + proc getOutputEncodingName {} { + # + # HACK: Account for differences between Console output encodings on + # the .NET Framework versus .NET Core, on Windows and POSIX. + # Mono is not supported by this procedure as it is only used + # by tests that do not run on Mono. + # + if {[isDotNetCore]} then { + if {[isWindows]} then { + # + # TODO: The reported output encoding for the Console on Windows + # is actually "Codepage - 437". Why? + # + return iso-8859-1 + } else { + return utf-8 + } + } else { + return Windows-1252 + } + } proc normalizeExceptionMessage { value } { if {[string length $value] == 0} then {return $value} return [string map [list \r\n " ==> " \n " ==> "] $value] } @@ -4907,19 +4929,26 @@ test.exe.mda.config testlinq.exe.mda.config \ testef6.exe.mda.config] # # NOTE: Build the list of external files that we handle. Some of - # these files may be native and/or managed assemblies that are - # required to perform various tests. - # - set externalFileNames [list \ - [file join EntityFramework lib [string map [list Fx ""] \ - [string map [list netFx451 netFx45 netFx452 netFx45 netFx46 \ - netFx45 netFx461 netFx45 netFx462 netFx45 netFx47 netFx45 \ - netFx471 netFx45 netFx472 netFx45] [getBuildNetFx]]] \ - EntityFramework.dll]] + # these files may be native and/or managed assemblies that + # are required to perform various tests. + # + if {[isDotNetCore]} then { + set externalFileNames [list \ + [file join EntityFramework lib [string map [list \ + netStandard21 netstandard2.1] [getBuildNetFx]] \ + EntityFramework.dll]] + } else { + set externalFileNames [list \ + [file join EntityFramework lib [string map [list \ + Fx ""] [string map [list netFx451 netFx45 netFx452 \ + netFx45 netFx46 netFx45 netFx461 netFx45 netFx462 \ + netFx45 netFx47 netFx45 netFx471 netFx45 netFx472 \ + netFx45] [getBuildNetFx]]] EntityFramework.dll]] + } # # NOTE: Build the list of native assembly files that we handle. # set nativeFileNames [list] @@ -5801,10 +5830,13 @@ # NOTE: Setup the variables that refer to the various data files # required by the tests in this file. # set testLinqOutFile [file nativename [file join \ [getSQLiteTestDataPath] testlinq.out]] + + set testLinqOutUtf8File [file nativename [file join \ + [getSQLiteTestDataPath] testlinq-utf8.out]] set northwindEfDbFile [file nativename [file join \ [file dirname [file dirname [getSQLiteTestDataPath]]] \ testlinq northwindEF.db]] @@ -5916,10 +5948,15 @@ if {![haveConstraint [appendArgs file_ \ [file tail $testLinqOutFile]]]} then { checkForFile $test_channel $testLinqOutFile } + + if {![haveConstraint [appendArgs file_ \ + [file tail $testLinqOutUtf8File]]]} then { + checkForFile $test_channel $testLinqOutUtf8File + } if {![haveConstraint [appendArgs file_ \ [file tail $northwindEfDbFile]]]} then { checkForFile $test_channel $northwindEfDbFile } @@ -6023,11 +6060,11 @@ testInstallVs2015LogFile testInstallVs2013LogFile \ testInstallVs2012LogFile testInstallVs2010LogFile \ testInstallVs2008LogFile testInstallVs2005LogFile unset -nocomplain \ - northwindEfDbFile testLinqOutFile \ + northwindEfDbFile testLinqOutUtf8File testLinqOutFile \ walDbFile nonWalDbFile unset -nocomplain \ testEf6ExeFile testLinqExeFile \ testExeFile systemDataSQLiteEf6DllFile \