From 328889d5a6d0926f4876f3692713a759185812e1 Mon Sep 17 00:00:00 2001 From: Andrew Geissler Date: Mon, 10 Oct 2016 12:43:48 -0500 Subject: Add in test case which validates elog client interface Change-Id: I5c5f7a550a8f272251893ff616408c41d32281f9 Signed-off-by: Andrew Geissler --- test/Makefile.am | 12 ++++++++++++ test/elog_unittest.cpp | 7 +++++++ test/logging_test.cpp | 46 ---------------------------------------------- 3 files changed, 19 insertions(+), 46 deletions(-) create mode 100644 test/Makefile.am create mode 100644 test/elog_unittest.cpp delete mode 100644 test/logging_test.cpp (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..ee0881b --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,12 @@ +# gtest unit tests which run during a 'make check' +check_PROGRAMS = + +# Run all 'check' test programs +TESTS = $(check_PROGRAMS) + +# Basic test suite for elog interfaces +check_PROGRAMS += elog_unittest +elog_unittest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) +elog_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) +elog_unittest_LDFLAGS = -lgtest_main -lgtest $(PTHREAD_LIBS) $(OESDK_TESTCASE_FLAGS) +elog_unittest_SOURCES = elog_unittest.cpp \ No newline at end of file diff --git a/test/elog_unittest.cpp b/test/elog_unittest.cpp new file mode 100644 index 0000000..cc14189 --- /dev/null +++ b/test/elog_unittest.cpp @@ -0,0 +1,7 @@ +#include +#include + +// TODO - need to get gtest working in the SDK +TEST(BasicLog, Zero) { + EXPECT_EQ(1, 1); +} diff --git a/test/logging_test.cpp b/test/logging_test.cpp deleted file mode 100644 index 2b75854..0000000 --- a/test/logging_test.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include "elog.hpp" -#include "log.hpp" - -using namespace phosphor; -using namespace logging; - -int main() -{ - std::cout << "hello world!\n"; - - // Simple elog test - const char *test_string = "/tmp/test_string/"; - elog(file_not_found::errnum(1), - file_not_found::file_path(test_string), - file_not_found::file_name("elog_test_1.txt")); - - log("Info trace to log file path", - entry(file_not_found::file_path::str, - "/tmp/log_file_test/")); - - // pass parameter and previous_entry - elog(file_not_found::errnum(2), - prev_entry(), - file_not_found::file_name("elog_test_2.txt")); - - // Simple test to prove we fail to compile due to missing param - //elog(file_not_found::errnum(1), - // file_not_found::file_path("test")); - - // Simple test to prove we fail to compile due to invalid param - //elog(file_not_found::errnum(1), - // file_not_found::file_path("test"), - // file_not_found::file_name(1)); - - // Log tests - log("Simple Example"); - - const char *file_name = "HELLO.txt"; - int number = 0xFEFE; - - log("THIS IS A PHOSPHOR LOGGING TEST", - entry("FILE_NAME=%s_%x", file_name, number)); - - return 0; -} -- cgit v1.2.1