diff options
author | Dave Barach <dave@barachs.net> | 2020-03-11 10:31:36 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-03-12 20:55:17 +0000 |
commit | 197180031bad1e51ee032d30d8a095a51207454c (patch) | |
tree | 2ae3e81dfa609b6d532c902e13ecb82c73e72143 /src/plugins | |
parent | 7a91b0e264d1dfd911eec18a265ead2ab8a9ad82 (diff) |
vppinfra: refactor clib_timebase_t
Add a clib_time_t * argument to clib_timebase_init(...), to encourage
client code to share the vlib_main_t's clib_time_t object.
Display the current day / date in GMT via the "show time" debug CLI.
Fix the test framework so it processes the new "show time" output format.
Type: refactor
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I5e52d57eb164b7cdb6355362d520df6928491711
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/http_static/static_server.c | 3 | ||||
-rw-r--r-- | src/plugins/mactime/mactime.c | 3 | ||||
-rw-r--r-- | src/plugins/mactime/mactime_top.c | 3 | ||||
-rw-r--r-- | src/plugins/mactime/test/test_mactime.py | 4 | ||||
-rw-r--r-- | src/plugins/unittest/mactime_test.c | 4 |
5 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c index ddc8a9e3165..888cf416e80 100644 --- a/src/plugins/http_static/static_server.c +++ b/src/plugins/http_static/static_server.c @@ -1743,7 +1743,8 @@ http_static_server_main_init (vlib_main_t * vm) hsm->first_index = hsm->last_index = ~0; clib_timebase_init (&hsm->timebase, 0 /* GMT */ , - CLIB_TIMEBASE_DAYLIGHT_NONE); + CLIB_TIMEBASE_DAYLIGHT_NONE, + &vm->clib_time /* share the system clock */ ); return 0; } diff --git a/src/plugins/mactime/mactime.c b/src/plugins/mactime/mactime.c index e7dcb0389cc..bcd40b4c9e6 100644 --- a/src/plugins/mactime/mactime.c +++ b/src/plugins/mactime/mactime.c @@ -50,7 +50,8 @@ feature_init (mactime_main_t * mm) mm->lookup_table_num_buckets, mm->lookup_table_memory_size); clib_timebase_init (&mm->timebase, mm->timezone_offset, - CLIB_TIMEBASE_DAYLIGHT_USA); + CLIB_TIMEBASE_DAYLIGHT_USA, + &(mm->vlib_main->clib_time)); mm->allow_counters.name = "allow"; mm->allow_counters.stat_segment_name = "/mactime/allow"; mm->drop_counters.name = "drop"; diff --git a/src/plugins/mactime/mactime_top.c b/src/plugins/mactime/mactime_top.c index 48735a2e816..ee60535e0c2 100644 --- a/src/plugins/mactime/mactime_top.c +++ b/src/plugins/mactime/mactime_top.c @@ -480,7 +480,8 @@ main (int argc, char **argv) clib_time_init (&mm->clib_time); mm->timezone_offset = -5.0; clib_timebase_init (&mm->timebase, mm->timezone_offset, - CLIB_TIMEBASE_DAYLIGHT_USA); + CLIB_TIMEBASE_DAYLIGHT_USA, + 0 /* allocate a clib_time_t */ ); vec_add1 (mm->pattern1, (u8 *) "^/mactime/allow"); vec_add1 (mm->pattern2, (u8 *) "^/mactime/drop"); diff --git a/src/plugins/mactime/test/test_mactime.py b/src/plugins/mactime/test/test_mactime.py index fa9516cbe87..85ded33d158 100644 --- a/src/plugins/mactime/test/test_mactime.py +++ b/src/plugins/mactime/test/test_mactime.py @@ -2,7 +2,7 @@ import unittest -from framework import VppTestCase, VppTestRunner, running_extended_tests +from framework import VppTestCase, VppTestRunner, running_gcov_tests from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath @@ -31,7 +31,7 @@ class TestMactime(VppTestCase): self.logger.critical(error) self.assertNotIn('FAILED', error) - @unittest.skipUnless(running_extended_tests, "part of extended tests") + @unittest.skipUnless(running_gcov_tests, "part of code coverage tests") def test_mactime_unittest(self): """ Mactime Plugin Code Coverage Test """ cmds = ["loopback create", diff --git a/src/plugins/unittest/mactime_test.c b/src/plugins/unittest/mactime_test.c index 907022f4d88..46d6263b938 100644 --- a/src/plugins/unittest/mactime_test.c +++ b/src/plugins/unittest/mactime_test.c @@ -18,6 +18,7 @@ static int test_time_range_main (unformat_input_t * input) { + vlib_main_t *vm = vlib_get_main (); clib_timebase_t _tb, *tb = &_tb; clib_timebase_component_t _c, *cp = &_c; clib_timebase_range_t *rp = 0; @@ -30,7 +31,8 @@ test_time_range_main (unformat_input_t * input) f64 timezone_offset; /* Init time base */ - clib_timebase_init (tb, -5 /* EST */ , CLIB_TIMEBASE_DAYLIGHT_USA); + clib_timebase_init (tb, -5 /* EST */ , CLIB_TIMEBASE_DAYLIGHT_USA, + &vm->clib_time); /* Set up summer time cache */ now = clib_timebase_now (tb); |