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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: tests: Timeval: adapt to have reproducible output and enable autotest ...................................................................... tests: Timeval: adapt to have reproducible output and enable autotest Change-Id: I1a79892ba3c934879a171789e0edb357277acae4 --- M tests/CommonLibs/TimevalTest.cpp M tests/CommonLibs/TimevalTest.ok M tests/testsuite.at 3 files changed, 23 insertions(+), 31 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/CommonLibs/TimevalTest.cpp b/tests/CommonLibs/TimevalTest.cpp index b4746f2..f579878 100644 --- a/tests/CommonLibs/TimevalTest.cpp +++ b/tests/CommonLibs/TimevalTest.cpp @@ -28,18 +28,31 @@ #include "Timeval.h" #include <iostream> +#include <assert.h> using namespace std; int main(int argc, char *argv[]) { - Timeval then(10000); - cout << then.elapsed() << endl; + assert(then.elapsed() == -10000); + cerr << then << " elapsed: " << then.elapsed() << endl; + double then_seconds = then.seconds(); + double last_now = Timeval().seconds(); + long last_remaining = 10000; + int loops = 0; while (!then.passed()) { - cout << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl; + double tnow = Timeval().seconds(); + cerr << "now: " << tnow << " then: " << then << " remaining: " << then.remaining() << endl; + assert(last_now <= tnow && last_remaining >= then.remaining()); + assert(then_seconds == then.seconds()); usleep(500000); + loops++; } - cout << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl; + cerr << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl; + assert(then.remaining() <= 0); + assert(loops >= 18); + + printf("Done\n"); } diff --git a/tests/CommonLibs/TimevalTest.ok b/tests/CommonLibs/TimevalTest.ok index c97031d..a965a70 100644 --- a/tests/CommonLibs/TimevalTest.ok +++ b/tests/CommonLibs/TimevalTest.ok @@ -1,22 +1 @@ --10000 -now: 1515515602.357742 then: 1515515612.357710 remaining: 10000 -now: 1515515602.857837 then: 1515515612.357710 remaining: 9500 -now: 1515515603.357975 then: 1515515612.357710 remaining: 9000 -now: 1515515603.858163 then: 1515515612.357710 remaining: 8500 -now: 1515515604.358353 then: 1515515612.357710 remaining: 8000 -now: 1515515604.858465 then: 1515515612.357710 remaining: 7500 -now: 1515515605.358622 then: 1515515612.357710 remaining: 7000 -now: 1515515605.858745 then: 1515515612.357710 remaining: 6499 -now: 1515515606.358852 then: 1515515612.357710 remaining: 5999 -now: 1515515606.859055 then: 1515515612.357710 remaining: 5499 -now: 1515515607.359170 then: 1515515612.357710 remaining: 4999 -now: 1515515607.859349 then: 1515515612.357710 remaining: 4499 -now: 1515515608.359455 then: 1515515612.357710 remaining: 3999 -now: 1515515608.859549 then: 1515515612.357710 remaining: 3499 -now: 1515515609.359748 then: 1515515612.357710 remaining: 2998 -now: 1515515609.859865 then: 1515515612.357710 remaining: 2498 -now: 1515515610.360064 then: 1515515612.357710 remaining: 1998 -now: 1515515610.860223 then: 1515515612.357710 remaining: 1498 -now: 1515515611.360386 then: 1515515612.357710 remaining: 998 -now: 1515515611.860592 then: 1515515612.357710 remaining: 498 -now: 1515515612.360712 then: 1515515612.357710 remaining: -3 +Done diff --git a/tests/testsuite.at b/tests/testsuite.at index 5d519d2..8e9a541 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -32,11 +32,11 @@ #AT_CHECK([$abs_top_builddir/tests/CommonLibs/SocketsTest], [], [expout], []) #AT_CLEANUP -#AT_SETUP([TimevalTest]) -#AT_KEYWORDS([TimevalTest]) -#cat $abs_srcdir/CommonLibs/TimevalTest.ok > expout -#AT_CHECK([$abs_top_builddir/tests/CommonLibs/TimevalTest], [], [expout], []) -#AT_CLEANUP +AT_SETUP([TimevalTest]) +AT_KEYWORDS([TimevalTest]) +cat $abs_srcdir/CommonLibs/TimevalTest.ok > expout +AT_CHECK([$abs_top_builddir/tests/CommonLibs/TimevalTest], [], [expout], [ignore]) +AT_CLEANUP AT_SETUP([VectorTest]) AT_KEYWORDS([VectorTest]) -- To view, visit https://gerrit.osmocom.org/5708 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1a79892ba3c934879a171789e0edb357277acae4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>