Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit da06c90

Browse files
committed
[[ Tests ]] Allow database tests to run on mac
1 parent 821080c commit da06c90

File tree

3 files changed

+45
-7
lines changed

3 files changed

+45
-7
lines changed

tests/_testlib.livecodescript

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,29 @@ on TestLoadExternal pExternal
355355
local tEnginePath
356356
put specialfolderpath("engine") into tEnginePath
357357

358+
local tExternalsPath, tExtension
359+
set the itemdelimiter to slash
358360
if the platform is "MacOS" then
359-
set the externals of the templateStack to tEnginePath & slash & pExternal & ".bundle"
361+
put item 1 to -4 of tEnginePath into tExternalsPath
362+
put "bundle" into tExtension
360363
else if the platform is "linux" then
361-
set the externals of the templateStack to tEnginePath & slash & pExternal & ".so"
364+
put tEnginePath into tExternalsPath
365+
put "so" into tExtension
362366
end if
363367

368+
set the externals of the templateStack to tExternalsPath & slash & \
369+
pExternal & "." & tExtension
370+
364371
create stack pExternal && "External"
365372
start using it
366373
if the externalCommands of it is empty then
367374
write "Cannot load external" && pExternal & return to stderr
375+
quit 1
376+
end if
377+
378+
-- Ensure drivers can be found
379+
if pExternal is "revdb" then
380+
revSetDatabaseDriverPath tExternalsPath
368381
end if
369382
end TestLoadExternal
370383

@@ -562,6 +575,27 @@ private function __MeetsRequirements pRequirement, pOptions
562575
return the platform is not "HTML5"
563576
case "write"
564577
return the platform is not "HTML5" and ("disk" is in the securityPermissions or the secureMode is false)
578+
case "ui"
579+
return not (the environment ends with "command line")
580+
case "desktop"
581+
return the platform is among the items of "MacOS,Win32,Linux"
582+
case "mobile"
583+
return the platform is among the items of "Android,iOS"
584+
case "external"
585+
-- TODO: make externals tests work in standalone test builder
586+
if TestIsInStandalone() then
587+
return false
588+
end if
589+
return the platform is not "HTML5"
590+
case "database"
591+
if not __MeetsRequirements("external", "revdb") then
592+
return false
593+
end if
594+
if "odbc" is among the items of pOptions or \
595+
"postgresql" is among the items of pOptions then
596+
return __MeetsRequirements("desktop")
597+
end if
598+
return the platform is not "HTML5"
565599
end switch
566600
return true
567601
end __MeetsRequirements

tests/lcs/core/database/db_getters.livecodescript

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ command createTables pConnection, pStrings
3939
end createTables
4040

4141
on TestDBTableGettersMySQL
42-
TestSkip "skipping DB test","cannot use revOpenDatabase"
42+
TestSkip "skipping DB test", "cannot use mysql in database tests"
4343
exit TestDBTableGettersMySQL
44+
45+
TestSkipIfNot "database", "mysql"
46+
47+
TestLoadExternal "revdb"
48+
4449
local tArray
4550
put generateStrings() into tArray
46-
local tDatabaseID, tNames
51+
local tDatabaseID, tNames
4752
put revOpenDatabase("mysql","localhost","t2","root","test_password",false,"/tmp/mysql.sock",10,true) into tDatabaseID
4853
createTables(tDatabaseID, tArray)
4954
put revDatabaseTableNames(tDatabaseID) into tNames

tests/lcs/core/database/sqlite_binary_insert.livecodescript

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ private function __retrBinaryData pTable, pData
5050
end __retrBinaryData
5151

5252
on TestSetup
53-
if the platform is not "linux" then
54-
return "SKIP database tests can only be run on Linux"
55-
end if
53+
TestSkipIfNot "database", "sqlite"
54+
TestSkipIfNot "external", "revsecurity"
5655

5756
TestLoadExternal "revdb"
5857

0 commit comments

Comments
 (0)