Fixed test script to not use globally installed version and the dev version

This commit is contained in:
Ryan Ward 2022-04-18 21:25:36 -04:00
parent bd49805c25
commit 6527dc1aaa
2 changed files with 28 additions and 6 deletions

View File

@ -1545,7 +1545,7 @@ co_status = {
if _ then if _ then
ref.OnDeath:Fire(ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) ref.OnDeath:Fire(ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)
else else
ref.OnError:Fire(ref,ret) ref.OnError:Fire(ref,ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)
end end
if i then if i then
table.remove(th,i) table.remove(th,i)

View File

@ -2,7 +2,7 @@ if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
package.path="multi/?.lua;multi/?/init.lua;multi/?.lua;multi/?/?/init.lua;"..package.path package.path="multi/?.lua;multi/?/init.lua;multi/?.lua;multi/?/?/init.lua;"..package.path
require("lldebugger").start() require("lldebugger").start()
else else
--package.path="./?.lua;../?/init.lua;../?.lua;../?/?/init.lua;"..package.path package.path="./?.lua;../?/init.lua;../?.lua;../?/?/init.lua;"..package.path
end end
--[[ --[[
This file runs all tests. This file runs all tests.
@ -20,7 +20,7 @@ end
The expected and actual should "match" (Might be impossible when playing with threads) The expected and actual should "match" (Might be impossible when playing with threads)
This will be pushed directly to the master as tests start existing. This will be pushed directly to the master as tests start existing.
]] ]]
local multi, thread = require("multi"):init()--{priority=true} local multi, thread = require("multi"):init{print=true}--{priority=true}
local good = false local good = false
local proc = multi:newProcessor("Test",true) local proc = multi:newProcessor("Test",true)
proc:newAlarm(3):OnRing(function() proc:newAlarm(3):OnRing(function()
@ -85,7 +85,13 @@ runTest = thread:newFunction(function()
local ret3 = func(20) local ret3 = func(20)
local s1,s2,s3 = 0,0,0 local s1,s2,s3 = 0,0,0
ret.OnError(function(...) ret.OnError(function(...)
print("Error:",...) print("Func 1:",...)
end)
ret2.OnError(function(...)
print("Func 2:",...)
end)
ret3.OnError(function(...)
print("Func 3:",...)
end) end)
ret.OnStatus(function(part,whole) ret.OnStatus(function(part,whole)
s1 = math.ceil((part/whole)*1000)/10 s1 = math.ceil((part/whole)*1000)/10
@ -97,7 +103,13 @@ runTest = thread:newFunction(function()
s3 = math.ceil((part/whole)*1000)/10 s3 = math.ceil((part/whole)*1000)/10
end) end)
ret.OnReturn(function() ret.OnReturn(function()
print("Done") print("Done 1")
end)
ret2.OnReturn(function()
print("Done 2")
end)
ret3.OnReturn(function()
print("Done 3")
end) end)
local err, timeout = thread.hold(ret.OnReturn + ret2.OnReturn + ret3.OnReturn) local err, timeout = thread.hold(ret.OnReturn + ret2.OnReturn + ret3.OnReturn)
if s1 == 100 and s2 == 100 and s3 == 100 then if s1 == 100 and s2 == 100 and s3 == 100 then
@ -114,21 +126,27 @@ runTest = thread:newFunction(function()
conn2 = proc:newConnection() conn2 = proc:newConnection()
conn3 = proc:newConnection() conn3 = proc:newConnection()
local c1,c2,c3,c4 = false,false,false,false local c1,c2,c3,c4 = false,false,false,false
local a = conn1(function() local a = conn1(function()
c1 = true c1 = true
end) end)
local b = conn2(function() local b = conn2(function()
c2 = true c2 = true
end) end)
local c = conn3(function() local c = conn3(function()
c3 = true c3 = true
end) end)
local d = conn3(function() local d = conn3(function()
c4 = true c4 = true
end) end)
conn1:Fire() conn1:Fire()
conn2:Fire() conn2:Fire()
conn3:Fire() conn3:Fire()
if c1 and c2 and c3 and c4 then if c1 and c2 and c3 and c4 then
print("Connection Test 2: Ok") print("Connection Test 2: Ok")
else else
@ -145,9 +163,13 @@ runTest = thread:newFunction(function()
end end
os.exit() -- End of tests os.exit() -- End of tests
end) end)
runTest().OnError(function(...) runTest().OnError(function(...)
print("Error:",...) print("Error: Something went wrong with the test!")
print(...)
os.exit(1)
end) end)
print("Pumping proc") print("Pumping proc")
while true do while true do
proc.run() proc.run()