aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mdns/main.cpp2
-rw-r--r--tests/mdns/test_subscribe.cpp2
-rw-r--r--tests/unit/test_logging.cpp24
3 files changed, 22 insertions, 6 deletions
diff --git a/tests/mdns/main.cpp b/tests/mdns/main.cpp
index e8fe3552..acf8777c 100644
--- a/tests/mdns/main.cpp
+++ b/tests/mdns/main.cpp
@@ -482,7 +482,7 @@ int main(int argc, char *argv[])
return 1;
}
- otbrLogInit("otbr-mdns", OTBR_LOG_DEBUG, true);
+ otbrLogInit("otbr-mdns", OTBR_LOG_DEBUG, true, false);
// allow quitting elegantly
signal(SIGTERM, RecoverSignal);
switch (argv[1][0])
diff --git a/tests/mdns/test_subscribe.cpp b/tests/mdns/test_subscribe.cpp
index 554a33f0..b01be3eb 100644
--- a/tests/mdns/test_subscribe.cpp
+++ b/tests/mdns/test_subscribe.cpp
@@ -130,7 +130,7 @@ Ip6Address sAddr4;
void SetUp(void)
{
- otbrLogInit("test-mdns-subscriber", OTBR_LOG_INFO, true);
+ otbrLogInit("test-mdns-subscriber", OTBR_LOG_INFO, true, false);
SuccessOrDie(Ip6Address::FromString("2002::1", sAddr1), "");
SuccessOrDie(Ip6Address::FromString("2002::2", sAddr2), "");
SuccessOrDie(Ip6Address::FromString("2002::3", sAddr3), "");
diff --git a/tests/unit/test_logging.cpp b/tests/unit/test_logging.cpp
index 30bd476c..c2997035 100644
--- a/tests/unit/test_logging.cpp
+++ b/tests/unit/test_logging.cpp
@@ -43,7 +43,7 @@ TEST(Logging, TestLoggingHigherLevel)
char ident[20];
snprintf(ident, sizeof(ident), "otbr-test-%ld", clock());
- otbrLogInit(ident, OTBR_LOG_INFO, true);
+ otbrLogInit(ident, OTBR_LOG_INFO, true, false);
otbrLog(OTBR_LOG_DEBUG, OTBR_LOG_TAG, "cool-higher");
otbrLogDeinit();
sleep(0);
@@ -58,7 +58,7 @@ TEST(Logging, TestLoggingEqualLevel)
char ident[20];
snprintf(ident, sizeof(ident), "otbr-test-%ld", clock());
- otbrLogInit(ident, OTBR_LOG_INFO, true);
+ otbrLogInit(ident, OTBR_LOG_INFO, true, false);
otbrLog(OTBR_LOG_INFO, OTBR_LOG_TAG, "cool-equal");
otbrLogDeinit();
sleep(0);
@@ -69,13 +69,29 @@ TEST(Logging, TestLoggingEqualLevel)
CHECK(0 == system(cmd));
}
+TEST(Logging, TestLoggingEqualLevelNoSyslog)
+{
+ char ident[20];
+
+ snprintf(ident, sizeof(ident), "otbr-test-%ld", clock());
+ otbrLogInit(ident, OTBR_LOG_INFO, true, true);
+ otbrLog(OTBR_LOG_INFO, OTBR_LOG_TAG, "cool-equal");
+ otbrLogDeinit();
+ sleep(0);
+
+ char cmd[128];
+ snprintf(cmd, sizeof(cmd), "grep '%s.*cool-equal' /var/log/syslog", ident);
+ printf("CMD = %s\n", cmd);
+ CHECK(0 != system(cmd));
+}
+
TEST(Logging, TestLoggingLowerLevel)
{
char ident[20];
char cmd[128];
snprintf(ident, sizeof(ident), "otbr-test-%ld", clock());
- otbrLogInit(ident, OTBR_LOG_INFO, true);
+ otbrLogInit(ident, OTBR_LOG_INFO, true, false);
otbrLog(OTBR_LOG_WARNING, OTBR_LOG_TAG, "cool-lower");
otbrLogDeinit();
sleep(0);
@@ -90,7 +106,7 @@ TEST(Logging, TestLoggingDump)
char cmd[128];
snprintf(ident, sizeof(ident), "otbr-test-%ld", clock());
- otbrLogInit(ident, OTBR_LOG_DEBUG, true);
+ otbrLogInit(ident, OTBR_LOG_DEBUG, true, false);
const char s[] = "one super long string with lots of text";
otbrDump(OTBR_LOG_INFO, "Test", "foobar", s, sizeof(s));
otbrLogDeinit();