aboutsummaryrefslogtreecommitdiff
path: root/unit_tests/scripts
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-03-14 14:53:09 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2025-03-14 14:53:09 +0100
commit512f4c0b46ea5cc359e673b7379cd81925863121 (patch)
tree1e72167d8d63f44109719db9643d4c0445b17d57 /unit_tests/scripts
parent0aa030db022c57947afbae3b97038a403973e3cd (diff)
downloadlanes-master.tar.gz
lanes-master.tar.bz2
lanes-master.zip
Give a name to all lanes in the testsHEADmaster
Diffstat (limited to 'unit_tests/scripts')
-rw-r--r--unit_tests/scripts/coro/basics.lua2
-rw-r--r--unit_tests/scripts/lane/cooperative_shutdown.lua6
-rw-r--r--unit_tests/scripts/lane/stdlib_naming.lua2
-rw-r--r--unit_tests/scripts/lane/tasking_basic.lua2
-rw-r--r--unit_tests/scripts/lane/tasking_cancelling.lua8
-rw-r--r--unit_tests/scripts/lane/tasking_comms_criss_cross.lua2
-rw-r--r--unit_tests/scripts/lane/tasking_communications.lua2
-rw-r--r--unit_tests/scripts/lane/tasking_error.lua2
-rw-r--r--unit_tests/scripts/lane/tasking_join_test.lua2
-rw-r--r--unit_tests/scripts/lane/tasking_send_receive_code.lua2
-rw-r--r--unit_tests/scripts/lane/uncooperative_shutdown.lua2
11 files changed, 16 insertions, 16 deletions
diff --git a/unit_tests/scripts/coro/basics.lua b/unit_tests/scripts/coro/basics.lua
index dc74b7c..cd2f410 100644
--- a/unit_tests/scripts/coro/basics.lua
+++ b/unit_tests/scripts/coro/basics.lua
@@ -42,7 +42,7 @@ end
42 42
43if true then 43if true then
44 -- if we start a non-coroutine lane with a yielding function, we should get an error, right? 44 -- if we start a non-coroutine lane with a yielding function, we should get an error, right?
45 local fun_g = lanes.gen("*", {name = "auto"}, yielder) 45 local fun_g = lanes.gen("*", { name = 'auto' }, yielder)
46 local h = fun_g("hello", "world", "!") 46 local h = fun_g("hello", "world", "!")
47 local err, status, stack = h:join() 47 local err, status, stack = h:join()
48 PRINT(err, status, stack) 48 PRINT(err, status, stack)
diff --git a/unit_tests/scripts/lane/cooperative_shutdown.lua b/unit_tests/scripts/lane/cooperative_shutdown.lua
index 1204e35..756e33c 100644
--- a/unit_tests/scripts/lane/cooperative_shutdown.lua
+++ b/unit_tests/scripts/lane/cooperative_shutdown.lua
@@ -31,9 +31,9 @@ end
31 31
32 32
33-- the generators 33-- the generators
34local g1 = lanes.gen("*", lane1) 34local g1 = lanes.gen("*", { name = 'auto' }, lane1)
35local g2 = lanes.gen("*", lane2) 35local g2 = lanes.gen("*", { name = 'auto' }, lane2)
36local g3 = lanes.gen("*", lane3) 36local g3 = lanes.gen("*", { name = 'auto' }, lane3)
37 37
38-- launch lanes 38-- launch lanes
39local h1 = g1() 39local h1 = g1()
diff --git a/unit_tests/scripts/lane/stdlib_naming.lua b/unit_tests/scripts/lane/stdlib_naming.lua
index 2e045c3..4884cca 100644
--- a/unit_tests/scripts/lane/stdlib_naming.lua
+++ b/unit_tests/scripts/lane/stdlib_naming.lua
@@ -63,7 +63,7 @@ local function coro_f(_x)
63 return true 63 return true
64end 64end
65 65
66assert.fails(function() lanes_gen("xxx", {gc_cb = gc_cb}, io_os_f) end) 66assert.fails(function() lanes_gen("xxx", { name = 'auto', gc_cb = gc_cb }, io_os_f) end)
67 67
68local stdlib_naming_tests = 68local stdlib_naming_tests =
69{ 69{
diff --git a/unit_tests/scripts/lane/tasking_basic.lua b/unit_tests/scripts/lane/tasking_basic.lua
index 99be321..233accf 100644
--- a/unit_tests/scripts/lane/tasking_basic.lua
+++ b/unit_tests/scripts/lane/tasking_basic.lua
@@ -39,7 +39,7 @@ end
39 39
40PRINT("\n\n", "---=== Tasking (basic) ===---", "\n\n") 40PRINT("\n\n", "---=== Tasking (basic) ===---", "\n\n")
41 41
42local task_launch = lanes_gen("", { globals={hey=true}, gc_cb = gc_cb}, task) 42local task_launch = lanes_gen("", { name = 'auto', globals={hey=true}, gc_cb = gc_cb }, task)
43 -- base stdlibs, normal priority 43 -- base stdlibs, normal priority
44 44
45-- 'task_launch' is a factory of multithreaded tasks, we can launch several: 45-- 'task_launch' is a factory of multithreaded tasks, we can launch several:
diff --git a/unit_tests/scripts/lane/tasking_cancelling.lua b/unit_tests/scripts/lane/tasking_cancelling.lua
index a4e0fde..85600ab 100644
--- a/unit_tests/scripts/lane/tasking_cancelling.lua
+++ b/unit_tests/scripts/lane/tasking_cancelling.lua
@@ -36,7 +36,7 @@ end
36 36
37PRINT("\n\n", "---=== Tasking (cancelling) ===---", "\n\n") 37PRINT("\n\n", "---=== Tasking (cancelling) ===---", "\n\n")
38 38
39local task_launch2 = lanes_gen("", { globals={hey=true}, gc_cb = gc_cb}, task) 39local task_launch2 = lanes_gen("", { name = 'auto', globals={hey=true}, gc_cb = gc_cb }, task)
40 40
41local N=999999999 41local N=999999999
42local lane9= task_launch2(1,N,1) -- huuuuuuge... 42local lane9= task_launch2(1,N,1) -- huuuuuuge...
@@ -87,7 +87,7 @@ local wait_send = function()
87 a,b = limited:send("key", "bybye") -- infinite timeout, returns only when lane is cancelled 87 a,b = limited:send("key", "bybye") -- infinite timeout, returns only when lane is cancelled
88end 88end
89 89
90local wait_send_lane = lanes.gen("*", wait_send)() 90local wait_send_lane = lanes_gen("*", { name = 'auto' }, wait_send)()
91repeat until wait_send_lane.status == "waiting" 91repeat until wait_send_lane.status == "waiting"
92print "wait_send_lane is waiting" 92print "wait_send_lane is waiting"
93wait_send_lane:cancel() -- hard cancel, 0 timeout 93wait_send_lane:cancel() -- hard cancel, 0 timeout
@@ -100,7 +100,7 @@ local wait_receive = function()
100 k, v = limited:receive("dummy") -- infinite timeout, returns only when lane is cancelled 100 k, v = limited:receive("dummy") -- infinite timeout, returns only when lane is cancelled
101end 101end
102 102
103local wait_receive_lane = lanes.gen("*", wait_receive)() 103local wait_receive_lane = lanes_gen("*", { name = 'auto' }, wait_receive)()
104repeat until wait_receive_lane.status == "waiting" 104repeat until wait_receive_lane.status == "waiting"
105print "wait_receive_lane is waiting" 105print "wait_receive_lane is waiting"
106wait_receive_lane:cancel() -- hard cancel, 0 timeout 106wait_receive_lane:cancel() -- hard cancel, 0 timeout
@@ -113,7 +113,7 @@ local wait_receive_batched = function()
113 k, v1, v2 = limited:receive(limited.batched, "dummy", 2) -- infinite timeout, returns only when lane is cancelled 113 k, v1, v2 = limited:receive(limited.batched, "dummy", 2) -- infinite timeout, returns only when lane is cancelled
114end 114end
115 115
116local wait_receive_batched_lane = lanes.gen("*", wait_receive_batched)() 116local wait_receive_batched_lane = lanes_gen("*", { name = 'auto' }, wait_receive_batched)()
117repeat until wait_receive_batched_lane.status == "waiting" 117repeat until wait_receive_batched_lane.status == "waiting"
118print "wait_receive_batched_lane is waiting" 118print "wait_receive_batched_lane is waiting"
119wait_receive_batched_lane:cancel() -- hard cancel, 0 timeout 119wait_receive_batched_lane:cancel() -- hard cancel, 0 timeout
diff --git a/unit_tests/scripts/lane/tasking_comms_criss_cross.lua b/unit_tests/scripts/lane/tasking_comms_criss_cross.lua
index db63b8e..497e81d 100644
--- a/unit_tests/scripts/lane/tasking_comms_criss_cross.lua
+++ b/unit_tests/scripts/lane/tasking_comms_criss_cross.lua
@@ -27,7 +27,7 @@ PRINT("\n\n", "---=== Comms criss cross ===---", "\n\n")
27 27
28-- We make two identical lanes, which are using the same Linda channel. 28-- We make two identical lanes, which are using the same Linda channel.
29-- 29--
30local tc = lanes_gen("io", {gc_cb = gc_cb}, 30local tc = lanes_gen("io", { name = 'auto', gc_cb = gc_cb },
31 function(linda, ch_in, ch_out) 31 function(linda, ch_in, ch_out)
32 lane_threadname("criss cross " .. ch_in .. " -> " .. ch_out) 32 lane_threadname("criss cross " .. ch_in .. " -> " .. ch_out)
33 local function STAGE(str) 33 local function STAGE(str)
diff --git a/unit_tests/scripts/lane/tasking_communications.lua b/unit_tests/scripts/lane/tasking_communications.lua
index b922973..1fd43b0 100644
--- a/unit_tests/scripts/lane/tasking_communications.lua
+++ b/unit_tests/scripts/lane/tasking_communications.lua
@@ -101,7 +101,7 @@ local function PEEK(...) return linda:get("<-", ...) end
101local function SEND(...) local _res, _err = linda:send("->", ...) assert(_res == true and _err == nil) end 101local function SEND(...) local _res, _err = linda:send("->", ...) assert(_res == true and _err == nil) end
102local function RECEIVE() local k,v = linda:receive(1, "<-") return v end 102local function RECEIVE() local k,v = linda:receive(1, "<-") return v end
103 103
104local comms_lane = lanes_gen("io", {gc_cb = gc_cb, name = "auto"}, chunk)(linda) -- prepare & launch 104local comms_lane = lanes_gen("io", { name = 'auto', gc_cb = gc_cb }, chunk)(linda) -- prepare & launch
105 105
106SEND(1); WR("main ", "1 sent\n") 106SEND(1); WR("main ", "1 sent\n")
107SEND(2); WR("main ", "2 sent\n") 107SEND(2); WR("main ", "2 sent\n")
diff --git a/unit_tests/scripts/lane/tasking_error.lua b/unit_tests/scripts/lane/tasking_error.lua
index 1e2347f..26f244b 100644
--- a/unit_tests/scripts/lane/tasking_error.lua
+++ b/unit_tests/scripts/lane/tasking_error.lua
@@ -22,7 +22,7 @@ end
22PRINT("---=== Tasking (error) ===---", "\n\n") 22PRINT("---=== Tasking (error) ===---", "\n\n")
23 23
24-- a lane that throws immediately the error value it received 24-- a lane that throws immediately the error value it received
25local g = lanes_gen("", {gc_cb = gc_cb}, error) 25local g = lanes_gen("", { name = 'auto', gc_cb = gc_cb }, error)
26local errmsg = "ERROR!" 26local errmsg = "ERROR!"
27 27
28if true then 28if true then
diff --git a/unit_tests/scripts/lane/tasking_join_test.lua b/unit_tests/scripts/lane/tasking_join_test.lua
index 8f2d4db..2fbce6c 100644
--- a/unit_tests/scripts/lane/tasking_join_test.lua
+++ b/unit_tests/scripts/lane/tasking_join_test.lua
@@ -34,7 +34,7 @@ PRINT("---=== :join test ===---", "\n\n")
34-- (unless [1..n] has been read earlier, in which case it would seemingly 34-- (unless [1..n] has been read earlier, in which case it would seemingly
35-- work). 35-- work).
36 36
37local S= lanes_gen("table", {gc_cb = gc_cb}, 37local S= lanes_gen("table", { name = 'auto', gc_cb = gc_cb },
38 function(arg) 38 function(arg)
39 lane_threadname "join test lane" 39 lane_threadname "join test lane"
40 set_finalizer(function() end) 40 set_finalizer(function() end)
diff --git a/unit_tests/scripts/lane/tasking_send_receive_code.lua b/unit_tests/scripts/lane/tasking_send_receive_code.lua
index 77a4b12..e329a88 100644
--- a/unit_tests/scripts/lane/tasking_send_receive_code.lua
+++ b/unit_tests/scripts/lane/tasking_send_receive_code.lua
@@ -66,7 +66,7 @@ local function chunk2(linda)
66end 66end
67 67
68local linda = lanes_linda("auto") 68local linda = lanes_linda("auto")
69local t2= lanes_gen("debug,package,string,io", {gc_cb = gc_cb}, chunk2)(linda) -- prepare & launch 69local t2= lanes_gen("debug,package,string,io", { name = 'auto', gc_cb = gc_cb }, chunk2)(linda) -- prepare & launch
70linda:send("down", function(linda) linda:send("up", "ready!") end, 70linda:send("down", function(linda) linda:send("up", "ready!") end,
71 "ok") 71 "ok")
72-- wait to see if the tiny function gets executed 72-- wait to see if the tiny function gets executed
diff --git a/unit_tests/scripts/lane/uncooperative_shutdown.lua b/unit_tests/scripts/lane/uncooperative_shutdown.lua
index 56c936b..51e5762 100644
--- a/unit_tests/scripts/lane/uncooperative_shutdown.lua
+++ b/unit_tests/scripts/lane/uncooperative_shutdown.lua
@@ -12,7 +12,7 @@ local lane = function()
12end 12end
13 13
14-- the generator 14-- the generator
15local g1 = lanes.gen("*", {name = "auto"}, lane) 15local g1 = lanes.gen("*", { name = 'auto' }, lane)
16 16
17-- launch lane 17-- launch lane
18local h1 = g1() 18local h1 = g1()