But I would like to see our unit-test-only increase for various reasons. One is that smoke tests may not be runnable on Github, since they need an actual dax device. Moreover, there are some inherently hard-to-cover branches - mmap failures and file open failures are top of the list here. We probably need to enable mocking for open and mmap here in order to properly test failures in those functions.
So please work on unit (or smoke) test code coverage improvements, but especially unit test coverage improvements and send PRs.
Better unit test coverage will be good since enabling Github coverage reporting probably can't include coverage from smoke tests (but please correct me if this seems wrong).
Here are some notes I made about "low hanging fruit" to improve coverage...
Test coverage
TODO unit famfs_validate_log_entry
TODO famfs_logplay
TODO famfs_mkfile with zero length
TODO famfs_relpath_from_fullpath
TODO can we even get to famfs_log_file_creation if the log is full?
TODO find_real_parent_path - depth > 64
TODO famfs_fsck: superblock file can't be opened
TODO fafms_fsck: superblock can be opened but not read
TODO famfs_fsck: log file can't be opened
TODO famfs_fsck: log file can be opened but not read
TODO famfs_fsck: invalid superblock
TODO famfs_validate_superblock_by_path: invalid superblock file
TODO famfs_build_bitmap: invalid log entry
TODO bitmap_alloc_contiguous: alloc size overhangs end of device
how is this not tested?
TODO famfs_init_locked_log: fail to open llog file
TODO famfs_file_create: disable_write not tested. why?
TODO famfs_cp verbose > 1
TODO famfs_cp: destination exists and is not a directory
TODO famfs_cp_dir: src is dir and verbose > 1
TODO famfs_cp_dir src exists but is not a file or a dir
TODO famfs_clone when role is not master
TODO famfs_clone: err_out
TODO famfs_clone: when log is full?
TODO famfs_mkfs: can't get system uuid
TODO famfs_mkfs: famfs_get_mpt_by_dev fails (invalid dev)
TODO famfs_mkfs: kill superblock and can't map_superblock_and_log_raw...
TODO famfs_mkfs: no kill but role == client
TODO famfs_check finds file other than file or dir
TODO famfs flush: nonexistent file
TODO famfs flush: call on directoory (should fail)
We use gcov to test code coverage. We are currently (and will probably continue to) use a combination of smoke and unit tests to measure "official" coverage (see https://github.com/cxl-micron-reskit/famfs/blob/master/markdown/getting-started.md).
But I would like to see our unit-test-only increase for various reasons. One is that smoke tests may not be runnable on Github, since they need an actual dax device. Moreover, there are some inherently hard-to-cover branches - mmap failures and file open failures are top of the list here. We probably need to enable mocking for open and mmap here in order to properly test failures in those functions.
So please work on unit (or smoke) test code coverage improvements, but especially unit test coverage improvements and send PRs.
Better unit test coverage will be good since enabling Github coverage reporting probably can't include coverage from smoke tests (but please correct me if this seems wrong).