diff options
author | Dave Barach <dave@barachs.net> | 2017-12-05 14:48:56 -0500 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-12-06 10:43:19 +0000 |
commit | 55c79e9c7e14b501baa72bc8b415e0a66752ed01 (patch) | |
tree | fb8dce55a87d00fb412234168e229ba029c2ac11 /src/vppinfra/test_maplog.c | |
parent | 9c2c243062dd53a420f156ac3948b464fff833df (diff) |
make clib_maplog_update_header(...) globally accessible
clib_maplog_process(...): handle logs which weren't closed properly.
It will happen.
Change-Id: Ibcf9c9ea7a09991e6294050e7d2979a0d3f965cf
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra/test_maplog.c')
-rw-r--r-- | src/vppinfra/test_maplog.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/vppinfra/test_maplog.c b/src/vppinfra/test_maplog.c index c49ebd6885e..edb61bd84d0 100644 --- a/src/vppinfra/test_maplog.c +++ b/src/vppinfra/test_maplog.c @@ -38,6 +38,9 @@ process_maplog_records (clib_maplog_header_t * h, while (records_this_file--) { + /* Padding at the end of a damaged log? */ + if (e->serial_number == 0ULL) + break; fformat (stdout, "%4lld ", e->serial_number); if (++i == 8) { @@ -57,6 +60,10 @@ test_maplog_main (unformat_input_t * input) int rv; int i; test_entry_t *t; + int noclose = 0; + + if (unformat (input, "noclose")) + noclose = 1; memset (a, 0, sizeof (*a)); a->mm = mm; @@ -79,10 +86,13 @@ test_maplog_main (unformat_input_t * input) for (i = 0; i < 64 * 5; i++) { t = clib_maplog_get_entry (mm); - t->serial_number = i; + t->serial_number = i + 1; } - clib_maplog_close (mm); + if (noclose) + memset (mm, 0, sizeof (*mm)); + else + clib_maplog_close (mm); clib_maplog_process ("/tmp/maplog_test", process_maplog_records); |