diff options
author | Patrick Venture <venture@google.com> | 2018-08-29 11:41:01 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-11-11 08:21:26 -0800 |
commit | 59a6b1f27e83066baa6f3711c88d6a3b9a5c4d49 (patch) | |
tree | 56c0b0abc5dd83b3d83ab598f47df663b8561e80 /phosphor-logging/test | |
parent | 30047bf9647215951ba5dfe21ceb3e58a1b405a4 (diff) | |
download | phosphor-logging-59a6b1f27e83066baa6f3711c88d6a3b9a5c4d49.tar.gz phosphor-logging-59a6b1f27e83066baa6f3711c88d6a3b9a5c4d49.zip |
add sdjournal interface to inject tests
The goal of the tests is not to test phosphor-logging, but rather allow
code to call through phosphor-logging/log<> during a test.
Change-Id: Id8c84ded473decc7f9f0be268116083093f86e54
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'phosphor-logging/test')
-rw-r--r-- | phosphor-logging/test/sdjournal_mock.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/phosphor-logging/test/sdjournal_mock.hpp b/phosphor-logging/test/sdjournal_mock.hpp new file mode 100644 index 0000000..3290480 --- /dev/null +++ b/phosphor-logging/test/sdjournal_mock.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include <phosphor-logging/sdjournal.hpp> + +#include <gmock/gmock.h> + +namespace phosphor +{ +namespace logging +{ + +class SdJournalMock : public SdJournalImpl +{ + public: + virtual ~SdJournalMock() = default; + + /* Set your mock to catch this call. */ + MOCK_METHOD1(journal_send_call, int(const char*)); + + int journal_send(const char* fmt, ...) override + { + return journal_send_call(fmt); + } +} + +} // namespace logging +} // namespace phosphor |