Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase coverage for bdev_ubi_rpc.c #12

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/check-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

make coverage

target=70.0
target=74.0
p=$(lcov --summary coverage.info | grep "lines" | grep -Eo "[0-9]+\.[0-9]+")
if (( $(echo "$p < $target" | bc -l) )); then
echo "Error: Coverage $p% is less than $target%"
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ $(BIN_DIR)/test_disk.raw: $(BIN_DIR)/test_image.raw
truncate --size 100M $@

check:
sudo ./build/bin/test_ubi --cpumask [0,1,2] --json test/test_conf.json $(TEST_BDEVS)
sudo ./build/bin/test_ubi --cpumask [0,1,2] --json test/test_conf.json \
--json-ignore-init-errors $(TEST_BDEVS)

valgrind:
sudo valgrind ./build/bin/memcheck_ubi --cpumask [0] --json test/test_conf.json $(TEST_BDEVS)
sudo valgrind ./build/bin/memcheck_ubi --cpumask [0] \
--json-ignore-init-errors --json test/test_conf.json $(TEST_BDEVS)

coverage:
lcov --capture --directory . --exclude=`pwd`/test/'*.c' --no-external --output-file coverage.info > /dev/null
Expand Down
36 changes: 36 additions & 0 deletions test/test_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
{
"subsystem": "bdev",
"config": [
{
"method": "bdev_ubi_create",
"params": {
"name": "ubi_with_missing_args"
}
},
{
"method": "bdev_malloc_create",
"params": {
Expand All @@ -11,6 +17,36 @@
"num_blocks": 204800
}
},
{
"method": "bdev_ubi_create",
"params": {
"name": "ubi_to_be_deleted",
"base_bdev": "malloc0",
"image_path": "build/bin/test_image.raw",
"stripe_size_kb": 1024,
"copy_on_read": false,
"directio": false,
"no_sync": false
}
},
{
"method": "bdev_ubi_delete",
"params": {
"name": "invalid bdev name"
}
},
{
"method": "bdev_ubi_delete",
"params": {
"invalid_param": 1
}
},
{
"method": "bdev_ubi_delete",
"params": {
"name": "ubi_to_be_deleted"
}
},
{
"method": "bdev_ubi_create",
"params": {
Expand Down
Loading