summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2019-04-22 20:27:10 +0000
committerDavide Italiano <davide@freebsd.org>2019-04-22 20:27:10 +0000
commit2a27af82379e854ee1b0c5aa7fad6b430eab4b55 (patch)
tree4bcaff824d3b143c72f2307aa93848639d89b597 /lldb
parent906b2642517c5e473d73f49c3ba7314ba3ca5b06 (diff)
downloadbcm5719-llvm-2a27af82379e854ee1b0c5aa7fad6b430eab4b55.tar.gz
bcm5719-llvm-2a27af82379e854ee1b0c5aa7fad6b430eab4b55.zip
[EditLineTest] Not always TERM is available, e.g. on some bots.
llvm-svn: 358918
Diffstat (limited to 'lldb')
-rw-r--r--lldb/unittests/Editline/EditlineTest.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp
index 1a4bd37e767..2bfd1e7848e 100644
--- a/lldb/unittests/Editline/EditlineTest.cpp
+++ b/lldb/unittests/Editline/EditlineTest.cpp
@@ -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, EditlineReceivesSingleLineText) {
}
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()");
OpenPOWER on IntegriCloud