Skip to content

Commit 16347c7

Browse files
committed
iox-#27 Remove CaptureStderr to prevent fatal LSAN error
1 parent 2473871 commit 16347c7

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

iceoryx_posh/test/moduletests/test_mepoo_segment_management.cpp

+5-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2-
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
2+
// Copyright (c) 2021 - 2022 by Apex.AI Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -49,31 +49,13 @@ class MePooSegmentMock
4949
class SegmentManager_test : public Test
5050
{
5151
public:
52-
SegmentManager_test()
53-
: surpressOutput{SurpressOutput(true)}
52+
void SetUp() override
5453
{
5554
}
56-
57-
~SegmentManager_test()
58-
{
59-
if (surpressOutput)
60-
{
61-
if (Test::HasFailure())
62-
{
63-
std::cout << testing::internal::GetCapturedStderr() << std::endl;
64-
}
65-
else
66-
{
67-
(void)testing::internal::GetCapturedStderr();
68-
}
69-
}
70-
}
71-
72-
void SetUp(){};
73-
void TearDown()
55+
void TearDown() override
7456
{
7557
iox::rp::BaseRelativePointer::unregisterAll();
76-
};
58+
}
7759

7860
MePooConfig getMempoolConfig()
7961
{
@@ -109,16 +91,8 @@ class SegmentManager_test : public Test
10991
return config;
11092
}
11193

112-
bool SurpressOutput(const bool v)
113-
{
114-
if (v)
115-
{
116-
testing::internal::CaptureStderr();
117-
}
118-
return v;
119-
}
94+
iox::cxx::GenericRAII logLevelScopeGuard{iox::LoggerPosh().SetLogLevelForScope(iox::log::LogLevel::kError)};
12095

121-
bool surpressOutput;
12296
static constexpr size_t MEM_SIZE{20000};
12397
char memory[MEM_SIZE];
12498
iox::posix::Allocator allocator{memory, MEM_SIZE};

0 commit comments

Comments
 (0)