diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 783336bc6..522e14b99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,10 +166,10 @@ jobs: RUST_LOG=debug ./zenoh-standalone/zenohd & echo "zenohd-pid=$!" >> $GITHUB_OUTPUT - - name: Build project and run test + - name: Build project and run tests run: | sudo apt install -y ninja-build - CMAKE_GENERATOR=Ninja make + CMAKE_GENERATOR=Ninja ASAN=ON make test python3 ./build/tests/single_thread.py timeout-minutes: 5 env: diff --git a/src/collections/ring_mt.c b/src/collections/ring_mt.c index 3749e8c3a..3529cd143 100644 --- a/src/collections/ring_mt.c +++ b/src/collections/ring_mt.c @@ -107,14 +107,17 @@ z_result_t _z_ring_mt_pull(void *dst, void *context, z_element_move_f element_mo } } _Z_RETURN_IF_ERR(_z_mutex_unlock(&r->_mutex)) - if (r->is_closed && src == NULL) return _Z_RES_CHANNEL_CLOSED; - element_move(dst, src); #else // Z_FEATURE_MULTI_THREAD == 1 void *src = _z_ring_pull(&r->_ring); +#endif // Z_FEATURE_MULTI_THREAD == 1 + + if (r->is_closed && src == NULL) { + return _Z_RES_CHANNEL_CLOSED; + } + if (src != NULL) { element_move(dst, src); } -#endif // Z_FEATURE_MULTI_THREAD == 1 return _Z_RES_OK; } diff --git a/tests/z_channels_test.c b/tests/z_channels_test.c index 80ea7e9f4..2d936e957 100644 --- a/tests/z_channels_test.c +++ b/tests/z_channels_test.c @@ -190,14 +190,14 @@ void zero_size_test(void) { z_owned_fifo_handler_sample_t fifo_handler; assert(z_fifo_channel_sample_new(&closure, &fifo_handler, 0) != Z_OK); assert(z_fifo_channel_sample_new(&closure, &fifo_handler, 1) == Z_OK); - z_drop(z_move(fifo_handler)); z_drop(z_move(closure)); + z_drop(z_move(fifo_handler)); z_owned_ring_handler_sample_t ring_handler; assert(z_ring_channel_sample_new(&closure, &ring_handler, 0) != Z_OK); assert(z_ring_channel_sample_new(&closure, &ring_handler, 1) == Z_OK); - z_drop(z_move(ring_handler)); z_drop(z_move(closure)); + z_drop(z_move(ring_handler)); } int main(void) {