- py_func and lua_func items accept a context_id parameter; items sharing the same id reuse the same subprocess for the duration of the test run - Subprocess-side tm.setgd/tm.gd use a local fallback dict for non-JSON- serializable values (py_func only); serializable values reach the main process global dict and are accessible from any test item or subprocess - Shared subprocess engines are cleaned up in process.py finally block - LuaProcessBase gains is_alive() (was missing, broke all lua_func items) - Validation tests cover serializable sharing across different context ids, non-serializable sharing within the same context_id, and cross-item access - RST documentation updated for both py_func and lua_func items Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
722 B
Lua
44 lines
722 B
Lua
tm = require("tm")
|
|
|
|
local module = {}
|
|
|
|
function module.donothing(param)
|
|
return 0
|
|
end
|
|
|
|
function module.assertparam(param)
|
|
assert(param)
|
|
return 0
|
|
end
|
|
|
|
function module.checkglobal(param)
|
|
local res = tm.gd(param)
|
|
return res
|
|
end
|
|
|
|
function module.checkglobal2(index)
|
|
return tm.gd("lua_data_to_be_returned")[index]
|
|
end
|
|
|
|
function module.should_not_be_called(param)
|
|
assert(false)
|
|
end
|
|
|
|
function module.echo(param)
|
|
return param
|
|
end
|
|
|
|
function module.tuple_return(first, second)
|
|
return first, second
|
|
end
|
|
|
|
function module.set_context_value(val)
|
|
tm.setgd("_lua_ctx_test_value", val)
|
|
return val
|
|
end
|
|
|
|
function module.get_context_value()
|
|
return tm.gd("_lua_ctx_test_value")
|
|
end
|
|
|
|
return module |