Skip to content

Commit

Permalink
Increase coverage for bdev_ubi_rpc.c
Browse files Browse the repository at this point in the history
This is done by adding some commands in test_conf.json.
  • Loading branch information
pykello committed Jan 27, 2024
1 parent 1269730 commit 35e55ed
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
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

0 comments on commit 35e55ed

Please sign in to comment.