Commit 1dfbd621 authored by Dominik Charousset's avatar Dominik Charousset

Fix false positives in `test_message_lifetime`

parent f6ca2450
......@@ -29,7 +29,7 @@ behavior testee::make_behavior() {
others() >> [=] {
CAF_CHECK_EQUAL(last_dequeued().cvals()->get_reference_count(), 2);
quit();
return last_dequeued();
return std::move(last_dequeued());
}
};
}
......@@ -97,6 +97,7 @@ void test_message_lifetime_in_scoped_actor() {
CAF_CHECK_EQUAL(msg.get_as<int>(0), 42);
}
template <spawn_options Os>
void test_message_lifetime() {
test_message_lifetime_in_scoped_actor();
if (CAF_TEST_RESULT() != 0) {
......@@ -104,13 +105,17 @@ void test_message_lifetime() {
}
// put some preassure on the scheduler (check for thread safety)
for (size_t i = 0; i < 100; ++i) {
spawn<tester>(spawn<testee>());
spawn<tester>(spawn<testee, Os>());
}
}
int main() {
CAF_TEST(test_message_lifetime);
test_message_lifetime();
CAF_PRINT("test_message_lifetime<no_spawn_options>");
test_message_lifetime<no_spawn_options>();
await_all_actors_done();
CAF_PRINT("test_message_lifetime<priority_aware>");
test_message_lifetime<priority_aware>();
await_all_actors_done();
shutdown();
return CAF_TEST_RESULT();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment