[Lldb-commits] [PATCH] D153091: [lldb][TerminalTest] Fix assertion failure

Kazuki Sakamoto via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 15 18:02:42 PDT 2023


splhack created this revision.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
splhack requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

D152712 <https://reviews.llvm.org/D152712> replaced `llvm::sys::RetryAfterSignal(-1, ::open)` with
`FileSystem::Instance().Open` for bionic in PseudoTerminal::OpenSecondary, and
FileSystem::Instance() is failing with assertion on arm Linux.

The assertion should be FileSystem re-initialization check, therefore the
hypothesis is that TerminalTest tests are initializing FileSystem instance
repeatedly.

Use SubsystemRAII<FileSystem> to ensure tearing down the FileSystem instance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153091

Files:
  lldb/unittests/Host/posix/TerminalTest.cpp


Index: lldb/unittests/Host/posix/TerminalTest.cpp
===================================================================
--- lldb/unittests/Host/posix/TerminalTest.cpp
+++ lldb/unittests/Host/posix/TerminalTest.cpp
@@ -6,9 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/PseudoTerminal.h"
 #include "lldb/Host/Terminal.h"
 #include "llvm/Testing/Support/Error.h"
+#include "TestingSupport/SubsystemRAII.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -20,6 +22,7 @@
 
 class TerminalTest : public ::testing::Test {
 protected:
+  SubsystemRAII<FileSystem> subsystems;
   PseudoTerminal m_pty;
   int m_fd;
   Terminal m_term;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153091.531961.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230616/60533bc6/attachment.bin>


More information about the lldb-commits mailing list