kasjer commented on code in PR #3365:
URL: https://github.com/apache/mynewt-core/pull/3365#discussion_r1966893302
##########
sys/log/full/selftest/fcb_bookmarks/src/log_test_fcb_bookmarks_util.c:
##########
@@ -231,7 +231,7 @@ ltfbu_init(const struct ltfbu_cfg *cfg)
TEST_ASSERT_FATAL(rc == 0);
if (cfg->bmark_count > 0) {
- log_fcb_init_bmarks(<fbu_fcb_log, ltfbu_bmarks, cfg->bmark_count);
+ log_fcb_init_bmarks(<fbu_fcb_log, ltfbu_bmarks, cfg->bmark_count,
false);
Review Comment:
This is test function called from main after
```c
int
test_log_init(void)
{
const struct flash_area *fa;
struct fcb *fcbp;
int sector_count;
int rc;
if (flash_area_open(FLASH_AREA_TEST_LOG, &fa)) {
return SYS_EUNKNOWN;
}
flash_area_to_sectors(FLASH_AREA_TEST_LOG, §or_count, NULL);
test_log_sectors = calloc(sector_count, sizeof(*test_log_sectors));
flash_area_to_sectors(FLASH_AREA_TEST_LOG, §or_count,
test_log_sectors);
test_log_fcb.fl_entries = 0;
fcbp = &test_log_fcb.fl_fcb;
fcbp->f_magic = 0x7EADBADF;
fcbp->f_version = g_log_info.li_version;
fcbp->f_sector_cnt = sector_count - 1;
fcbp->f_scratch_cnt = 1;
fcbp->f_sectors = test_log_sectors;
rc = fcb_init(fcbp);
if (rc) {
flash_area_erase(fa, 0, fa->fa_size);
rc = fcb_init(fcbp);
if (rc) {
return rc;
}
}
#if MYNEWT_VAL_LOG_FCB_SECTOR_BOOKMARKS
int bookmark_count = fcbp->f_sector_cnt +
MYNEWT_VAL_LOG_FCB_NUM_ABS_BOOKMARKS;
test_log_bookmarks = malloc(bookmark_count *
sizeof(*test_log_bookmarks));
log_fcb_init_bmarks(&test_log_fcb, test_log_bookmarks, bookmark_count,
true);
#endif
rc = log_register("test_log", &test_log, &log_fcb_handler,
&test_log_fcb, LOG_SYSLEVEL);
return rc;
}
```
Order of calls based on the only example found in unit tests except unit
tests call to `log_fcb_init_bmarks()` has **false** as last argument:
- fcb_init()
- log_fcb_init_bmarks() <- crashes inside
- log_register()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]