forked from yanghuan/CSharp.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
229 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
local traceback | ||
if arg[1] == "nodebug" then | ||
traceback = debug.traceback | ||
debug = nil | ||
else | ||
require("strict") | ||
end | ||
|
||
package.path = package.path .. ";../../../CSharp.lua/Coresystem.lua/?.lua" | ||
package.path = package.path .. ";../?.lua" | ||
|
||
package.path = package.path .. ";CSharp.lua/Coresystem.lua/?.lua" | ||
package.path = package.path .. ";test/BridgeNetTests/?.lua;" | ||
|
||
local now = 0 | ||
local timeoutQueue | ||
|
||
local conf = { | ||
traceback = traceback, | ||
setTimeout = function (f, delay) | ||
if not timeoutQueue then | ||
timeoutQueue = System.TimeoutQueue() | ||
end | ||
return timeoutQueue:Add(now, delay, f) | ||
end, | ||
clearTimeout = function (t) | ||
timeoutQueue:Erase(t) | ||
end | ||
} | ||
require("All")("", conf) -- coresystem.lua/All.lua | ||
|
||
local modules = { | ||
"BridgeAttributes", | ||
"BridgeTestNUnit", | ||
"ClientTestHelper", | ||
"Batch1", | ||
"Tests" | ||
} | ||
|
||
for i = 1, #modules do | ||
local name = modules[i] | ||
require(name .. "/out/manifest")(name .. "/out") | ||
end | ||
|
||
collectgarbage("collect") | ||
print(collectgarbage("count")) | ||
|
||
local main = System.Reflection.Assembly.GetEntryAssembly():getEntryPoint() | ||
main:Invoke() | ||
|
||
if timeoutQueue then | ||
while true do | ||
local nextExpiration = timeoutQueue:getNextExpiration() | ||
if nextExpiration ~= timeoutQueue.MaxExpiration then | ||
now = nextExpiration | ||
timeoutQueue:RunLoop(now) | ||
else | ||
break | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
require("run") | ||
|
||
local function src(module) | ||
return ("../%s/src"):format(module) | ||
end | ||
|
||
local function out(module) | ||
return ("../%s/out"):format(module) | ||
end | ||
|
||
local function lib(module) | ||
return ("../%s/bin/Debug/netcoreapp3.0/%s.dll!"):format(module, module) | ||
end | ||
|
||
local function libs(...) | ||
local t = {} | ||
for i = 1, select("#", ...) do | ||
t[i] = lib(select(i, ...)) | ||
end | ||
return table.concat(t, ';') | ||
end | ||
|
||
run { | ||
{ | ||
depth = 3, | ||
input = src("BridgeAttributes"), | ||
output = out("BridgeAttributes"), | ||
metadata = true, | ||
module = true | ||
}, | ||
{ | ||
depth = 3, | ||
input = src("BridgeTestNUnit"), | ||
output = out("BridgeTestNUnit"), | ||
libs = lib("BridgeAttributes"), | ||
metadata = true, | ||
module = true | ||
}, | ||
{ | ||
depth = 3, | ||
input = src("ClientTestHelper"), | ||
output = out("ClientTestHelper"), | ||
libs = libs("BridgeAttributes", "BridgeTestNUnit"), | ||
metadata = true, | ||
module = true | ||
}, | ||
{ | ||
depth = 3, | ||
input = src("Batch1"), | ||
output = out("Batch1"), | ||
libs = libs("BridgeAttributes", "BridgeTestNUnit", "ClientTestHelper"), | ||
attr = true, | ||
metadata = true, | ||
module = true | ||
}, | ||
{ | ||
depth = 3, | ||
input = "src", | ||
output = "out", | ||
libs = libs("BridgeTestNUnit", "Batch1"), | ||
metadata = true, | ||
module = true | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require("run") | ||
|
||
run { | ||
depth = 2, | ||
input = "src", | ||
output = "out", | ||
libs = "Bridge/Bridge.dll", | ||
metaFiles = "Bridge/Bridge.xml", | ||
attr = "TestCase", | ||
metadata = true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
local function execute(cmd) | ||
print("execute", cmd) | ||
local code = os.execute(cmd) | ||
assert(code == 0) | ||
end | ||
|
||
local luaVersions = { | ||
"Lua5.3", | ||
"LuaJIT-2.0.2", | ||
"MoonJIT-2.2.0" | ||
} | ||
|
||
local function compile(arg) | ||
local CSharpLua = ("../"):rep(arg.depth) .. "CSharp.lua.Launcher/bin/Debug/netcoreapp3.0/CSharp.lua.Launcher.dll" | ||
local cmd = ("dotnet %s -s %s -d %s"):format(CSharpLua, arg.input, arg.output) | ||
if arg.libs then | ||
cmd = cmd .. " -l " .. arg.libs | ||
end | ||
if arg.metaFiles then | ||
cmd = cmd .. " -m " .. arg.metaFiles | ||
end | ||
if arg.attr then | ||
if arg.attr == true then | ||
cmd = cmd .. " -a" | ||
else | ||
cmd = cmd .. " -a " .. arg.attr | ||
end | ||
end | ||
if arg.metadata then | ||
cmd = cmd .. " -metadata" | ||
end | ||
if arg.classic then | ||
cmd = cmd .. " -c" | ||
end | ||
if arg.inlineProperty then | ||
cmd = cmd .. " -inline-property" | ||
end | ||
if arg.nodebug then | ||
cmd = cmd .. " -p" | ||
end | ||
if arg.module then | ||
cmd = cmd .. " -module" | ||
end | ||
if arg.extra then | ||
cmd = cmd .. " " .. arg.extra | ||
end | ||
execute(cmd) | ||
end | ||
|
||
local function launcher(arg, luaVersion) | ||
local luaPath = ("..\\"):rep(arg.depth - 1) .. "__bin\\" | ||
cmd = ("\"%s%s\\lua.exe\" %s"):format(luaPath, luaVersion, "launcher.lua") | ||
if arg.nodebug then | ||
cmd = cmd .. " nodebug" | ||
end | ||
execute(cmd) | ||
end | ||
|
||
local function runAll(t, args) | ||
for _, v in ipairs(luaVersions) do | ||
print("--------------------", v, "--------------------") | ||
for _, arg in ipairs(args) do | ||
if v:find("JIT") then | ||
t.classic = true | ||
t.extra = "-csc /define:__JIT__" | ||
else | ||
t.classic = false | ||
t.extra = nil | ||
end | ||
arg.__index = arg | ||
setmetatable(t, arg) | ||
compile(t, v) | ||
end | ||
launcher(t, v) | ||
end | ||
end | ||
|
||
|
||
function run(args) | ||
execute("dotnet build --configuration Debug") | ||
if args[1] == nil then | ||
args = { args } | ||
end | ||
runAll({}, args) | ||
runAll({ inlineProperty = true }, args) | ||
runAll({ nodebug = true }, args) | ||
runAll({ inlineProperty = true, nodebug = true }, args) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters