diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-10 12:02:43 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-10 12:02:43 +0100 |
commit | b35f8f264d806b0a614588e75f9b7c2712c860a4 (patch) | |
tree | 3a3e0eff3ded57c42a1b74f7365ebd724e1bd88b /unit_tests/scripts | |
parent | 6aca0e436306b176ab7e2e866927442280055b52 (diff) | |
download | lanes-b35f8f264d806b0a614588e75f9b7c2712c860a4.tar.gz lanes-b35f8f264d806b0a614588e75f9b7c2712c860a4.tar.bz2 lanes-b35f8f264d806b0a614588e75f9b7c2712c860a4.zip |
Some fixes for unit tests with LuaJIT
* vcproj settings
* always load "jit" module so that lanes does not detect it in running under PUC-Lua
* add fixture support so that test "cooperative_shutdown.lua" works
* fix test "lanes.configure() allocator setting not failing like it should
Diffstat (limited to 'unit_tests/scripts')
-rw-r--r-- | unit_tests/scripts/lane/cooperative_shutdown.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/unit_tests/scripts/lane/cooperative_shutdown.lua b/unit_tests/scripts/lane/cooperative_shutdown.lua index 2649079..1204e35 100644 --- a/unit_tests/scripts/lane/cooperative_shutdown.lua +++ b/unit_tests/scripts/lane/cooperative_shutdown.lua | |||
@@ -3,6 +3,7 @@ local lanes = require "lanes" | |||
3 | -- launch lanes that cooperate properly with cancellation request | 3 | -- launch lanes that cooperate properly with cancellation request |
4 | 4 | ||
5 | local lane1 = function() | 5 | local lane1 = function() |
6 | lane_threadname("lane1") | ||
6 | -- loop breaks on cancellation request | 7 | -- loop breaks on cancellation request |
7 | repeat | 8 | repeat |
8 | lanes.sleep(0) | 9 | lanes.sleep(0) |
@@ -11,6 +12,7 @@ local lane1 = function() | |||
11 | end | 12 | end |
12 | 13 | ||
13 | local lane2 = function(linda_) | 14 | local lane2 = function(linda_) |
15 | lane_threadname("lane2") | ||
14 | -- loop breaks on lane/linda cancellation | 16 | -- loop breaks on lane/linda cancellation |
15 | repeat | 17 | repeat |
16 | local k, v = linda_:receive('k') | 18 | local k, v = linda_:receive('k') |
@@ -19,9 +21,11 @@ local lane2 = function(linda_) | |||
19 | end | 21 | end |
20 | 22 | ||
21 | local lane3 = function() | 23 | local lane3 = function() |
24 | lane_threadname("lane3") | ||
22 | -- this one cooperates too, because of the hook cancellation modes that Lanes will be using | 25 | -- this one cooperates too, because of the hook cancellation modes that Lanes will be using |
23 | -- but not with LuaJIT, because the function is compiled, and we don't call anyone, so no hook triggers | 26 | -- but not with LuaJIT, because the function is compiled, and we don't call anyone, so no hook triggers |
24 | repeat until false | 27 | local fixture = require "fixture" |
28 | repeat until fixture.give_me_back(false) | ||
25 | end | 29 | end |
26 | 30 | ||
27 | 31 | ||