diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-06-05 16:03:22 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-06-05 16:03:22 +0200 |
| commit | bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8 (patch) | |
| tree | 00f6633878b21dda6cad1177d5619a501b4ac0a4 /unit_tests/scripts/linda | |
| parent | f73702bcf4372a149b8b01a512c0e086b1e679e2 (diff) | |
| download | lanes-bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8.tar.gz lanes-bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8.tar.bz2 lanes-bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8.zip | |
Change lane:join() return values
* when no error is raised in the lane, lane:join() now precedes the lane returned values with true
* lane body is no longer forced to return something when used with join()
* adjusted all relevant unit tests accordingly
Diffstat (limited to 'unit_tests/scripts/linda')
| -rw-r--r-- | unit_tests/scripts/linda/wake_period.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/unit_tests/scripts/linda/wake_period.lua b/unit_tests/scripts/linda/wake_period.lua index e4a900d..d2dccc3 100644 --- a/unit_tests/scripts/linda/wake_period.lua +++ b/unit_tests/scripts/linda/wake_period.lua | |||
| @@ -6,7 +6,7 @@ local lanes = require_lanes_result_1 | |||
| 6 | local body = function(linda_) | 6 | local body = function(linda_) |
| 7 | -- a blocking read that lasts longer than the tested wake_period values | 7 | -- a blocking read that lasts longer than the tested wake_period values |
| 8 | linda_:receive(2, "empty_slot") | 8 | linda_:receive(2, "empty_slot") |
| 9 | return true | 9 | return "done" |
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | -- if we don't cancel the lane, we should wait the whole duration | 12 | -- if we don't cancel the lane, we should wait the whole duration |
| @@ -22,7 +22,8 @@ local function check_wake_duration(linda_, expected_, do_cancel_) | |||
| 22 | assert(result == false and reason == 'timeout', "unexpected cancel result") | 22 | assert(result == false and reason == 'timeout', "unexpected cancel result") |
| 23 | end | 23 | end |
| 24 | -- this should wait until the linda wakes by itself before the actual receive timeout and sees the cancel request | 24 | -- this should wait until the linda wakes by itself before the actual receive timeout and sees the cancel request |
| 25 | h:join() | 25 | local r, ret = h:join() |
| 26 | assert(r == true and ret == "done") | ||
| 26 | local t1 = lanes.now_secs() | 27 | local t1 = lanes.now_secs() |
| 27 | local delta = t1 - t0 | 28 | local delta = t1 - t0 |
| 28 | -- the linda should check for cancellation at about the expected period, not earlier | 29 | -- the linda should check for cancellation at about the expected period, not earlier |
