Skip to content

Commit

Permalink
simple-test: mount fs with journal
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed Oct 1, 2014
1 parent 33f5f11 commit e21bfc8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions simple-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ root_pwd="$PWD"
test_dir="test-dir-$RANDOM"
test_mount_point="test-mount-point-$RANDOM"

function create_journal()
{
dd bs=1M count=10 if=/dev/zero of="$1"
mke2fs -O journal_dev "$1"
}
function create_test_image()
{
dd bs=4096 count=100 if=/dev/zero of="$1"
Expand All @@ -29,7 +34,7 @@ function create_test_image()
function mount_fs_image()
{
insmod simplefs.ko
mount -o loop,owner,group,users -t simplefs "$1" "$2"
mount -o loop,owner,group,users,journal_path="$1" -t simplefs "$2" "$3"
dmesg | tail -n20
}
function unmount_fs()
Expand Down Expand Up @@ -108,15 +113,16 @@ cleanup
trap cleanup SIGINT EXIT
mkdir "$test_dir" "$test_mount_point"
create_test_image "$test_dir/image"
create_journal "$test_dir/journal"

# 1
mount_fs_image "$test_dir/image" "$test_mount_point"
mount_fs_image "$test_dir/journal" "$test_dir/image" "$test_mount_point"
do_some_operations "$test_mount_point"
cd "$root_pwd"
unmount_fs "$test_mount_point"

# 2
mount_fs_image "$test_dir/image" "$test_mount_point"
mount_fs_image "$test_dir/journal" "$test_dir/image" "$test_mount_point"
do_read_operations "$test_mount_point"
cd "$root_pwd"
unmount_fs "$test_mount_point"
Expand Down

0 comments on commit e21bfc8

Please sign in to comment.