diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-04-03 14:37:01 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-04-03 14:37:01 +0200 |
commit | dac529d0484c34424d3930e1b2ac4737ae98812f (patch) | |
tree | 410c3240b43baa5b91fdbe57f49ebcf820a64ec2 /logd/src/tests | |
parent | 162d34589e06059c2cbfdfb6b23da7c0bab0f2f6 (diff) |
Change Watcher to not pass newline to forwardLine().
Diffstat (limited to 'logd/src/tests')
-rw-r--r-- | logd/src/tests/legacy_forwarder/legacy_forwarder_test.cpp | 4 | ||||
-rw-r--r-- | logd/src/tests/watcher/watcher_test.cpp | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/logd/src/tests/legacy_forwarder/legacy_forwarder_test.cpp b/logd/src/tests/legacy_forwarder/legacy_forwarder_test.cpp index d3339894819..67d47a49384 100644 --- a/logd/src/tests/legacy_forwarder/legacy_forwarder_test.cpp +++ b/logd/src/tests/legacy_forwarder/legacy_forwarder_test.cpp @@ -40,7 +40,7 @@ struct ForwardFixture { timer.SetNow(); std::stringstream ss; ss << std::fixed << timer.Secs(); - ss << "\texample.yahoo.com\t7518/34779\tlogd\tlogdemon\tevent\tstarted/1 name=\"logdemon\"\n"; + ss << "\texample.yahoo.com\t7518/34779\tlogd\tlogdemon\tevent\tstarted/1 name=\"logdemon\""; return ss.str(); } @@ -50,7 +50,7 @@ struct ForwardFixture { int rfd = open(fname.c_str(), O_RDONLY); char *buffer[2048]; ssize_t bytes = read(rfd, buffer, 2048); - ssize_t expected = doForward ? logLine.length() : 0; + ssize_t expected = doForward ? logLine.length() + 1 : 0; EXPECT_EQUAL(expected, bytes); close(rfd); } diff --git a/logd/src/tests/watcher/watcher_test.cpp b/logd/src/tests/watcher/watcher_test.cpp index c2b379cc1a4..fffaac17058 100644 --- a/logd/src/tests/watcher/watcher_test.cpp +++ b/logd/src/tests/watcher/watcher_test.cpp @@ -71,8 +71,7 @@ struct DummyForwarder : public Forwarder { void sendMode() override { ++sendModeCount; } void forwardLine(std::string_view log_line) override { std::lock_guard guard(lock); - assert(log_line.size() > 0u); - lines.emplace_back(log_line.substr(0, log_line.size() - 1)); + lines.emplace_back(log_line); cond.notify_all(); } void flush() override { } |