[PATCH] osmo-trx[master]: tests: Log: adapt to have reproducible output and enable aut...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Jan 9 19:29:10 UTC 2018


Review at  https://gerrit.osmocom.org/5709

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

Change-Id: I77c40230503acadef5f64ab2624cd872f9782b98
---
M tests/CommonLibs/LogTest.cpp
M tests/CommonLibs/LogTest.err
M tests/CommonLibs/LogTest.ok
M tests/testsuite.at
4 files changed, 91 insertions(+), 89 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/09/5709/1

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 @@
 {
 	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 @@
 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])

-- 
To view, visit https://gerrit.osmocom.org/5709
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77c40230503acadef5f64ab2624cd872f9782b98
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list