From e1635b3311a993c71a64231372049262bd843b52 Mon Sep 17 00:00:00 2001 From: Rachita Kothiyal Date: Wed, 17 Oct 2007 21:46:01 -0400 Subject: [PATCH] More tests added to being generic 1) create 2) mknod 3) open 4) readdir --- t-create.sh | 112 +++++++++++---------------------------------------- t-mknod.sh | 75 +++++++++------------------------- t-open.sh | 8 +++- t-readdir.sh | 4 +- 4 files changed, 52 insertions(+), 147 deletions(-) diff --git a/t-create.sh b/t-create.sh index 45e5bcd..96436f8 100644 --- a/t-create.sh +++ b/t-create.sh @@ -43,25 +43,12 @@ d $LOWER_DIR3 FILES } -function odf_directories { +# initial set of files +function beforefiles { cat </dev/null unmount_union #Sanity check the lower level dirs/files - ( directories ; lower_afterfiles_rw ) | check_hierarchy $TOP_LOWER_DIR + ( directories ; afterfiles_rw ) | check_hierarchy - #Sanity check ODF, and then discard it - ( odf_directories ; odf_afterfiles_rw ) | check_hierarchy $ODF_DIR/ns discard_odf } function ro { - POPULATE_ODF=0 - ( directories ; ) | create_hierarchy - - setup_odf - fill_odf - ./progs/make_sb 3 $LOWER_DIR0 6 $LOWER_DIR1 4 $LOWER_DIR2 4 + init_odf $LOWER_DIR0 $LOWER_DIR1=ro $LOWER_DIR2=ro + ( directories ; beforefiles ) | create_hierarchy - POPULATE_ODF=1 - ( odf_beforefiles ; ) | create_hierarchy - mount_union "odf=$ODF_DIR" + mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro $LOWER_DIR2=ro touch $MOUNTPOINT/y checktype $MOUNTPOINT/y 'f' @@ -178,25 +134,17 @@ function ro { touch $MOUNTPOINT/d1/d2/d3/d4/d checktype $MOUNTPOINT/d1/d2/d3/d4/d 'f' - ls -lR $MOUNTPOINT >/dev/null unmount_union - ( directories ; lower_afterfiles_ro ) | check_hierarchy $TOP_LOWER_DIR + ( directories ; afterfiles_ro ) | check_hierarchy - #Sanity check (TODO) ODF, and then discard it - ( odf_directories ; odf_afterfiles_ro ) | check_hierarchy $ODF_DIR/ns discard_odf } function BUG383 { - POPULATE_ODF=0 + init_odf $LOWER_DIR0 $LOWER_DIR1=ro $LOWER_DIR2=ro ( directories ; beforefiles_383 ) | create_hierarchy - setup_odf - fill_odf - ./progs/make_sb 3 $LOWER_DIR0 6 $LOWER_DIR1 4 $LOWER_DIR2 4 - - POPULATE_ODF=1 - mount_union "odf=$ODF_DIR" + mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro $LOWER_DIR2=ro local SM=`umask` umask 022 @@ -213,24 +161,12 @@ function BUG383 { umask $SM - ls -lR $MOUNTPOINT >/dev/null unmount_union - ( directories ; afterfiles_383 ) | check_hierarchy $TOP_LOWER_DIR + ( directories ; afterfiles_383 ) | check_hierarchy - #Sanity check (TODO) ODF, and then discard it - ( odf_directories ; odf_beforefiles_383 ) | check_hierarchy $ODF_DIR/ns discard_odf } - -#function fill_odf { -# mkdir $ODF_DIR/ic -# mkdir $ODF_DIR/ns -# mkdir $ODF_DIR/reclaim -# mkdir $ODF_DIR/sr -# touch $ODF_DIR/whiteout -#} - if [ -z "$FXNS" ] ; then FXNS="rw ro BUG383" fi diff --git a/t-mknod.sh b/t-mknod.sh index 11757d9..4aae653 100755 --- a/t-mknod.sh +++ b/t-mknod.sh @@ -39,17 +39,15 @@ function afterfiles_rw { cat </dev/null -else - mount_union "" $LOWER_DIR0 $LOWER_DIR1 -fi +mount_union "" $LOWER_DIR0 $LOWER_DIR1 mknod $MOUNTPOINT/a b 200 0 checktype "$MOUNTPOINT/a" 'b' @@ -99,35 +90,14 @@ checktype "$MOUNTPOINT/d5/b" 'c' mknod $MOUNTPOINT/d1/d2/d3/d4/c b 200 0 checktype "$MOUNTPOINT/d1/d2/d3/d4/c" 'b' - unmount_union - -if [ $ODF -eq 1 ]; then - ( directories ; afterfiles_odf_rw ) | check_hierarchy $TOP_LOWER_DIR -else - ( directories ; afterfiles_rw ) | check_hierarchy $TOP_LOWER_DIR -fi -if [ $ODF -eq 1 ]; then - discard_odf -fi - +( directories ; afterfiles_rw ) | check_hierarchy +discard_odf -if [ $ODF -eq 1 ]; then - POPULATE_ODF=0 - setup_odf - fill_odf - ./progs/make_sb 2 $LOWER_DIR0 6 $LOWER_DIR1 4 -fi - +init_odf $LOWER_DIR0 $LOWER_DIR1=ro ( directories ; beforefiles) | create_hierarchy - -if [ $ODF -eq 1 ]; then - mount_union "odf=$ODF_DIR" - ls -lR $MOUNTPOINT >/dev/null -else - mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro -fi +mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro mknod $MOUNTPOINT/a b 200 0 checktype "$MOUNTPOINT/a" 'b' @@ -137,14 +107,7 @@ mknod $MOUNTPOINT/d1/d2/d3/d4/c b 200 0 checktype "$MOUNTPOINT/d1/d2/d3/d4/c" 'b' unmount_union +( directories ; afterfiles_ro ) | check_hierarchy +discard_odf -if [ $ODF -eq 1 ]; then - ( directories ; afterfiles_odf_rw ) | check_hierarchy $TOP_LOWER_DIR -else - ( directories ; afterfiles_ro ) | check_hierarchy $TOP_LOWER_DIR -fi - -if [ $ODF -eq 1 ]; then - discard_odf -fi complete_test diff --git a/t-open.sh b/t-open.sh index e9db34d..1793420 100755 --- a/t-open.sh +++ b/t-open.sh @@ -57,6 +57,7 @@ FILES } function ro { + init_odf ( files ; beforefiles) | create_hierarchy mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro $LOWER_DIR2=ro @@ -72,10 +73,12 @@ function ro { unmount_union - ( files ; afterfiles ) | check_hierarchy $TOP_LOWER_DIR + ( files ; afterfiles ) | check_hierarchy + discard_odf } function copyup { + init_odf ( files ; beforefiles_copyup) | create_hierarchy mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro @@ -87,7 +90,8 @@ function copyup { unmount_union - ( files ; afterfiles_copyup ) | check_hierarchy $TOP_LOWER_DIR + ( files ; afterfiles_copyup ) | check_hierarchy + discard_odf } if [ -z "$FXNS" ] ; then diff --git a/t-readdir.sh b/t-readdir.sh index e021d63..3429ce0 100755 --- a/t-readdir.sh +++ b/t-readdir.sh @@ -43,6 +43,7 @@ function filesy { done } +init_odf ( files; filesx; filesy ) | create_hierarchy mount_union "" $LOWER_DIR0 $LOWER_DIR1 FILES=`ls /mnt/unionfs/* |wc -l` @@ -52,8 +53,9 @@ if [ $FILES != $NGEN ] ; then echo -n "Expected: $NGEN" exit 1 fi -( files; filesx; filesy ) | check_hierarchy $TOP_LOWER_DIR +( files; filesx; filesy ) | check_hierarchy unmount_union +discard_odf complete_test -- 2.43.0