[Lldb-commits] [lldb] r358918 - [EditLineTest] Not always TERM is available, e.g. on some bots.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 22 13:27:10 PDT 2019


Author: davide
Date: Mon Apr 22 13:27:10 2019
New Revision: 358918

URL: http://llvm.org/viewvc/llvm-project?rev=358918&view=rev
Log:
[EditLineTest] Not always TERM is available, e.g. on some bots.

Modified:
    lldb/trunk/unittests/Editline/EditlineTest.cpp

Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/EditlineTest.cpp?rev=358918&r1=358917&r2=358918&view=diff
==============================================================================
--- lldb/trunk/unittests/Editline/EditlineTest.cpp (original)
+++ lldb/trunk/unittests/Editline/EditlineTest.cpp Mon Apr 22 13:27:10 2019
@@ -244,17 +244,19 @@ private:
   EditlineAdapter _el_adapter;
   std::shared_ptr<std::thread> _sp_output_thread;
 
+protected:
+  bool _has_term = true;
+
 public:
   void SetUp() {
     FileSystem::Initialize();
 
     // We need a TERM set properly for editline to work as expected.
-    setenv("TERM", "vt100", 1);
+    if (setenv("TERM", "vt100", 1) != 0)
+      _has_term = false;
 
     // Validate the editline adapter.
     EXPECT_TRUE(_el_adapter.IsValid());
-    if (!_el_adapter.IsValid())
-      return;
 
     // Dump output.
     _sp_output_thread =
@@ -273,6 +275,10 @@ public:
 };
 
 TEST_F(EditlineTestFixture, EditlineReceivesSingleLineText) {
+  // Skip if we don't have a TERM.
+  if (!_has_term)
+    return;
+
   // Send it some text via our virtual keyboard.
   const std::string input_text("Hello, world");
   EXPECT_TRUE(GetEditlineAdapter().SendLine(input_text));
@@ -289,6 +295,10 @@ TEST_F(EditlineTestFixture, EditlineRece
 }
 
 TEST_F(EditlineTestFixture, EditlineReceivesMultiLineText) {
+  // Skip if we don't have a TERM.
+  if (!_has_term)
+    return;
+
   // Send it some text via our virtual keyboard.
   std::vector<std::string> input_lines;
   input_lines.push_back("int foo()");




More information about the lldb-commits mailing list