Skip to content

Commit c5cb79e

Browse files
committed
Review feedback
1 parent 1732968 commit c5cb79e

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

_test_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ chronic dd if=/dev/zero of=test_htree.ext4 count=20 bs=1048576
5151
chronic mkfs.ext4 -g 1024 -b 1024 -O 64bit,dir_index test_htree.ext4
5252
sudo mount -t ext4 test_htree.ext4 "$tmp_dir"
5353
# shellcheck disable=SC2064
54-
trap "sudo umount;rmdir \"$tmp_dir\"" EXIT
54+
trap "sudo umount \"$tmp_dir\";rmdir \"$tmp_dir\"" EXIT
5555
sudo mkdir "$tmp_dir"/empty
5656
printf '%s\n' "$tmp_dir"/{1..200} | xargs sudo touch
5757
sudo umount "$tmp_dir"

test.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,15 @@ def test_root_inode(volume: ext4.Volume):
211211
_assert("isinstance(entry.hash, int)", lambda: entry.hash) # pyright: ignore[reportAny]
212212
_assert("isinstance(entry.block, int)", lambda: entry.block) # pyright: ignore[reportAny]
213213

214-
first_entry = entries[0]
215-
_assert("first_entry.hash >= 0", lambda: first_entry.hash) # pyright: ignore[reportAny]
216-
_assert("first_entry.block > 0", lambda: first_entry.block) # pyright: ignore[reportAny]
217-
218-
block_io = ext4.BlockIO(volume.root)
219-
block = block_io.blocks[first_entry.block] # pyright: ignore[reportAny]
220-
_assert("len(block) > 0", lambda: len(block))
221-
_assert(f"len(block) == {volume.block_size}", lambda: len(block))
214+
if entries:
215+
first_entry = entries[0]
216+
_assert("first_entry.hash >= 0", lambda: first_entry.hash) # pyright: ignore[reportAny]
217+
_assert("first_entry.block > 0", lambda: first_entry.block) # pyright: ignore[reportAny]
218+
219+
block_io = ext4.BlockIO(volume.root)
220+
block = block_io.blocks[first_entry.block] # pyright: ignore[reportAny]
221+
_assert("len(block) > 0", lambda: len(block))
222+
_assert(f"len(block) == {volume.block_size}", lambda: len(block))
222223

223224
dirent = ext4.DirectoryEntry2(volume.root, 0)
224225
_assert("dirent.rec_len > 0", lambda: dirent.rec_len) # pyright: ignore[reportAny]

0 commit comments

Comments
 (0)