tests: Log: adapt to have reproducible output and enable autotest

Change-Id: I77c40230503acadef5f64ab2624cd872f9782b98
This commit is contained in:
Pau Espin 2018-01-09 19:42:58 +01:00
parent 2652f2bc39
commit a3694bd303
4 changed files with 91 additions and 89 deletions

View File

@ -41,21 +41,21 @@ int main(int argc, char *argv[])
{ {
gLogInit("LogTest","NOTICE",LOG_LOCAL7); gLogInit("LogTest","NOTICE",LOG_LOCAL7);
LOG(EMERG) << " testing the logger."; Log(LOG_EMERG).get() << " testing the logger.";
LOG(ALERT) << " testing the logger."; Log(LOG_ALERT).get() << " testing the logger.";
LOG(CRIT) << " testing the logger."; Log(LOG_CRIT).get() << " testing the logger.";
LOG(ERR) << " testing the logger."; Log(LOG_ERR).get() << " testing the logger.";
LOG(WARNING) << " testing the logger."; Log(LOG_WARNING).get() << " testing the logger.";
LOG(NOTICE) << " testing the logger."; Log(LOG_NOTICE).get() << " testing the logger.";
LOG(INFO) << " testing the logger."; Log(LOG_INFO).get() << " testing the logger.";
LOG(DEBUG) << " testing the logger."; Log(LOG_DEBUG).get() << " testing the logger.";
std::cout << "\n\n\n"; std::cout << "\n\n\n";
std::cout << "testing Alarms\n"; std::cout << "testing Alarms\n";
std::cout << "you should see three lines:" << std::endl; std::cout << "you should see three lines:" << std::endl;
printAlarms(); printAlarms();
std::cout << "----------- generating 20 alarms ----------" << std::endl; std::cout << "----------- generating 20 alarms ----------" << std::endl;
for (int i = 0 ; i < 20 ; ++i) { 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; std::cout << "you should see ten lines with the numbers 10..19:" << std::endl;
printAlarms(); printAlarms();

View File

@ -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. EMERG 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. ALERT 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. CRIT 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. ERR testing the logger.
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 0 ALERT 0
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 1 ALERT 1
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 2 ALERT 2
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 3 ALERT 3
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 4 ALERT 4
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 5 ALERT 5
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 6 ALERT 6
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 7 ALERT 7
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 8 ALERT 8
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 9 ALERT 9
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 10 ALERT 10
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 11 ALERT 11
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 12 ALERT 12
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 13 ALERT 13
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 14 ALERT 14
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 15 ALERT 15
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 16 ALERT 16
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 17 ALERT 17
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 18 ALERT 18
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 19 ALERT 19

View File

@ -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. EMERG 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. ALERT 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. CRIT 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. ERR 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. WARNING 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. NOTICE testing the logger.
INFO testing the logger.
DEBUG testing the logger.
testing Alarms testing Alarms
you should see three lines: you should see three lines:
# alarms = 4 # alarms = 4
EMERG 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:44:main: testing the logger. EMERG 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. ALERT 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. CRIT 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. ERR testing the logger.
----------- generating 20 alarms ---------- ----------- generating 20 alarms ----------
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 0 ALERT 0
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 1 ALERT 1
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 2 ALERT 2
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 3 ALERT 3
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 4 ALERT 4
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 5 ALERT 5
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 6 ALERT 6
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 7 ALERT 7
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 8 ALERT 8
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 9 ALERT 9
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 10 ALERT 10
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 11 ALERT 11
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 12 ALERT 12
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 13 ALERT 13
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 14 ALERT 14
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 15 ALERT 15
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 16 ALERT 16
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 17 ALERT 17
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 18 ALERT 18
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 19 ALERT 19
you should see ten lines with the numbers 10..19: you should see ten lines with the numbers 10..19:
# alarms = 20 # alarms = 20
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 0 ALERT 0
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 1 ALERT 1
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 2 ALERT 2
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 3 ALERT 3
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 4 ALERT 4
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 5 ALERT 5
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 6 ALERT 6
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 7 ALERT 7
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 8 ALERT 8
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 9 ALERT 9
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 10 ALERT 10
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 11 ALERT 11
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 12 ALERT 12
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 13 ALERT 13
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 14 ALERT 14
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 15 ALERT 15
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 16 ALERT 16
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 17 ALERT 17
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 18 ALERT 18
ALERT 140239160588096 17:32:27.2 /home/pespin/dev/sysmocom/git/osmo-trx/tests/CommonLibs/LogTest.cpp:58:main: 19 ALERT 19

View File

@ -13,12 +13,12 @@ cat $abs_srcdir/CommonLibs/InterthreadTest.ok > expout
AT_CHECK([$abs_top_builddir/tests/CommonLibs/InterthreadTest], [], [expout], [ignore]) AT_CHECK([$abs_top_builddir/tests/CommonLibs/InterthreadTest], [], [expout], [ignore])
AT_CLEANUP AT_CLEANUP
#AT_SETUP([LogTest]) AT_SETUP([LogTest])
#AT_KEYWORDS([LogTest]) AT_KEYWORDS([LogTest])
#cat $abs_srcdir/CommonLibs/LogTest.ok > expout cat $abs_srcdir/CommonLibs/LogTest.ok > expout
#cat $abs_srcdir/CommonLibs/LogTest.err > experr cat $abs_srcdir/CommonLibs/LogTest.err > experr
#AT_CHECK([$abs_top_builddir/tests/CommonLibs/LogTest], [], [expout], [experr]) AT_CHECK([$abs_top_builddir/tests/CommonLibs/LogTest], [], [expout], [experr])
#AT_CLEANUP AT_CLEANUP
AT_SETUP([PRBSTest]) AT_SETUP([PRBSTest])
AT_KEYWORDS([PRBSTest]) AT_KEYWORDS([PRBSTest])