diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-01-18 15:21:08 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-01-23 08:22:58 +0100 |
| commit | cfdda74096f9dc706d909ec7bcb02b962d1b25e3 (patch) | |
| tree | ddbef7a991109ae91d094a788f946af6f912d52e /src | |
| parent | 9f2e078c694d375ff7a633e629d05554c873c8dc (diff) | |
| download | ouroboros-cfdda74096f9dc706d909ec7bcb02b962d1b25e3.tar.gz ouroboros-cfdda74096f9dc706d909ec7bcb02b962d1b25e3.zip | |
irmd: Fix registry tests
Noticed a test fail with SEGV on codeberg:
23/23 Test #23: irmd/reg/reg_test ................
Subprocess aborted***Exception: 1.11 sec
Wait accept did not return a flow id: -110.
test_wait_accepting_success failed.
Root cause was a missing unbind_process call in the cleanup.
The test can now wait for 10 seconds, and will take less on fast
systems:
23/23 Test #23: irmd/reg/reg_test ................
Passed 0.01 sec
The test_wait_ipcp_boot_fail was also wrong, a failed IPCP
returns/sets state to IPCP_NULL.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src')
| -rw-r--r-- | src/irmd/reg/reg.c | 2 | ||||
| -rw-r--r-- | src/irmd/reg/tests/reg_test.c | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/irmd/reg/reg.c b/src/irmd/reg/reg.c index a24a9d1d..fd8285be 100644 --- a/src/irmd/reg/reg.c +++ b/src/irmd/reg/reg.c @@ -1816,6 +1816,8 @@ int reg_prepare_flow_accept(struct flow_info * info) ret = reg_flow_update(flow, info); + pthread_cond_broadcast(®.cond); + pthread_mutex_unlock(®.mtx); return ret; diff --git a/src/irmd/reg/tests/reg_test.c b/src/irmd/reg/tests/reg_test.c index e7ae1a97..74d64f5a 100644 --- a/src/irmd/reg/tests/reg_test.c +++ b/src/irmd/reg/tests/reg_test.c @@ -36,7 +36,7 @@ #define TEST_DATA2 "testpbufdata2" #define TEST_LAYER "testlayer" #define REG_TEST_FAIL() \ - do { TEST_FAIL(); memset(®, 0, sizeof(reg)); abort();} while(0) + do { TEST_FAIL(); reg_clear(); return TEST_RC_FAIL;} while(0) static int test_reg_init(void) { @@ -1336,6 +1336,11 @@ static void * test_call_flow_accept(void * o) goto fail; } + if (reg_unbind_proc((char *) o, pinfo.pid) < 0) { + printf("Failed to unbind proc.\n"); + goto fail; + } + reg_destroy_flow(info.id); reg_destroy_proc(pinfo.pid); @@ -1347,7 +1352,7 @@ static void * test_call_flow_accept(void * o) static int test_wait_accepting_success(void) { struct timespec abstime; - struct timespec timeo = TIMESPEC_INIT_S(1); + struct timespec timeo = TIMESPEC_INIT_S(10); pthread_t thr; int flow_id; struct name_info ninfo = { @@ -1375,7 +1380,7 @@ static int test_wait_accepting_success(void) flow_id = reg_wait_flow_accepting(ninfo.name, &abstime); if (flow_id < 0) { - printf("Wait accept did not return a flow id: %d.", flow_id); + printf("Wait accept did not return a flow id: %d.\n", flow_id); goto fail; } |
