From a3694bd3033a683e768d43ec740f667d50acf8d3 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 9 Jan 2018 19:42:58 +0100 Subject: tests: Log: adapt to have reproducible output and enable autotest Change-Id: I77c40230503acadef5f64ab2624cd872f9782b98 --- tests/CommonLibs/LogTest.cpp | 18 ++++---- tests/CommonLibs/LogTest.err | 48 ++++++++++---------- tests/CommonLibs/LogTest.ok | 102 ++++++++++++++++++++++--------------------- tests/testsuite.at | 12 ++--- 4 files changed, 91 insertions(+), 89 deletions(-) diff --git a/tests/CommonLibs/LogTest.cpp b/tests/CommonLibs/LogTest.cpp index 2245386..f64041d 100644 --- a/tests/CommonLibs/LogTest.cpp +++ b/tests/CommonLibs/LogTest.cpp @@ -41,21 +41,21 @@ int main(int argc, char *argv[]) { gLogInit("LogTest","NOTICE",LOG_LOCAL7); - LOG(EMERG) << " testing the logger."; - LOG(ALERT) << " testing the logger."; - LOG(CRIT) << " testing the logger."; - LOG(ERR) << " testing the logger."; - LOG(WARNING) << " testing the logger."; - LOG(NOTICE) << " testing the logger."; - LOG(INFO) << " testing the logger."; - LOG(DEBUG) << " testing the logger."; + Log(LOG_EMERG).get() << " testing the logger."; + Log(LOG_ALERT).get() << " testing the logger."; + Log(LOG_CRIT).get() << " testing the logger."; + Log(LOG_ERR).get() << " testing the logger."; + Log(LOG_WARNING).get() << " testing the logger."; + Log(LOG_NOTICE).get() << " testing the logger."; + Log(LOG_INFO).get() << " testing the logger."; + Log(LOG_DEBUG).get() << " testing the logger."; std::cout << "\n\n\n"; std::cout << "testing Alarms\n"; std::cout << "you should see three lines:" << std::endl; printAlarms(); std::cout << "----------- generating 20 alarms ----------" << std::endl; for (int i = 0 ; i < 20 ; ++i) { - LOG(ALERT) << i; + Log(LOG_ALERT).get() << i; } std::cout << "you should see ten lines with the numbers 10..19:" << std::endl; printAlarms(); diff --git a/tests/CommonLibs/LogTest.err b/tests/CommonLibs/LogTest.err index eee46b9..718ff40 100644 --- a/tests/CommonLibs/LogTest.err +++ b/tests/CommonLibs/LogTest.err @@ -1,24 +1,24 @@ -EMERG 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:44:main: testing the logger. -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:45:main: testing the logger. -CRIT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:46:main: testing the logger. -ERR 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:47:main: testing the logger. -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 0 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 1 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 2 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 3 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 4 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 5 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 6 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 7 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 8 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 9 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 10 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 11 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 12 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 13 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 14 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 15 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 16 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 17 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 18 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 19 +EMERG testing the logger. +ALERT testing the logger. +CRIT testing the logger. +ERR testing the logger. +ALERT 0 +ALERT 1 +ALERT 2 +ALERT 3 +ALERT 4 +ALERT 5 +ALERT 6 +ALERT 7 +ALERT 8 +ALERT 9 +ALERT 10 +ALERT 11 +ALERT 12 +ALERT 13 +ALERT 14 +ALERT 15 +ALERT 16 +ALERT 17 +ALERT 18 +ALERT 19 diff --git a/tests/CommonLibs/LogTest.ok b/tests/CommonLibs/LogTest.ok index 724f053..e1211b0 100644 --- a/tests/CommonLibs/LogTest.ok +++ b/tests/CommonLibs/LogTest.ok @@ -1,59 +1,61 @@ -EMERG 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:44:main: testing the logger. -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:45:main: testing the logger. -CRIT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:46:main: testing the logger. -ERR 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:47:main: testing the logger. -WARNING 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:48:main: testing the logger. -NOTICE 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:49:main: testing the logger. +EMERG testing the logger. +ALERT testing the logger. +CRIT testing the logger. +ERR testing the logger. +WARNING testing the logger. +NOTICE testing the logger. +INFO testing the logger. +DEBUG testing the logger. testing Alarms you should see three lines: # alarms = 4 -EMERG 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:44:main: testing the logger. -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:45:main: testing the logger. -CRIT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:46:main: testing the logger. -ERR 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:47:main: testing the logger. +EMERG testing the logger. +ALERT testing the logger. +CRIT testing the logger. +ERR testing the logger. ----------- generating 20 alarms ---------- -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 0 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 1 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 2 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 3 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 4 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 5 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 6 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 7 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 8 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 9 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 10 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 11 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 12 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 13 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 14 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 15 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 16 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 17 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 18 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 19 +ALERT 0 +ALERT 1 +ALERT 2 +ALERT 3 +ALERT 4 +ALERT 5 +ALERT 6 +ALERT 7 +ALERT 8 +ALERT 9 +ALERT 10 +ALERT 11 +ALERT 12 +ALERT 13 +ALERT 14 +ALERT 15 +ALERT 16 +ALERT 17 +ALERT 18 +ALERT 19 you should see ten lines with the numbers 10..19: # alarms = 20 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 0 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 1 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 2 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 3 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 4 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 5 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 6 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 7 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 8 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 9 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 10 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 11 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 12 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 13 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 14 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 15 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 16 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 17 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 18 -ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 19 +ALERT 0 +ALERT 1 +ALERT 2 +ALERT 3 +ALERT 4 +ALERT 5 +ALERT 6 +ALERT 7 +ALERT 8 +ALERT 9 +ALERT 10 +ALERT 11 +ALERT 12 +ALERT 13 +ALERT 14 +ALERT 15 +ALERT 16 +ALERT 17 +ALERT 18 +ALERT 19 diff --git a/tests/testsuite.at b/tests/testsuite.at index 8e9a541..f6b48af 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -13,12 +13,12 @@ cat $abs_srcdir/CommonLibs/InterthreadTest.ok > expout AT_CHECK([$abs_top_builddir/tests/CommonLibs/InterthreadTest], [], [expout], [ignore]) AT_CLEANUP -#AT_SETUP([LogTest]) -#AT_KEYWORDS([LogTest]) -#cat $abs_srcdir/CommonLibs/LogTest.ok > expout -#cat $abs_srcdir/CommonLibs/LogTest.err > experr -#AT_CHECK([$abs_top_builddir/tests/CommonLibs/LogTest], [], [expout], [experr]) -#AT_CLEANUP +AT_SETUP([LogTest]) +AT_KEYWORDS([LogTest]) +cat $abs_srcdir/CommonLibs/LogTest.ok > expout +cat $abs_srcdir/CommonLibs/LogTest.err > experr +AT_CHECK([$abs_top_builddir/tests/CommonLibs/LogTest], [], [expout], [experr]) +AT_CLEANUP AT_SETUP([PRBSTest]) AT_KEYWORDS([PRBSTest]) -- cgit v1.2.3