[Lldb-commits] [lldb] 75e93ec - [lldb][TerminalTest] Fix assertion failure

Kazuki Sakamoto via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 15 21:32:58 PDT 2023


Author: Kazuki Sakamoto
Date: 2023-06-15T21:24:40-07:00
New Revision: 75e93ec720739291640005681f062b0e1e8e0f53

URL: https://github.com/llvm/llvm-project/commit/75e93ec720739291640005681f062b0e1e8e0f53
DIFF: https://github.com/llvm/llvm-project/commit/75e93ec720739291640005681f062b0e1e8e0f53.diff

LOG: [lldb][TerminalTest] Fix assertion failure

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.

Differential Revision: https://reviews.llvm.org/D153091

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Host/posix/TerminalTest.cpp b/lldb/unittests/Host/posix/TerminalTest.cpp
index 1cf7b9bc8f3b0..5187a0c20a68b 100644
--- a/lldb/unittests/Host/posix/TerminalTest.cpp
+++ b/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 @@ using namespace lldb_private;
 
 class TerminalTest : public ::testing::Test {
 protected:
+  SubsystemRAII<FileSystem> subsystems;
   PseudoTerminal m_pty;
   int m_fd;
   Terminal m_term;


        


More information about the lldb-commits mailing list