Fix broken BufferHubQueueTest.TestRemoveBuffer
Under certain condition, it's unsafe to nullify the consumer channel
within producer channel's destructor.
Bug: 38137191
Bug: 70046255
Bug: 70912269
Test: buffer_hub-test, buffer_hub_queue-tests, buffer_hub_queue_producer-tesst
Change-Id: Ifbed85e687e71340f6876e4e85c792ae1d6b06f6
diff --git a/libs/vr/libbufferhub/buffer_hub-test.cpp b/libs/vr/libbufferhub/buffer_hub-test.cpp
index 3ce5c9f..660a200 100644
--- a/libs/vr/libbufferhub/buffer_hub-test.cpp
+++ b/libs/vr/libbufferhub/buffer_hub-test.cpp
@@ -769,9 +769,14 @@
auto s3 = p->CreateConsumer();
EXPECT_FALSE(s3);
+ // Note that here the expected error code is EOPNOTSUPP as the socket towards
+ // ProducerChannel has been teared down.
EXPECT_EQ(s3.error(), EOPNOTSUPP);
s3 = c->CreateConsumer();
EXPECT_FALSE(s3);
- EXPECT_EQ(s3.error(), EOPNOTSUPP);
+ // Note that here the expected error code is EPIPE returned from
+ // ConsumerChannel::HandleMessage as the socket is still open but the producer
+ // is gone.
+ EXPECT_EQ(s3.error(), EPIPE);
}