[Lldb-commits] [PATCH] D110962: [lldb] Add unit tests for Terminal API

David Zarzycki via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 5 07:15:57 PDT 2021


davezarzycki added a comment.

"the buildbot"? There are many. I'd be surprised if this weren't failing on at least one of them. It doesn't seem like subtle terminfo behavior is essential to this test. Can we please trim down the adjustments to only changing the speed? For example:

  diff --git i/lldb/unittests/Host/posix/TerminalTest.cpp w/lldb/unittests/Host/posix/TerminalTest.cpp
  index ecdb5480216439903b9fc12c39b3d47cb62f9134..e865d44bf6cb9085f07c11e06be34f33a7bd32b9 100644
  --- i/lldb/unittests/Host/posix/TerminalTest.cpp
  +++ w/lldb/unittests/Host/posix/TerminalTest.cpp
  @@ -80,14 +80,8 @@ TEST_F(TerminalTest, SaveRestoreRAII) {
       terminfo = orig_terminfo;
  
       // make some arbitrary changes
  -    terminfo.c_iflag ^= IGNPAR | INLCR;
  -    terminfo.c_oflag ^= OPOST | OCRNL;
  -    terminfo.c_cflag ^= PARENB | PARODD;
  -    terminfo.c_lflag ^= ICANON | ECHO;
  -    terminfo.c_cc[VEOF] ^= 8;
  -    terminfo.c_cc[VEOL] ^= 4;
  -    cfsetispeed(&terminfo, B9600);
  -    cfsetospeed(&terminfo, B9600);
  +    cfsetispeed(&terminfo, cfgetispeed(&orig_terminfo) == B9600 ? B4800 : B9600);
  +    cfsetospeed(&terminfo, cfgetospeed(&orig_terminfo) == B9600 ? B4800 : B9600);
  
       ASSERT_EQ(tcsetattr(m_pty.GetPrimaryFileDescriptor(), TCSANOW, &terminfo),
                 0);
  @@ -109,14 +103,8 @@ TEST_F(TerminalTest, SaveRestore) {
     terminfo = orig_terminfo;
  
     // make some arbitrary changes
  -  terminfo.c_iflag ^= IGNPAR | INLCR;
  -  terminfo.c_oflag ^= OPOST | OCRNL;
  -  terminfo.c_cflag ^= PARENB | PARODD;
  -  terminfo.c_lflag ^= ICANON | ECHO;
  -  terminfo.c_cc[VEOF] ^= 8;
  -  terminfo.c_cc[VEOL] ^= 4;
  -  cfsetispeed(&terminfo, B9600);
  -  cfsetospeed(&terminfo, B9600);
  +  cfsetispeed(&terminfo, cfgetispeed(&orig_terminfo) == B9600 ? B4800 : B9600);
  +  cfsetospeed(&terminfo, cfgetospeed(&orig_terminfo) == B9600 ? B4800 : B9600);
  
     ASSERT_EQ(tcsetattr(m_pty.GetPrimaryFileDescriptor(), TCSANOW, &terminfo), 0);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110962/new/

https://reviews.llvm.org/D110962



More information about the lldb-commits mailing list