Skip to content

Commit 18c61d2

Browse files
rocFile: Test stream destructor without leaking memory.
1 parent 3d192d9 commit 18c61d2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

rocfile/test/stream.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,17 @@ TEST_F(RocFileStream, deregister_with_unregistered_stream_throws)
103103
ASSERT_THROW(stream_map.deregisterStream(nonnull_stream), std::invalid_argument);
104104
}
105105

106-
TEST_F(RocFileStream, destructor_with_streams_in_use_logs)
106+
TEST(RocFileStreamDestructor, destructor_with_streams_in_use_logs)
107107
{
108-
stream_map.registerStream(reinterpret_cast<hipStream_t>(1), 0);
109-
EXPECT_CALL(msys, syslog);
110-
std::shared_ptr<IStream> *stream =
111-
new std::shared_ptr<IStream>(stream_map.getStream(reinterpret_cast<hipStream_t>(1)));
112-
(void)stream;
108+
StrictMock<MHip> mhip;
109+
StrictMock<MSys> msys;
110+
std::shared_ptr<IStream> stream;
111+
{
112+
StreamMap stream_map;
113+
stream_map.registerStream(reinterpret_cast<hipStream_t>(1), 0);
114+
EXPECT_CALL(msys, syslog);
115+
stream = stream_map.getStream(reinterpret_cast<hipStream_t>(1));
116+
}
113117
}
114118

115119
struct RocFileStreamExternal : public RocFileOpened {

0 commit comments

Comments
 (0)