aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-07-03 13:21:45 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-07-03 13:21:45 +0200
commitffedd175233975f3ca9ac940df9883898d5ace25 (patch)
treea073d90a98b188635b19027d797e2c8b663501e0 /tests
parentf81fe873dd24f93306f0f667fc47766990a9321b (diff)
downloadlanes-ffedd175233975f3ca9ac940df9883898d5ace25.tar.gz
lanes-ffedd175233975f3ca9ac940df9883898d5ace25.tar.bz2
lanes-ffedd175233975f3ca9ac940df9883898d5ace25.zip
Renamed set_debug_threadname → lane_threadname (can also read the current name now)
Diffstat (limited to 'tests')
-rw-r--r--tests/basic.lua12
-rw-r--r--tests/cancel.lua2
-rw-r--r--tests/deadlock.lua2
-rw-r--r--tests/fibonacci.lua4
-rw-r--r--tests/track_lanes.lua8
5 files changed, 14 insertions, 14 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index 97783cb..f44c75f 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -76,7 +76,7 @@ end
76PRINT("\n\n", "---=== Tasking (basic) ===---", "\n\n") 76PRINT("\n\n", "---=== Tasking (basic) ===---", "\n\n")
77 77
78local function task(a, b, c) 78local function task(a, b, c)
79 set_debug_threadname("task("..a..","..b..","..c..")") 79 lane_threadname("task("..a..","..b..","..c..")")
80 --error "111" -- testing error messages 80 --error "111" -- testing error messages
81 assert(hey) 81 assert(hey)
82 local v=0 82 local v=0
@@ -329,7 +329,7 @@ SLEEP(1)
329PRINT("\n\n", "---=== Stdlib naming ===---", "\n\n") 329PRINT("\n\n", "---=== Stdlib naming ===---", "\n\n")
330 330
331local function dump_g(_x) 331local function dump_g(_x)
332 set_debug_threadname "dump_g" 332 lane_threadname "dump_g"
333 assert(print) 333 assert(print)
334 print("### dumping _G for '" .. _x .. "'") 334 print("### dumping _G for '" .. _x .. "'")
335 for k, v in pairs(_G) do 335 for k, v in pairs(_G) do
@@ -339,7 +339,7 @@ local function dump_g(_x)
339end 339end
340 340
341local function io_os_f(_x) 341local function io_os_f(_x)
342 set_debug_threadname "io_os_f" 342 lane_threadname "io_os_f"
343 assert(print) 343 assert(print)
344 print("### checking io and os libs existence for '" .. _x .. "'") 344 print("### checking io and os libs existence for '" .. _x .. "'")
345 assert(io) 345 assert(io)
@@ -348,7 +348,7 @@ local function io_os_f(_x)
348end 348end
349 349
350local function coro_f(_x) 350local function coro_f(_x)
351 set_debug_threadname "coro_f" 351 lane_threadname "coro_f"
352 assert(print) 352 assert(print)
353 print("### checking coroutine lib existence for '" .. _x .. "'") 353 print("### checking coroutine lib existence for '" .. _x .. "'")
354 assert(coroutine) 354 assert(coroutine)
@@ -388,7 +388,7 @@ PRINT("\n\n", "---=== Comms criss cross ===---", "\n\n")
388-- 388--
389local tc= lanes_gen("io", {gc_cb = gc_cb}, 389local tc= lanes_gen("io", {gc_cb = gc_cb},
390 function(linda, ch_in, ch_out) 390 function(linda, ch_in, ch_out)
391 set_debug_threadname("criss cross " .. ch_in .. " -> " .. ch_out) 391 lane_threadname("criss cross " .. ch_in .. " -> " .. ch_out)
392 local function STAGE(str) 392 local function STAGE(str)
393 io.stderr:write(ch_in..": "..str.."\n") 393 io.stderr:write(ch_in..": "..str.."\n")
394 linda:send(nil, ch_out, str) 394 linda:send(nil, ch_out, str)
@@ -488,7 +488,7 @@ PRINT("\n\n", "---=== :join test ===---", "\n\n")
488 488
489local S= lanes_gen("table", {gc_cb = gc_cb}, 489local S= lanes_gen("table", {gc_cb = gc_cb},
490 function(arg) 490 function(arg)
491 set_debug_threadname "join test lane" 491 lane_threadname "join test lane"
492 set_finalizer(function() end) 492 set_finalizer(function() end)
493 aux= {} 493 aux= {}
494 for i, v in ipairs(arg) do 494 for i, v in ipairs(arg) do
diff --git a/tests/cancel.lua b/tests/cancel.lua
index 1724e6a..9ee986c 100644
--- a/tests/cancel.lua
+++ b/tests/cancel.lua
@@ -75,7 +75,7 @@ end
75 75
76local laneBody = function( mode_, payload_) 76local laneBody = function( mode_, payload_)
77 local name = "laneBody("..tostring(mode_)..","..tostring(payload_)..")" 77 local name = "laneBody("..tostring(mode_)..","..tostring(payload_)..")"
78 set_debug_threadname( name) 78 lane_threadname(name)
79 79
80 set_finalizer( function( err, stk) 80 set_finalizer( function( err, stk)
81 if err == lanes.cancel_error then 81 if err == lanes.cancel_error then
diff --git a/tests/deadlock.lua b/tests/deadlock.lua
index bbbda8d..d028e83 100644
--- a/tests/deadlock.lua
+++ b/tests/deadlock.lua
@@ -22,7 +22,7 @@ if do_extra_stuff then
22 22
23 -- lane generator. don't initialize "io" base library so that it is not known in the lane 23 -- lane generator. don't initialize "io" base library so that it is not known in the lane
24 local g = lanes.gen('base,table', function() 24 local g = lanes.gen('base,table', function()
25 set_debug_threadname( "deadlock_lane") 25 lane_threadname( "deadlock_lane")
26 -- wrapping inside pcall makes the Lanes module unaware that something went wrong 26 -- wrapping inside pcall makes the Lanes module unaware that something went wrong
27 print( "In lane 1:", table_unpack{ pcall( linda.receive, linda, 'tmp')}) 27 print( "In lane 1:", table_unpack{ pcall( linda.receive, linda, 'tmp')})
28 -- with the bug not fixed, and non-recursive mutexes, we can hang here 28 -- with the bug not fixed, and non-recursive mutexes, we can hang here
diff --git a/tests/fibonacci.lua b/tests/fibonacci.lua
index 51e7137..7885ae6 100644
--- a/tests/fibonacci.lua
+++ b/tests/fibonacci.lua
@@ -24,14 +24,14 @@ end
24local KNOWN= { [0]=0, 1,1,2,3,5,8,13,21,34,55,89,144 } 24local KNOWN= { [0]=0, 1,1,2,3,5,8,13,21,34,55,89,144 }
25 25
26-- dummy function so that we don't error when fib() is launched from the master state 26-- dummy function so that we don't error when fib() is launched from the master state
27set_debug_threadname = function ( ...) 27lane_threadname = function ( ...)
28end 28end
29 29
30 -- 30 --
31-- uint= fib( n_uint ) 31-- uint= fib( n_uint )
32-- 32--
33local function fib( n ) 33local function fib( n )
34 set_debug_threadname( "fib(" .. n .. ")") 34 lane_threadname( "fib(" .. n .. ")")
35 local lanes = require"lanes" 35 local lanes = require"lanes"
36 -- 36 --
37 local sum 37 local sum
diff --git a/tests/track_lanes.lua b/tests/track_lanes.lua
index 32f579b..803fae5 100644
--- a/tests/track_lanes.lua
+++ b/tests/track_lanes.lua
@@ -29,11 +29,11 @@ local sleeper = function( name_, seconds_)
29 end 29 end
30 -- print( "entering '" .. name_ .. "'") 30 -- print( "entering '" .. name_ .. "'")
31 local lanes = require "lanes" 31 local lanes = require "lanes"
32 -- no set_debug_threadname in main thread 32 -- no lane_threadname in main thread
33 if set_debug_threadname 33 if lane_threadname
34 then 34 then
35 -- print( "set_debug_threadname('" .. name_ .. "')") 35 -- print( "lane_threadname('" .. name_ .. "')")
36 set_debug_threadname( name_) 36 lane_threadname( name_)
37 end 37 end
38 -- suspend the lane for the specified duration 38 -- suspend the lane for the specified duration
39 lanes.sleep(seconds_) 39 lanes.sleep(seconds_)