]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
tests: use lowercase variables for all the new reflink tests
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 7 Feb 2016 22:27:15 +0000 (09:27 +1100)
committerDave Chinner <david@fromorbit.com>
Sun, 7 Feb 2016 22:27:15 +0000 (09:27 +1100)
Since $TESTDIR is a local variable, make it lowercase to avoid
confusion with $TEST_DIR.  While we're at it, make all the local
variables lowercase.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
89 files changed:
tests/generic/110
tests/generic/111
tests/generic/115
tests/generic/116
tests/generic/118
tests/generic/119
tests/generic/121
tests/generic/122
tests/generic/134
tests/generic/136
tests/generic/137
tests/generic/138
tests/generic/139
tests/generic/140
tests/generic/142
tests/generic/143
tests/generic/144
tests/generic/145
tests/generic/146
tests/generic/147
tests/generic/148
tests/generic/149
tests/generic/150
tests/generic/151
tests/generic/152
tests/generic/153
tests/generic/154
tests/generic/155
tests/generic/156
tests/generic/157
tests/generic/158
tests/generic/159
tests/generic/160
tests/generic/161
tests/generic/162
tests/generic/163
tests/generic/164
tests/generic/165
tests/generic/166
tests/generic/167
tests/generic/168
tests/generic/170
tests/generic/171
tests/generic/172
tests/generic/173
tests/generic/174
tests/generic/175
tests/generic/176
tests/generic/178
tests/generic/179
tests/generic/180
tests/generic/181
tests/generic/182
tests/generic/183
tests/generic/185
tests/generic/186
tests/generic/187
tests/generic/188
tests/generic/189
tests/generic/190
tests/generic/191
tests/generic/194
tests/generic/195
tests/generic/196
tests/generic/197
tests/generic/199
tests/generic/200
tests/generic/201
tests/generic/202
tests/generic/203
tests/generic/205
tests/generic/206
tests/generic/216
tests/generic/217
tests/generic/218
tests/generic/220
tests/generic/222
tests/generic/227
tests/generic/229
tests/generic/238
tests/generic/242
tests/generic/243
tests/xfs/127
tests/xfs/128
tests/xfs/129
tests/xfs/131
tests/xfs/132
tests/xfs/139
tests/xfs/140

index fffadbce327586f053b518a729bc312d3004bb42..a43f02d307d627ab773b961d72da78627882f13d 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f $tmp.* "$TESTDIR"
+    rm -f $tmp.* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -53,37 +53,37 @@ _require_xfs_io_command "fiemap"
 _require_cp_reflink
 _require_test
 
-TESTDIR1=$TEST_DIR/test-$seq
-rm -rf $TESTDIR1
-mkdir $TESTDIR1
+testdir1=$TEST_DIR/test-$seq
+rm -rf $testdir1
+mkdir $testdir1
 
 _checksum_files() {
     for F in original copy1 copy2
     do
-        md5sum $TESTDIR1/$F | _filter_test_dir
+        md5sum $testdir1/$F | _filter_test_dir
     done
 }
 
 rm -f $seqres.full
 
 echo "Create the original file and reflink to copy1, copy2"
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \
     >> $seqres.full 2>&1
-cp --reflink $TESTDIR1/original $TESTDIR1/copy1
-cp --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
-_verify_reflink $TESTDIR1/original $TESTDIR1/copy1
-_verify_reflink $TESTDIR1/original $TESTDIR1/copy2
+cp --reflink $testdir1/original $testdir1/copy1
+cp --reflink $testdir1/copy1 $testdir1/copy2
+_verify_reflink $testdir1/original $testdir1/copy1
+_verify_reflink $testdir1/original $testdir1/copy2
 echo "Original md5sums:"
 _checksum_files
 
 echo "Overwrite original file with new data"
-$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $TESTDIR1/original \
+$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $testdir1/original \
     >> $seqres.full 2>&1
 echo "md5sums after overwriting original:"
 _checksum_files
 
 echo "Overwrite copy1 with different new data"
-$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $TESTDIR1/copy1 \
+$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $testdir1/copy1 \
     >> $seqres.full 2>&1
 echo "md5sums after overwriting copy1:"
 _checksum_files
index 98077d8df2fe86e27ad7b1bcdc5bf32df5c01cf1..ef9c42459fe51baf12ca5b6826f8d6257a405a0f 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f $tmp.* "$TESTDIR"
+    rm -f $tmp.* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -53,55 +53,55 @@ _require_xfs_io_command "fiemap"
 _require_cp_reflink
 _require_test
 
-TESTDIR1=$TEST_DIR/test-$seq
-rm -rf $TESTDIR1
-mkdir $TESTDIR1
+testdir1=$TEST_DIR/test-$seq
+rm -rf $testdir1
+mkdir $testdir1
 
 _checksum_files() {
     for F in original/file1 original/subdir/file2 \
                  copy1/file1 copy1/subdir/file2 \
                  copy2/file1 copy2/subdir/file2
         do
-            md5sum $TESTDIR1/$F | _filter_test_dir
+            md5sum $testdir1/$F | _filter_test_dir
         done
 }
 
 rm -f $seqres.full
 
-mkdir $TESTDIR1/original
-mkdir $TESTDIR1/original/subdir
+mkdir $testdir1/original
+mkdir $testdir1/original/subdir
 
 echo "Create the original files and reflink dirs"
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original/file1 \
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original/file1 \
     >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c 'pwrite -S 0x62 0 11000' \
-    $TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
-cp --recursive --reflink $TESTDIR1/original $TESTDIR1/copy1
-cp --recursive --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
+    $testdir1/original/subdir/file2 >> $seqres.full 2>&1
+cp --recursive --reflink $testdir1/original $testdir1/copy1
+cp --recursive --reflink $testdir1/copy1 $testdir1/copy2
 
-_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy1/file1
-_verify_reflink $TESTDIR1/original/subdir/file2 \
-    $TESTDIR1/copy1/subdir/file2
-_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy2/file1
-_verify_reflink $TESTDIR1/original/subdir/file2 \
-    $TESTDIR1/copy2/subdir/file2
+_verify_reflink $testdir1/original/file1 $testdir1/copy1/file1
+_verify_reflink $testdir1/original/subdir/file2 \
+    $testdir1/copy1/subdir/file2
+_verify_reflink $testdir1/original/file1 $testdir1/copy2/file1
+_verify_reflink $testdir1/original/subdir/file2 \
+    $testdir1/copy2/subdir/file2
 
 echo "Original md5sums:"
 _checksum_files
 
 echo "Overwrite original/file1 and original/subdir/file2 with new data"
-$XFS_IO_PROG -c 'pwrite -S 0x63 0 13000' $TESTDIR1/original/file1 \
+$XFS_IO_PROG -c 'pwrite -S 0x63 0 13000' $testdir1/original/file1 \
     >> $seqres.full 2>&1
 $XFS_IO_PROG -c 'pwrite -S 0x64 5000 1000' \
-    $TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
+    $testdir1/original/subdir/file2 >> $seqres.full 2>&1
 echo "md5sums now:"
 _checksum_files
 
 echo "Overwrite copy1/file1 and copy1/subdir/file2 with new data"
-$XFS_IO_PROG -c 'pwrite -S 0x65 0 9000' $TESTDIR1/copy1/file1 \
+$XFS_IO_PROG -c 'pwrite -S 0x65 0 9000' $testdir1/copy1/file1 \
     >> $seqres.full 2>&1
 $XFS_IO_PROG -c 'pwrite -S 0x66 5000 25000' \
-    $TESTDIR1/copy1/subdir/file2 >> $seqres.full 2>&1
+    $testdir1/copy1/subdir/file2 >> $seqres.full 2>&1
 echo "md5sums now:"
 _checksum_files
 
index 6c8d92d90fd777df4e296b6eb6a5c92e984b2d8d..578d5bd8528fa712a44009e63726afa2c7e7b14d 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f $tmp.* "$TESTDIR"
+    rm -f $tmp.* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -53,31 +53,31 @@ _require_test
 
 rm -f $seqres.full
 
-TESTDIR1=$TEST_DIR/test-$seq
-rm -rf $TESTDIR1
-mkdir $TESTDIR1
+testdir1=$TEST_DIR/test-$seq
+rm -rf $testdir1
+mkdir $testdir1
 
 echo "Create the original files and reflink dirs"
-$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \
     >> $seqres.full
-cp --reflink $TESTDIR1/original $TESTDIR1/copy
+cp --reflink $testdir1/original $testdir1/copy
 
-_verify_reflink $TESTDIR1/original $TESTDIR1/copy
+_verify_reflink $testdir1/original $testdir1/copy
 
 echo "Move orig & reflink copy to subdir and md5sum:"
-mkdir $TESTDIR1/subdir
-mv $TESTDIR1/original $TESTDIR1/subdir/original_moved
-mv $TESTDIR1/copy $TESTDIR1/subdir/copy_moved
-_verify_reflink $TESTDIR1/subdir/original_moved \
-    $TESTDIR1/subdir/copy_moved
+mkdir $testdir1/subdir
+mv $testdir1/original $testdir1/subdir/original_moved
+mv $testdir1/copy $testdir1/subdir/copy_moved
+_verify_reflink $testdir1/subdir/original_moved \
+    $testdir1/subdir/copy_moved
 
-md5sum $TESTDIR1/subdir/original_moved | _filter_test_dir
-md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
+md5sum $testdir1/subdir/original_moved | _filter_test_dir
+md5sum $testdir1/subdir/copy_moved | _filter_test_dir
 
 echo "remove orig from subdir and md5sum reflink copy:"
-rm $TESTDIR1/subdir/original_moved
-md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
-rm -rf $TESTDIR1/subdir
+rm $testdir1/subdir/original_moved
+md5sum $testdir1/subdir/copy_moved | _filter_test_dir
+rm -rf $testdir1/subdir
 
 # success, all done
 status=0
index 2b4b505554ea37428651efbee79055d4acff293f..5c361e2646f2fb7d70a187aa66d6aee0ce1c5a1c 100755 (executable)
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -48,43 +48,43 @@ _require_test_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
        || echo "Files do not match"
 
 echo "Reflink the middle blocks together"
-free_before="$(stat -f -c '%a' "$TESTDIR")"
-_reflink_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
+free_before="$(stat -f -c '%a' "$testdir")"
+_reflink_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
 _test_remount
-free_after="$(stat -f -c '%a' "$TESTDIR")"
+free_after="$(stat -f -c '%a' "$testdir")"
 echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
        || echo "Start sections do not match"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
-               $((BLKSZ * 6)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+               $((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match"
 
 # success, all done
index 651b72cd902a53918ab4c7f07756285095f4b53b..41e525c3a28d0571d3c6e37ed2e44c326321862a 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -49,43 +49,43 @@ _require_test_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
        || echo "Files do not match (intentional)"
 
 echo "Reflink the middle blocks together"
-free_before="$(stat -f -c '%a' "$TESTDIR")"
-_reflink_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
+free_before="$(stat -f -c '%a' "$testdir")"
+_reflink_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
 _test_remount
-free_after="$(stat -f -c '%a' "$TESTDIR")"
+free_after="$(stat -f -c '%a' "$testdir")"
 echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
        || echo "Start sections do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
-               $((BLKSZ * 6)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+               $((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match (intentional)"
 
 # success, all done
index 9d57379c4c41e157b5ef4077a3e73b0720a46976..27e76045378dfcc66dec0f3f6338719eb2093207 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,119 +50,119 @@ _require_test_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR=$TEST_DIR/test-$seq
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 8)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * 8)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $((BLKSZ * 8)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x64 0 $((BLKSZ * 8)) "$TESTDIR/file4" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 8)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * 8)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x63 0 $((blksz * 8)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x64 0 $((blksz * 8)) "$testdir/file4" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
        || echo "Files 1-2 do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 8)) \
+_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 8)) \
        || echo "Files 1-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 8)) \
+_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 8)) \
        || echo "Files 1-4 do not match (intentional)"
 
 echo "Reflink the first four blocks together, 1-2 3-4"
-free_before="$(stat -f -c '%a' "$TESTDIR")"
-_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) >> "$seqres.full"
-_reflink_range "$TESTDIR/file3" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) >> "$seqres.full"
+free_before="$(stat -f -c '%a' "$testdir")"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) >> "$seqres.full"
+_reflink_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 4)) >> "$seqres.full"
 _test_remount
-free_after="$(stat -f -c '%a' "$TESTDIR")"
+free_after="$(stat -f -c '%a' "$testdir")"
 echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
        || echo "Sections of file 1-2 do not match"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 4)) \
        || echo "Sections of file 1-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 4)) \
        || echo "Sections of file 1-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $((blksz * 4)) \
        || echo "Sections of file 2-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file2" 0 "$testdir/file4" 0 $((blksz * 4)) \
        || echo "Sections of file 2-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file3" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 4)) \
        || echo "Sections of file 3-4 do not match"
 
 echo "Reflink the first two blocks together, 1-3 1-4"
-free_before="$(stat -f -c '%a' $TESTDIR)"
-_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 2)) >> "$seqres.full"
-_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) >> "$seqres.full"
+free_before="$(stat -f -c '%a' $testdir)"
+_reflink_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 2)) >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 2)) >> "$seqres.full"
 _test_remount
-free_after="$(stat -f -c '%a' $TESTDIR)"
+free_after="$(stat -f -c '%a' $testdir)"
 echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 2)) \
        || echo "Sections of files 1-2 do not match"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 2)) \
        || echo "Sections of files 1-3 do not match"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 2)) \
        || echo "Sections of files 1-4 do not match"
 
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 $((BLKSZ * 2)) \
+_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $((blksz * 2)) \
        || echo "Sections of files 2-3 do not match"
 
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) \
+_compare_range "$testdir/file2" 0 "$testdir/file4" 0 $((blksz * 2)) \
        || echo "Sections of files 2-4 do not match"
 
-_compare_range "$TESTDIR/file3" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) \
+_compare_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 2)) \
        || echo "Sections of files 3-4 do not match"
 
 echo "Compare previously reflinked sections"
-_compare_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file2" \
-               $((BLKSZ * 2)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file2" \
+               $((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 1-2 do not match"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file3" \
-               $((BLKSZ * 2)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file3" \
+               $((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 1-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file4" \
-               $((BLKSZ * 2)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file4" \
+               $((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 1-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" $((BLKSZ * 2)) "$TESTDIR/file3" \
-               $((BLKSZ * 2)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file2" $((blksz * 2)) "$testdir/file3" \
+               $((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 2-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" $((BLKSZ * 2)) "$TESTDIR/file4" \
-               $((BLKSZ * 2)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file2" $((blksz * 2)) "$testdir/file4" \
+               $((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 2-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file3" $((BLKSZ * 2)) "$TESTDIR/file4" \
-               $((BLKSZ * 2)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file3" $((blksz * 2)) "$testdir/file4" \
+               $((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 3-4 do not match"
 
 # success, all done
index 9a5b38389ed8567bb5749b135697f1b7d12761f6..0e15e8d9c312b87e78a5a5a0adcabf3b3d24d50c 100755 (executable)
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -48,43 +48,43 @@ _require_test_dedupe
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
        || echo "Files 1-2 do not match (intentional)"
 
 echo "Dedupe the middle blocks together"
-free_before="$(stat -f -c '%a' "$TESTDIR")"
-_dedupe_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
+free_before="$(stat -f -c '%a' "$testdir")"
+_dedupe_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
 _test_remount
-free_after="$(stat -f -c '%a' "$TESTDIR")"
+free_after="$(stat -f -c '%a' "$testdir")"
 echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
        || echo "Start sections do not match"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
-               $((BLKSZ * 6)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+               $((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match"
 
 # success, all done
index 0edb48d72bc7889c41a5f4f5f3b71e35c353de84..e7585f75621906201d9a099c1476f9a89609ff09 100755 (executable)
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -48,43 +48,43 @@ _require_test_dedupe
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 "$((BLKSZ * 8))" \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 "$((blksz * 8))" \
        || echo "Files 1-2 do not match (intentional)"
 
 echo "(Fail to) dedupe the middle blocks together"
-free_before="$(stat -f -c '%a' "$TESTDIR")"
-_dedupe_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
+free_before="$(stat -f -c '%a' "$testdir")"
+_dedupe_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
 _test_remount
-free_after="$(stat -f -c '%a' "$TESTDIR")"
+free_after="$(stat -f -c '%a' "$testdir")"
 echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
        || echo "Start sections do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
-               $((BLKSZ * 4)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+               $((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
-               $((BLKSZ * 6)) $((BLKSZ * 2)) \
+_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+               $((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match (intentional)"
 
 # success, all done
index 4dc710ca3e0052160b7753d4c6ebc78a5add5dc9..1dda839ac1eb042e20881a3e6cef332b9b22f7b8 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,75 +52,75 @@ _require_test_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file4" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file4" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-C1="$(_md5_checksum $TESTDIR/file1)"
-C2="$(_md5_checksum $TESTDIR/file2)"
-C3="$(_md5_checksum $TESTDIR/file3)"
-C4="$(_md5_checksum $TESTDIR/file4)"
+c1="$(_md5_checksum $testdir/file1)"
+c2="$(_md5_checksum $testdir/file2)"
+c3="$(_md5_checksum $testdir/file3)"
+c4="$(_md5_checksum $testdir/file4)"
 
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "Reflink the last blocks together, 1-2 1-3"
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 >> "$seqres.full"
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-C1="$(_md5_checksum $TESTDIR/file1)"
-C2="$(_md5_checksum $TESTDIR/file2)"
-C3="$(_md5_checksum $TESTDIR/file3)"
-C4="$(_md5_checksum $TESTDIR/file4)"
+c1="$(_md5_checksum $testdir/file1)"
+c2="$(_md5_checksum $testdir/file2)"
+c3="$(_md5_checksum $testdir/file3)"
+c4="$(_md5_checksum $testdir/file4)"
 
 echo "Compare files"
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" != "${C4}" || echo "file3 and file4 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" != "${c4}" || echo "file3 and file4 should match"
 
 echo "Compare sections"
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 \
+_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 \
        || echo "End sections of files 1-2 do not match"
 
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
+_compare_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 \
        || echo "End sections of files 1-3 do not match"
 
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
+_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz 37 \
        || echo "End sections of files 1-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
+_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 37 \
        || echo "End sections of files 2-3 do not match"
 
-_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
+_compare_range "$testdir/file2" $blksz "$testdir/file4" $blksz 37 \
        || echo "End sections of files 2-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file3" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
+_compare_range "$testdir/file3" $blksz "$testdir/file4" $blksz 37 \
        || echo "End sections of files 3-4 do not match (intentional)"
 
 # success, all done
index 5d021f868b4625e01a576b98037d10f4b2d938ce..6bd6b14490b4441263fbe0446734b55d2f716f8c 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,77 +52,77 @@ _require_test_dedupe
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file4" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file4" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-C1="$(_md5_checksum $TESTDIR/file1)"
-C2="$(_md5_checksum $TESTDIR/file2)"
-C3="$(_md5_checksum $TESTDIR/file3)"
-C4="$(_md5_checksum $TESTDIR/file4)"
+c1="$(_md5_checksum $testdir/file1)"
+c2="$(_md5_checksum $testdir/file2)"
+c3="$(_md5_checksum $testdir/file3)"
+c4="$(_md5_checksum $testdir/file4)"
 
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "Dedupe the last blocks together"
 echo "1->2"
-_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 >> "$seqres.full"
+_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 >> "$seqres.full"
 echo "1->3"
-_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 >> "$seqres.full"
+_dedupe_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
 
-C1="$(_md5_checksum $TESTDIR/file1)"
-C2="$(_md5_checksum $TESTDIR/file2)"
-C3="$(_md5_checksum $TESTDIR/file3)"
-C4="$(_md5_checksum $TESTDIR/file4)"
+c1="$(_md5_checksum $testdir/file1)"
+c2="$(_md5_checksum $testdir/file2)"
+c3="$(_md5_checksum $testdir/file3)"
+c4="$(_md5_checksum $testdir/file4)"
 
 echo "Compare files"
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "Compare sections"
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 \
+_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 \
        || echo "End sections of files 1-2 do not match"
 
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
+_compare_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 \
        || echo "End sections of files 1-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
+_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz 37 \
        || echo "End sections of files 1-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
+_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 37 \
        || echo "End sections of files 2-3 do not match (intentional)"
 
-_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
+_compare_range "$testdir/file2" $blksz "$testdir/file4" $blksz 37 \
        || echo "End sections of files 2-4 do not match (intentional)"
 
-_compare_range "$TESTDIR/file3" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
+_compare_range "$testdir/file3" $blksz "$testdir/file4" $blksz 37 \
        || echo "End sections of files 3-4 do not match"
 
 # success, all done
index 9cc7948e8112ac47518c26edef40b50aaf7380a1..dcfd90db55322a4d871180179039705d7a1b0c91 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -54,47 +54,47 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $((BLKSZ * 2)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $((blksz * 2)) "$testdir/file1" >> "$seqres.full"
 
-NR_BLKS=1024
+nr_blks=1024
 
 echo "fallocate half the file"
-"$XFS_IO_PROG" -f -c "falloc $((NR_BLKS * BLKSZ / 2)) $((NR_BLKS * BLKSZ / 2))" "$TESTDIR/file1" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc $((nr_blks * blksz / 2)) $((nr_blks * blksz / 2))" "$testdir/file1" >> "$seqres.full"
 
 echo "Reflink block zero to the threes"
-seq 1 $((NR_BLKS / 3)) | while read nr; do
-       _reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file1" $((nr * 3 * BLKSZ)) \
-                       $BLKSZ >> "$seqres.full"
+seq 1 $((nr_blks / 3)) | while read nr; do
+       _reflink_range "$testdir/file1" 0 "$testdir/file1" $((nr * 3 * blksz)) \
+                       $blksz >> "$seqres.full"
 done
 
 echo "Reflink block one to the fives"
-seq 1 $((NR_BLKS / 5)) | while read nr; do
-       _reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file1" \
-                       $((nr * 5 * BLKSZ)) $BLKSZ >> "$seqres.full"
+seq 1 $((nr_blks / 5)) | while read nr; do
+       _reflink_range "$testdir/file1" $blksz "$testdir/file1" \
+                       $((nr * 5 * blksz)) $blksz >> "$seqres.full"
 done
 
 echo "Dedupe block two to the sevens"
-seq 1 $((NR_BLKS / 7)) | while read nr; do
-       _dedupe_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file1" \
-                       $((nr * 7 * BLKSZ)) $BLKSZ >> "$seqres.full" 2>&1
+seq 1 $((nr_blks / 7)) | while read nr; do
+       _dedupe_range "$testdir/file1" $((blksz * 2)) "$testdir/file1" \
+                       $((nr * 7 * blksz)) $blksz >> "$seqres.full" 2>&1
 done
 
 _test_remount
 
 echo "Check block mappings"
-md5sum "$TESTDIR/file1" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
 
-crcZ=$(_md5_range_checksum /dev/zero 0 $BLKSZ)
-crc0=$(_md5_range_checksum "$TESTDIR/file1" 0 $BLKSZ)
-crc1=$(_md5_range_checksum "$TESTDIR/file1" $BLKSZ $BLKSZ)
-crc2=$(_md5_range_checksum "$TESTDIR/file1" $((BLKSZ * 2)) $BLKSZ)
+crcZ=$(_md5_range_checksum /dev/zero 0 $blksz)
+crc0=$(_md5_range_checksum "$testdir/file1" 0 $blksz)
+crc1=$(_md5_range_checksum "$testdir/file1" $blksz $blksz)
+crc2=$(_md5_range_checksum "$testdir/file1" $((blksz * 2)) $blksz)
 
 check_block() {
        lblk="$1"
@@ -102,26 +102,26 @@ check_block() {
        rem5=$((lblk % 5))
        rem3=$((lblk % 3))
 
-       crc=$(_md5_range_checksum "$TESTDIR/file1" $((lblk * BLKSZ)) $BLKSZ)
+       crc=$(_md5_range_checksum "$testdir/file1" $((lblk * blksz)) $blksz)
 
        if [ $rem7 -eq 0 ]; then
                if [ $rem5 -eq 0 ]; then
                        test $crc2 = $crc || echo "lblk $lblk doesn't match block 2"
                elif [ $rem3 -eq 0 ]; then
                        test $crc0 = $crc || echo "lblk $lblk doesn't match block 0"
-               elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
+               elif [ $lblk -lt $((nr_blks / 2)) ]; then
                        test $crcZ = $crc || echo "lblk $lblk isn't zeroed"
                fi
        elif [ $rem5 -eq 0 ]; then
                test $crc1 = $crc || echo "lblk $lblk doesn't match block 1"
        elif [ $rem3 -eq 0 ]; then
                test $crc0 = $crc || echo "lblk $lblk doesn't match block 0"
-       elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
+       elif [ $lblk -lt $((nr_blks / 2)) ]; then
                test $crcZ = $crc || echo "lblk $lblk isn't zeroed"
        fi
 }
 
-seq 3 $((NR_BLKS - 1)) | while read lblk; do
+seq 3 $((nr_blks - 1)) | while read lblk; do
        err="$(check_block $lblk)"
        test -n "$err" && echo "$lblk: $err"
 done
index c084679c6c98fd1f6ee8b734f13519bcc6b5329e..59d23e9dc5d160aec1e2d5838c5731cb576bf507 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,101 +50,101 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
 
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match"
+cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match"
+cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
 
 echo "pagecache CoW the second file"
-_pwrite_byte 0x62 0 17 "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 17 "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 17 "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 17 "$testdir/file3" >> "$seqres.full"
 
-_pwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 "$testdir/file3" >> "$seqres.full"
 
-_pwrite_byte 0x62 $((BLKSZ * 48 - 8)) 17 "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 48 - 8)) 17 "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 "$testdir/file3" >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
 
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match (intentional)"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match (intentional)"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match (intentional)"
+cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match (intentional)"
+cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
 
 echo "Compare the CoW'd section to the before file"
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 17 \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 17 \
        || echo "Start sections do not match (intentional)"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16 - 34)) \
-               "$TESTDIR/file2" $((BLKSZ * 16 - 34)) 17 \
+_compare_range  "$testdir/file1" $((blksz * 16 - 34)) \
+               "$testdir/file2" $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 48 - 8)) \
-               "$TESTDIR/file2" $((BLKSZ * 48 - 8)) 17 \
+_compare_range  "$testdir/file1" $((blksz * 48 - 8)) \
+               "$testdir/file2" $((blksz * 48 - 8)) 17 \
        || echo "End sections do not match (intentional)"
 
 echo "Compare the CoW'd section to the after file"
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 17 \
+_compare_range "$testdir/file2" 0 "$testdir/file3" 0 17 \
        || echo "Start sections do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16 - 34)) \
-               "$TESTDIR/file3" $((BLKSZ * 16 - 34)) 17 \
+_compare_range  "$testdir/file2" $((blksz * 16 - 34)) \
+               "$testdir/file3" $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 48 - 8)) \
-               "$TESTDIR/file3" $((BLKSZ * 48 - 8)) 17 \
+_compare_range  "$testdir/file2" $((blksz * 48 - 8)) \
+               "$testdir/file3" $((blksz * 48 - 8)) 17 \
        || echo "End sections do not match"
 
 echo "Compare the not CoW'd sections"
-_compare_range "$TESTDIR/file1" 18 "$TESTDIR/file2" 18 17 \
+_compare_range "$testdir/file1" 18 "$testdir/file2" 18 17 \
        || echo "Start sections of 1-2 do not match"
 
-_compare_range "$TESTDIR/file2" 18 "$TESTDIR/file3" 18 17 \
+_compare_range "$testdir/file2" 18 "$testdir/file3" 18 17 \
        || echo "Start sections of 2-3 do not match"
 
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16 - 17)) \
-               "$TESTDIR/file2" $((BLKSZ * 16 - 17)) 82 \
+_compare_range  "$testdir/file1" $((blksz * 16 - 17)) \
+               "$testdir/file2" $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16 - 17)) \
-               "$TESTDIR/file3" $((BLKSZ * 16 - 17)) 82 \
+_compare_range  "$testdir/file2" $((blksz * 16 - 17)) \
+               "$testdir/file3" $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 2-3 do not match"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 48 - 108)) \
-               "$TESTDIR/file2" $((BLKSZ * 48 - 108)) 100 \
+_compare_range  "$testdir/file1" $((blksz * 48 - 108)) \
+               "$testdir/file2" $((blksz * 48 - 108)) 100 \
        || echo "End sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 48 - 108)) \
-               "$TESTDIR/file3" $((BLKSZ * 48 - 108)) 100 \
+_compare_range  "$testdir/file2" $((blksz * 48 - 108)) \
+               "$testdir/file3" $((blksz * 48 - 108)) 100 \
        || echo "End sections of 2-3 do not match"
 
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 14)) \
-               "$TESTDIR/file2" $((BLKSZ * 14)) $BLKSZ \
+_compare_range  "$testdir/file1" $((blksz * 14)) \
+               "$testdir/file2" $((blksz * 14)) $blksz \
        || echo "Untouched sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 14)) \
-               "$TESTDIR/file3" $((BLKSZ * 14)) $BLKSZ \
+_compare_range  "$testdir/file2" $((blksz * 14)) \
+               "$testdir/file3" $((blksz * 14)) $blksz \
        || echo "Untouched sections of 2-3 do not match"
 
 # success, all done
index 54c68fb4cfd11d0f4fff388e4d2439d0829cdf17..59e5bff6113c4ed570ed0da089bdad9287c81e32 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,100 +50,100 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR=$TEST_DIR/test-$seq
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
 
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 should match"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 should match"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 should match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 should match"
+cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 should match"
+cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 should match"
 
 echo "directio CoW the second file"
-_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file2" -d >> "$seqres.full"
-_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file3" -d >> "$seqres.full"
+_pwrite_byte 0x62 0 $blksz "$testdir/file2" -d >> "$seqres.full"
+_pwrite_byte 0x62 0 $blksz "$testdir/file3" -d >> "$seqres.full"
 
-_pwrite_byte 0x62 $((BLKSZ * 16 - 512)) 512 "$TESTDIR/file2" -d >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 16 - 512)) 512 "$TESTDIR/file3" -d >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 "$testdir/file2" -d >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 "$testdir/file3" -d >> "$seqres.full"
 
-_pwrite_byte 0x62 $((BLKSZ * 48)) $BLKSZ "$TESTDIR/file2" -d >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 48)) $BLKSZ "$TESTDIR/file3" -d >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 48)) $blksz "$testdir/file2" -d >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 48)) $blksz "$testdir/file3" -d >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
 
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 should not match (intentional)"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 should not match (intentional)"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 should match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 should not match (intentional)"
+cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 should not match (intentional)"
+cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 should match"
 
 echo "Compare the CoW'd section to the before file"
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $BLKSZ \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $blksz \
        || echo "Start sections do not match (intentional)"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16 - 512)) \
-               "$TESTDIR/file2" $((BLKSZ * 16 - 512)) 512 \
+_compare_range  "$testdir/file1" $((blksz * 16 - 512)) \
+               "$testdir/file2" $((blksz * 16 - 512)) 512 \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 48 - 512)) \
-               "$TESTDIR/file2" $((BLKSZ * 48 - 512)) $BLKSZ \
+_compare_range  "$testdir/file1" $((blksz * 48 - 512)) \
+               "$testdir/file2" $((blksz * 48 - 512)) $blksz \
        || echo "End sections do not match (intentional)"
 
 echo "Compare the CoW'd section to the after file"
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 $BLKSZ \
+_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $blksz \
        || echo "Start sections do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16 - 512)) \
-               "$TESTDIR/file3" $((BLKSZ * 16 - 512)) 512 \
+_compare_range  "$testdir/file2" $((blksz * 16 - 512)) \
+               "$testdir/file3" $((blksz * 16 - 512)) 512 \
        || echo "Middle sections do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 48 - 512)) \
-               "$TESTDIR/file3" $((BLKSZ * 48 - 512)) $BLKSZ \
+_compare_range  "$testdir/file2" $((blksz * 48 - 512)) \
+               "$testdir/file3" $((blksz * 48 - 512)) $blksz \
        || echo "End sections do not match"
 
 echo "Compare the not CoW'd sections"
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 512 \
+_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 512 \
        || echo "Start sections of 1-2 do not match"
-_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file3" $BLKSZ 512 \
+_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 512 \
        || echo "Start sections of 2-3 do not match"
 
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16 - 1024)) \
-               "$TESTDIR/file2" $((BLKSZ * 16 - 1024)) 512 \
+_compare_range  "$testdir/file1" $((blksz * 16 - 1024)) \
+               "$testdir/file2" $((blksz * 16 - 1024)) 512 \
        || echo "Middle sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16 - 1024)) \
-               "$TESTDIR/file3" $((BLKSZ * 16 - 1024)) 512 \
+_compare_range  "$testdir/file2" $((blksz * 16 - 1024)) \
+               "$testdir/file3" $((blksz * 16 - 1024)) 512 \
        || echo "Middle sections of 2-3 do not match"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 48 - 1024)) \
-               "$TESTDIR/file2" $((BLKSZ * 48 - 1024)) 512 \
+_compare_range  "$testdir/file1" $((blksz * 48 - 1024)) \
+               "$testdir/file2" $((blksz * 48 - 1024)) 512 \
        || echo "End sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 48 - 1024)) \
-               "$TESTDIR/file3" $((BLKSZ * 48 - 1024)) 512 \
+_compare_range  "$testdir/file2" $((blksz * 48 - 1024)) \
+               "$testdir/file3" $((blksz * 48 - 1024)) 512 \
        || echo "End sections of 2-3 do not match"
 
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16)) \
-               "$TESTDIR/file2" $((BLKSZ * 16)) 512 \
+_compare_range  "$testdir/file1" $((blksz * 16)) \
+               "$testdir/file2" $((blksz * 16)) 512 \
        || echo "Untouched sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16)) \
-               "$TESTDIR/file3" $((BLKSZ * 16)) 512 \
+_compare_range  "$testdir/file2" $((blksz * 16)) \
+               "$testdir/file3" $((blksz * 16)) 512 \
        || echo "Untouched sections of 2-3 do not match"
 
 # success, all done
index 6299d8e16c7fcf3ba48e7e65ddc6d6b56ac8e628..e8e765589602fda2b03830f08d7ca740a072843f 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,101 +50,101 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
 
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match"
+cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match"
+cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
 
 echo "mmap CoW the second file"
-_mwrite_byte 0x62 0 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file2" >> "$seqres.full"
-_mwrite_byte 0x62 0 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
+_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
+_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
 
-_mwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file2" >> "$seqres.full"
-_mwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
+_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
+_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
 
-_mwrite_byte 0x62 $((BLKSZ * 48 - 20)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file2" >> "$seqres.full"
-_mwrite_byte 0x62 $((BLKSZ * 48 - 20)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
+_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
+_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
 
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match (intentional)"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match (intentional)"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match (intentional)"
+cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match (intentional)"
+cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
 
 echo "Compare the CoW'd section to the before file"
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 17 \
+_compare_range "$testdir/file1" 0 "$testdir/file2" 0 17 \
        || echo "Start sections do not match (intentional)"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16 - 34)) \
-               "$TESTDIR/file2" $((BLKSZ * 16 - 34)) 17 \
+_compare_range  "$testdir/file1" $((blksz * 16 - 34)) \
+               "$testdir/file2" $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 48 - 20)) \
-               "$TESTDIR/file2" $((BLKSZ * 48 - 20)) 17 \
+_compare_range  "$testdir/file1" $((blksz * 48 - 20)) \
+               "$testdir/file2" $((blksz * 48 - 20)) 17 \
        || echo "End sections do not match (intentional)"
 
 echo "Compare the CoW'd section to the after file"
-_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 17 \
+_compare_range "$testdir/file2" 0 "$testdir/file3" 0 17 \
        || echo "Start sections do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16 - 34)) \
-               "$TESTDIR/file3" $((BLKSZ * 16 - 34)) 17 \
+_compare_range  "$testdir/file2" $((blksz * 16 - 34)) \
+               "$testdir/file3" $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 48 - 20)) \
-               "$TESTDIR/file3" $((BLKSZ * 48 - 20)) 17 \
+_compare_range  "$testdir/file2" $((blksz * 48 - 20)) \
+               "$testdir/file3" $((blksz * 48 - 20)) 17 \
        || echo "End sections do not match"
 
 echo "Compare the not CoW'd sections"
-_compare_range "$TESTDIR/file1" 18 "$TESTDIR/file2" 18 17 \
+_compare_range "$testdir/file1" 18 "$testdir/file2" 18 17 \
        || echo "Start sections of 1-2 do not match"
 
-_compare_range "$TESTDIR/file2" 18 "$TESTDIR/file3" 18 17 \
+_compare_range "$testdir/file2" 18 "$testdir/file3" 18 17 \
        || echo "Start sections of 2-3 do not match"
 
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 16 - 17)) \
-               "$TESTDIR/file2" $((BLKSZ * 16 - 17)) 82 \
+_compare_range  "$testdir/file1" $((blksz * 16 - 17)) \
+               "$testdir/file2" $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 16 - 17)) \
-               "$TESTDIR/file3" $((BLKSZ * 16 - 17)) 82 \
+_compare_range  "$testdir/file2" $((blksz * 16 - 17)) \
+               "$testdir/file3" $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 2-3 do not match"
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 48 - 120)) \
-               "$TESTDIR/file2" $((BLKSZ * 48 - 120)) 100 \
+_compare_range  "$testdir/file1" $((blksz * 48 - 120)) \
+               "$testdir/file2" $((blksz * 48 - 120)) 100 \
        || echo "End sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 48 - 120)) \
-               "$TESTDIR/file3" $((BLKSZ * 48 - 120)) 100 \
+_compare_range  "$testdir/file2" $((blksz * 48 - 120)) \
+               "$testdir/file3" $((blksz * 48 - 120)) 100 \
        || echo "End sections of 2-3 do not match"
 
 
-_compare_range  "$TESTDIR/file1" $((BLKSZ * 14)) \
-               "$TESTDIR/file2" $((BLKSZ * 14)) $BLKSZ \
+_compare_range  "$testdir/file1" $((blksz * 14)) \
+               "$testdir/file2" $((blksz * 14)) $blksz \
        || echo "Untouched sections of 1-2 do not match"
 
-_compare_range  "$TESTDIR/file2" $((BLKSZ * 14)) \
-               "$TESTDIR/file3" $((BLKSZ * 14)) $BLKSZ \
+_compare_range  "$testdir/file2" $((blksz * 14)) \
+               "$testdir/file3" $((blksz * 14)) $blksz \
        || echo "Untouched sections of 2-3 do not match"
 
 # success, all done
index cf6d6347073d652025a030358d3720e685aa8903..2ac4d10a484c16f174da527d3da7c5e0e24748fe 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,37 +52,37 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ=65536
-NR=9
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+nr=9
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-csum="$(_md5_checksum "$TESTDIR/file1")"
+md5sum "$testdir/file1" | _filter_test_dir
+csum="$(_md5_checksum "$testdir/file1")"
 
 echo "Create the reflink copies"
-seq 2 $NR | while read i; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+seq 2 $nr | while read i; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
 
 echo "Rewrite the copies"
-seq 2 $NR | while read i; do
-       _pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file$i" >> "$seqres.full"
+seq 2 $nr | while read i; do
+       _pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" >> "$seqres.full"
 done
 _test_remount
 
 echo "Examine original file"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-mod_csum="$(_md5_checksum "$TESTDIR/file2")"
-new_csum="$(_md5_checksum "$TESTDIR/file1")"
+mod_csum="$(_md5_checksum "$testdir/file2")"
+new_csum="$(_md5_checksum "$testdir/file1")"
 test "${csum}" != "${mod_csum}" || echo "checksums do not match"
 test "${csum}" = "${new_csum}" || echo "checksums do not match"
 
index d2ccb94363d5b42861de2b63729ff799b5410612..c0bc6722c499ca437baaf915bf132787ba955d18 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,37 +52,37 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ=65536
-NR=9
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+nr=9
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-csum="$(_md5_checksum "$TESTDIR/file1")"
+md5sum "$testdir/file1" | _filter_test_dir
+csum="$(_md5_checksum "$testdir/file1")"
 
 echo "Create the reflink copies"
-seq 2 $NR | while read i; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+seq 2 $nr | while read i; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
 
 echo "Rewrite the copies"
-seq 2 $NR | while read i; do
-       _pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file$i" -d >> "$seqres.full"
+seq 2 $nr | while read i; do
+       _pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" -d >> "$seqres.full"
 done
 _test_remount
 
 echo "Examine original file"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
-mod_csum="$(_md5_checksum "$TESTDIR/file2")"
-new_csum="$(_md5_checksum "$TESTDIR/file1")"
+mod_csum="$(_md5_checksum "$testdir/file2")"
+new_csum="$(_md5_checksum "$testdir/file1")"
 test "${csum}" != "${mod_csum}" || echo "checksums do not match"
 test "${csum}" = "${new_csum}" || echo "checksums do not match"
 
index bee0893d9e4b2ff0c455290a81b777143644495b..631fa33ff029d2dac34e2bc6f91ba3a16658440c 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,90 +52,90 @@ _require_xfs_io_command "truncate"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 5 + 37)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 5 + 37)) "$testdir/file1" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ \
-               $((BLKSZ * 4 + 37)) >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $blksz \
+               $((blksz * 4 + 37)) >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $((BLKSZ * 5 + 37))" "$TESTDIR/file3" >> "$seqres.full"
-_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $BLKSZ >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $((blksz * 5 + 37))" "$testdir/file3" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file3" 0 $blksz >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $((BLKSZ * 5 + 37))" "$TESTDIR/file4" >> "$seqres.full"
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ $BLKSZ >> "$seqres.full"
-_reflink_range "$TESTDIR/file1" $((BLKSZ * 3)) "$TESTDIR/file4" $((BLKSZ * 3)) \
-               $BLKSZ >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $((blksz * 5 + 37))" "$testdir/file4" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file4" $blksz $blksz >> "$seqres.full"
+_reflink_range "$testdir/file1" $((blksz * 3)) "$testdir/file4" $((blksz * 3)) \
+               $blksz >> "$seqres.full"
 
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file5"
+_cp_reflink "$testdir/file1" "$testdir/file5"
 _test_remount
 
 echo "Compare sections"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file5" | _filter_test_dir
-
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ \
-               $((BLKSZ * 4 + 37)) \
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file5" | _filter_test_dir
+
+_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz \
+               $((blksz * 4 + 37)) \
        || echo "shared parts of files 1-2 changed"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $BLKSZ \
+_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $blksz \
        || echo "shared parts of files 1-3 changed"
 
-_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ $BLKSZ \
+_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz $blksz \
        || echo "shared parts of files 1-4 changed"
 
-_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file5" 0 $((BLKSZ * 5 + 37)) \
+_compare_range "$testdir/file1" 0 "$testdir/file5" 0 $((blksz * 5 + 37)) \
        || echo "shared parts of files 1-5 changed"
 
 echo "Compare files"
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-C5="$(_md5_checksum "$TESTDIR/file5")"
-
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C1}"  = "${C5}" || echo "file1 and file5 should match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C2}" != "${C5}" || echo "file2 and file5 should not match"
-test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
-test "${C3}" != "${C5}" || echo "file3 and file5 should not match"
-test "${C4}" != "${C5}" || echo "file4 and file5 should not match"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+c5="$(_md5_checksum "$testdir/file5")"
+
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c1}"  = "${c5}" || echo "file1 and file5 should match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c2}" != "${c5}" || echo "file2 and file5 should not match"
+test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
+test "${c3}" != "${c5}" || echo "file3 and file5 should not match"
+test "${c4}" != "${c5}" || echo "file4 and file5 should not match"
 
 echo "falloc everything"
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 5))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 5))" "$TESTDIR/file3" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 5))" "$TESTDIR/file4" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file3" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file4" >> "$seqres.full"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file5" | _filter_test_dir
-
-D1="$(_md5_checksum "$TESTDIR/file1")"
-D2="$(_md5_checksum "$TESTDIR/file2")"
-D3="$(_md5_checksum "$TESTDIR/file3")"
-D4="$(_md5_checksum "$TESTDIR/file4")"
-D5="$(_md5_checksum "$TESTDIR/file5")"
-
-test "${C1}" = "${D1}" || echo "file1 should not change"
-test "${C2}" = "${D2}" || echo "file2 should not change"
-test "${C3}" = "${D3}" || echo "file3 should not change"
-test "${C4}" = "${D4}" || echo "file4 should not change"
-test "${C5}" = "${D5}" || echo "file2 should not change"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file5" | _filter_test_dir
+
+d1="$(_md5_checksum "$testdir/file1")"
+d2="$(_md5_checksum "$testdir/file2")"
+d3="$(_md5_checksum "$testdir/file3")"
+d4="$(_md5_checksum "$testdir/file4")"
+d5="$(_md5_checksum "$testdir/file5")"
+
+test "${c1}" = "${d1}" || echo "file1 should not change"
+test "${c2}" = "${d2}" || echo "file2 should not change"
+test "${c3}" = "${d3}" || echo "file3 should not change"
+test "${c4}" = "${d4}" || echo "file4 should not change"
+test "${c5}" = "${d5}" || echo "file2 should not change"
 
 # success, all done
 status=0
index 8a14f823c1768ec269d9f128f9af4e28db07d9ea..2b8d74f690515e496e828915b01e5c33983ac56d 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -53,89 +53,89 @@ _require_xfs_io_command "fcollapse"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
-
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file1"
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file3"
-"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file4"
-
-_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
+
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink "$testdir/file1" "$testdir/file3"
+_cp_reflink "$testdir/file1" "$testdir/file4"
+
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file1"
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file3"
+"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file4"
+
+_pwrite_byte 0x62 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" = "${C3}" || echo "file1 and file3 should match"
-test "${C1}" = "${C4}" || echo "file1 and file4 should match"
-test "${C2}" = "${C3}" || echo "file2 and file3 should match"
-test "${C2}" = "${C4}" || echo "file2 and file4 should match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c3}" || echo "file1 and file3 should match"
+test "${c1}" = "${c4}" || echo "file1 and file4 should match"
+test "${c2}" = "${c3}" || echo "file2 and file3 should match"
+test "${c2}" = "${c4}" || echo "file2 and file4 should match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "fcollapse files"
-"$XFS_IO_PROG" -f -c "fcollapse 0 $BLKSZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "fcollapse $BLKSZ $BLKSZ" "$TESTDIR/file3"
-"$XFS_IO_PROG" -f -c "fcollapse $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
+"$XFS_IO_PROG" -f -c "fcollapse 0 $blksz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "fcollapse $blksz $blksz" "$testdir/file3"
+"$XFS_IO_PROG" -f -c "fcollapse $((blksz * 2)) $blksz" "$testdir/file4"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
+cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
index 9e3eff6b0600d4ca6e00f8e65b1d9f2670bf669b..17dc30609eed3deefeedd5b497419cd6c390358f 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,84 +52,84 @@ _require_xfs_io_command "fpunch"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
-
-_pwrite_byte 0x00 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
+
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink "$testdir/file1" "$testdir/file3"
+_cp_reflink "$testdir/file1" "$testdir/file4"
+
+_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" = "${C3}" || echo "file1 and file3 should match"
-test "${C1}" = "${C4}" || echo "file1 and file4 should match"
-test "${C2}" = "${C3}" || echo "file2 and file3 should match"
-test "${C2}" = "${C4}" || echo "file2 and file4 should match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c3}" || echo "file1 and file3 should match"
+test "${c1}" = "${c4}" || echo "file1 and file4 should match"
+test "${c2}" = "${c3}" || echo "file2 and file3 should match"
+test "${c2}" = "${c4}" || echo "file2 and file4 should match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "fpunch files"
-"$XFS_IO_PROG" -f -c "fpunch 0 $BLKSZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "fpunch $BLKSZ $BLKSZ" "$TESTDIR/file3"
-"$XFS_IO_PROG" -f -c "fpunch $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
+"$XFS_IO_PROG" -f -c "fpunch 0 $blksz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "fpunch $blksz $blksz" "$testdir/file3"
+"$XFS_IO_PROG" -f -c "fpunch $((blksz * 2)) $blksz" "$testdir/file4"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
+cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
index c35bdd9b72e76bbdb7fcb22b0393437a9b434372..b1601314dc046391372d92839f8a49ef9d615526 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,87 +52,87 @@ _require_xfs_io_command "finsert"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
-
-_pwrite_byte 0x00 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
+
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink "$testdir/file1" "$testdir/file3"
+_cp_reflink "$testdir/file1" "$testdir/file4"
+
+_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file4.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" = "${C3}" || echo "file1 and file3 should match"
-test "${C1}" = "${C4}" || echo "file1 and file4 should match"
-test "${C2}" = "${C3}" || echo "file2 and file3 should match"
-test "${C2}" = "${C4}" || echo "file2 and file4 should match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c3}" || echo "file1 and file3 should match"
+test "${c1}" = "${c4}" || echo "file1 and file4 should match"
+test "${c2}" = "${c3}" || echo "file2 and file3 should match"
+test "${c2}" = "${c4}" || echo "file2 and file4 should match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "finsert files"
-"$XFS_IO_PROG" -f -c "finsert 0 $BLKSZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "finsert $BLKSZ $BLKSZ" "$TESTDIR/file3"
-"$XFS_IO_PROG" -f -c "finsert $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
+"$XFS_IO_PROG" -f -c "finsert 0 $blksz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "finsert $blksz $blksz" "$testdir/file3"
+"$XFS_IO_PROG" -f -c "finsert $((blksz * 2)) $blksz" "$testdir/file4"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
+cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
index 3d7a762683ff53f67a01ccc301e42955e57bf53b..cf5567bcbeb1bfe6a4fa8e4861b5a80e58fd8ba4 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -53,63 +53,63 @@ _require_xfs_io_command "truncate"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ 37 "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz 37 "$testdir/file1" >> "$seqres.full"
 
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink "$testdir/file1" "$testdir/file3"
 
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ 34 "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz 34 "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ 37 "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ + 37)) 3 "$TESTDIR/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz 37 "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz + 37)) 3 "$testdir/file3.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
 
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" = "${C3}" || echo "file1 and file3 should match"
-test "${C2}" = "${C3}" || echo "file2 and file3 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c3}" || echo "file1 and file3 should match"
+test "${c2}" = "${c3}" || echo "file2 and file3 should match"
 
 echo "truncate files"
-"$XFS_IO_PROG" -f -c "truncate $((BLKSZ + 34))" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "truncate $((BLKSZ + 40))" "$TESTDIR/file3"
+"$XFS_IO_PROG" -f -c "truncate $((blksz + 34))" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "truncate $((blksz + 40))" "$testdir/file3"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
 
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
 
 # success, all done
 status=0
index 44b5ae403cf7f3f1bf7b4802ae8c7513e1c9f08a..7d3189e50e178c62b977a2b621f0c7ee76ea385e 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,84 +52,84 @@ _require_xfs_io_command "fzero"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
-
-_pwrite_byte 0x00 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
+
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink "$testdir/file1" "$testdir/file3"
+_cp_reflink "$testdir/file1" "$testdir/file4"
+
+_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+
+_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
-test "${C1}" = "${C3}" || echo "file1 and file3 should match"
-test "${C1}" = "${C4}" || echo "file1 and file4 should match"
-test "${C2}" = "${C3}" || echo "file2 and file3 should match"
-test "${C2}" = "${C4}" || echo "file2 and file4 should match"
-test "${C3}" = "${C4}" || echo "file3 and file4 should match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c3}" || echo "file1 and file3 should match"
+test "${c1}" = "${c4}" || echo "file1 and file4 should match"
+test "${c2}" = "${c3}" || echo "file2 and file3 should match"
+test "${c2}" = "${c4}" || echo "file2 and file4 should match"
+test "${c3}" = "${c4}" || echo "file3 and file4 should match"
 
 echo "fzero files"
-"$XFS_IO_PROG" -f -c "fzero 0 $BLKSZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "fzero $BLKSZ $BLKSZ" "$TESTDIR/file3"
-"$XFS_IO_PROG" -f -c "fzero $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
+"$XFS_IO_PROG" -f -c "fzero 0 $blksz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "fzero $blksz $blksz" "$testdir/file3"
+"$XFS_IO_PROG" -f -c "fzero $((blksz * 2)) $blksz" "$testdir/file4"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file3" | _filter_test_dir
-md5sum "$TESTDIR/file4" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
-md5sum "$TESTDIR/file3.chk" | _filter_test_dir
-md5sum "$TESTDIR/file4.chk" | _filter_test_dir
-
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
-C3="$(_md5_checksum "$TESTDIR/file3")"
-C4="$(_md5_checksum "$TESTDIR/file4")"
-
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
-test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
-test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
-test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
-test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
-test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file3" | _filter_test_dir
+md5sum "$testdir/file4" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum "$testdir/file4.chk" | _filter_test_dir
+
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
+c3="$(_md5_checksum "$testdir/file3")"
+c4="$(_md5_checksum "$testdir/file4")"
+
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
+test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
+test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
+test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
+cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
index 3046e92213c9408a60c897218e76d87ab519d7b7..f3a63114d17a3a07cf19fbb4e64c7b5b650e7ad5 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,28 +50,28 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f $TESTDIR -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-NR=7
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f $testdir -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+nr=7
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 sync
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
+free_blocks0=$(stat -f "$testdir" -c '%f')
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file.$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file.$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
-_within_tolerance "free blocks after reflink" $FREE_BLOCKS1 $FREE_BLOCKS0 $MARGIN -v
+_within_tolerance "free blocks after reflink" $free_blocks1 $free_blocks0 $margin -v
 
 # success, all done
 status=0
index c42ca1da0aa297d0c4396b1bd5f849ad4a5b3f45..286b9ec7e4057e7e9d1726363b831f7bac34bc59 100755 (executable)
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -54,44 +54,44 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=7
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=7
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 sync
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file.$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file.$i"
 done
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/survivor"
+_cp_reflink "$testdir/file1" "$testdir/survivor"
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
 echo "Delete most of the files"
-rm -rf "$TESTDIR"/file*
+rm -rf "$testdir"/file*
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
 echo "Delete all the files"
-rm -rf "$TESTDIR"/*
+rm -rf "$testdir"/*
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
+free_blocks3=$(stat -f "$testdir" -c '%f')
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
 
-_within_tolerance "free blocks after reflink" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflink" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after deleting some reflink copies" $FREE_BLOCKS2 $FREE_BLOCKS1 $MARGIN -v
+_within_tolerance "free blocks after deleting some reflink copies" $free_blocks2 $free_blocks1 $margin -v
 
-_within_tolerance "free blocks after deleting all copies" $FREE_BLOCKS3 $FREE_BLOCKS0 $MARGIN -v
+_within_tolerance "free blocks after deleting all copies" $free_blocks3 $free_blocks0 $margin -v
 
 # success, all done
 status=0
index 95ffe40a66e5ce34b26fcc1dda7d10361df8930b..506a7544bd7ee49efe148db0c05f376c601e4177 100755 (executable)
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -55,48 +55,48 @@ _require_xfs_io_command "fpunch"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 sync
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
 echo "Punch most of the blocks"
-"$XFS_IO_PROG" -f -c "fpunch 0 $SZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "fpunch 0 $((SZ / 2))" "$TESTDIR/file3"
-"$XFS_IO_PROG" -f -c "fpunch $((SZ / 2)) $((SZ / 2))" "$TESTDIR/file4"
+"$XFS_IO_PROG" -f -c "fpunch 0 $sz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "fpunch 0 $((sz / 2))" "$testdir/file3"
+"$XFS_IO_PROG" -f -c "fpunch $((sz / 2)) $((sz / 2))" "$testdir/file4"
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
 echo "Punch all the files"
-for i in `seq 2 $NR`; do
-       "$XFS_IO_PROG" -f -c "fpunch 0 $SZ" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       "$XFS_IO_PROG" -f -c "fpunch 0 $sz" "$testdir/file$i"
 done
-"$XFS_IO_PROG" -f -c "fpunch 0 $SZ" "$TESTDIR/file1"
+"$XFS_IO_PROG" -f -c "fpunch 0 $sz" "$testdir/file1"
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
+free_blocks3=$(stat -f "$testdir" -c '%f')
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
 
-_within_tolerance "free blocks after reflink" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflink" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after punching some reflink copies" $FREE_BLOCKS2 $FREE_BLOCKS1 $MARGIN -v
+_within_tolerance "free blocks after punching some reflink copies" $free_blocks2 $free_blocks1 $margin -v
 
-_within_tolerance "free blocks after punching all copies" $FREE_BLOCKS3 $FREE_BLOCKS0 $MARGIN -v
+_within_tolerance "free blocks after punching all copies" $free_blocks3 $free_blocks0 $margin -v
 
 # success, all done
 status=0
index 2deee2043174e6b844373889a25dbf2fb2353471..011879e99f641a608db089d2b817166547d6c17c 100755 (executable)
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -55,47 +55,47 @@ _require_xfs_io_command "fcollapse"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
 echo "Collapse most of the blocks"
-"$XFS_IO_PROG" -f -c "fcollapse 0 $(((BLKS - 1) * BLKSZ))" $TESTDIR/file2
-"$XFS_IO_PROG" -f -c "fcollapse 0 $((SZ / 2))" $TESTDIR/file3
-"$XFS_IO_PROG" -f -c "fcollapse $((SZ / 2)) $(( ((BLKS / 2) - 1) * BLKSZ))" $TESTDIR/file4
+"$XFS_IO_PROG" -f -c "fcollapse 0 $(((blks - 1) * blksz))" $testdir/file2
+"$XFS_IO_PROG" -f -c "fcollapse 0 $((sz / 2))" $testdir/file3
+"$XFS_IO_PROG" -f -c "fcollapse $((sz / 2)) $(( ((blks / 2) - 1) * blksz))" $testdir/file4
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
 echo "Collpase nearly all the files"
-"$XFS_IO_PROG" -f -c "fcollapse 0 $(( ((BLKS / 2) - 1) * BLKSZ))" $TESTDIR/file3
-"$XFS_IO_PROG" -f -c "fcollapse 0 $((SZ / 2))" $TESTDIR/file4
-"$XFS_IO_PROG" -f -c "fcollapse 0 $(( (BLKS - 1) * BLKSZ))" $TESTDIR/file1
+"$XFS_IO_PROG" -f -c "fcollapse 0 $(( ((blks / 2) - 1) * blksz))" $testdir/file3
+"$XFS_IO_PROG" -f -c "fcollapse 0 $((sz / 2))" $testdir/file4
+"$XFS_IO_PROG" -f -c "fcollapse 0 $(( (blks - 1) * blksz))" $testdir/file1
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
+free_blocks3=$(stat -f "$testdir" -c '%f')
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
 
-_within_tolerance "free blocks after reflink" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflink" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after fcollapsing some reflink copies" $FREE_BLOCKS2 $FREE_BLOCKS1 $MARGIN -v
+_within_tolerance "free blocks after fcollapsing some reflink copies" $free_blocks2 $free_blocks1 $margin -v
 
-_within_tolerance "free blocks after fcollapsing all copies" $FREE_BLOCKS3 $FREE_BLOCKS0 $MARGIN -v
+_within_tolerance "free blocks after fcollapsing all copies" $free_blocks3 $free_blocks0 $margin -v
 
 # success, all done
 status=0
index 173b9812589be1995b0ecb0cdfe361e5a39eeb68..474c578b58f3b6661d06499fdfa94a8d21657d2b 100755 (executable)
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -54,56 +54,56 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=4
-SZ=$((BLKS * BLKSZ))
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=4
+sz=$((blks * blksz))
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite some of the blocks"
-_pwrite_byte 0x62 0 $SZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $((SZ / 2)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x64 $((SZ / 2)) $((SZ / 2)) "$TESTDIR/file4" >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x63 0 $((sz / 2)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x64 $((sz / 2)) $((sz / 2)) "$testdir/file4" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite all the files"
-_pwrite_byte 0x62 0 $SZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $SZ "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x64 0 $SZ "$TESTDIR/file4" >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x63 0 $sz "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x64 0 $sz "$testdir/file4" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
+free_blocks3=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS4=$(stat -f "$TESTDIR" -c '%f')
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+free_blocks4=$(stat -f "$testdir" -c '%f')
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
-_within_tolerance "free blocks after reflinking" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after partially CoWing some copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - (2 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after partially CoWing some copies" $free_blocks2 $((free_blocks1 - (2 * blks))) $margin -v
 
-_within_tolerance "free blocks after CoWing all copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after CoWing all copies" $free_blocks3 $((free_blocks2 - blks)) $margin -v
 
-_within_tolerance "free blocks after overwriting original" $FREE_BLOCKS4 $FREE_BLOCKS3 $MARGIN -v
+_within_tolerance "free blocks after overwriting original" $free_blocks4 $free_blocks3 $margin -v
 
-_within_tolerance "free blocks after all tests" $FREE_BLOCKS4 $((FREE_BLOCKS0 - (4 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after all tests" $free_blocks4 $((free_blocks0 - (4 * blks))) $margin -v
 
 # success, all done
 status=0
index 25512957e0df33d50f657ed7d757a9ad5c265d63..611cf1abf8d6aa16fa4a67e65a0605eb5b0b6ffa 100755 (executable)
@@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -58,56 +58,56 @@ _require_xfs_io_command "fzero"
 
 rm -f "$seqres.full"
 
-TESTDIR=$TEST_DIR/test-$seq
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite some of the blocks"
-"$XFS_IO_PROG" -f -c "fzero 0 $SZ" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $((SZ / 2)) "$TESTDIR/file3" -d >> "$seqres.full"
-_mwrite_byte 0x64 $((SZ / 2)) $((SZ / 2)) $SZ "$TESTDIR/file4" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "fzero 0 $sz" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x63 0 $((sz / 2)) "$testdir/file3" -d >> "$seqres.full"
+_mwrite_byte 0x64 $((sz / 2)) $((sz / 2)) $sz "$testdir/file4" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite all the files"
-_pwrite_byte 0x62 0 $SZ "$TESTDIR/file2" -d >> "$seqres.full"
-_mwrite_byte 0x63 0 $SZ $SZ "$TESTDIR/file3" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "fzero 0 $SZ" $TESTDIR/file4 >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz "$testdir/file2" -d >> "$seqres.full"
+_mwrite_byte 0x63 0 $sz $sz "$testdir/file3" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "fzero 0 $sz" $testdir/file4 >> "$seqres.full"
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
+free_blocks3=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS4=$(stat -f "$TESTDIR" -c '%f')
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+free_blocks4=$(stat -f "$testdir" -c '%f')
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
-_within_tolerance "free blocks after reflinking" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after partially CoWing some copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - (2 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after partially CoWing some copies" $free_blocks2 $((free_blocks1 - (2 * blks))) $margin -v
 
-_within_tolerance "free blocks after CoWing all copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after CoWing all copies" $free_blocks3 $((free_blocks2 - blks)) $margin -v
 
-_within_tolerance "free blocks after overwriting original" $FREE_BLOCKS4 $FREE_BLOCKS3 $MARGIN -v
+_within_tolerance "free blocks after overwriting original" $free_blocks4 $free_blocks3 $margin -v
 
-_within_tolerance "free blocks after all tests" $FREE_BLOCKS4 $((FREE_BLOCKS0 - (4 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after all tests" $free_blocks4 $((free_blocks0 - (4 * blks))) $margin -v
 
 # success, all done
 status=0
index 78b7e8c17b3755227d9e24adba10335b786e73df..7194e8758bce0285f428808a646b0f65c7ad4e46 100755 (executable)
@@ -45,7 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -66,58 +66,58 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
 echo "funshare part of a file"
-"$XFS_IO_PROG" -f -c "falloc 0 $((SZ / 2))" "$TESTDIR/file2"
+"$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
 _test_remount
 
 echo "funshare some of the copies"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file3"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
 echo "funshare the rest of the files"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file4"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file1"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
+free_blocks3=$(stat -f "$testdir" -c '%f')
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS4=$(stat -f "$TESTDIR" -c '%f')
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+free_blocks4=$(stat -f "$testdir" -c '%f')
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
-_within_tolerance "free blocks after reflinking" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after nocow'ing some copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - (2 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after nocow'ing some copies" $free_blocks2 $((free_blocks1 - (2 * blks))) $margin -v
 
-_within_tolerance "free blocks after nocow'ing all copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after nocow'ing all copies" $free_blocks3 $((free_blocks2 - blks)) $margin -v
 
-_within_tolerance "free blocks after overwriting original" $FREE_BLOCKS4 $FREE_BLOCKS3 $MARGIN -v
+_within_tolerance "free blocks after overwriting original" $free_blocks4 $free_blocks3 $margin -v
 
-_within_tolerance "free blocks after all tests" $FREE_BLOCKS4 $((FREE_BLOCKS0 - (4 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after all tests" $free_blocks4 $((free_blocks0 - (4 * blks))) $margin -v
 
 # success, all done
 status=0
index 67f3ea5fec40b1afc85bc9e77a0ecccdc5359033..a5b84fced3c06371da5cab5c1012077f863b5618 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -52,31 +52,31 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR1="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR1"
-mkdir "$TESTDIR1"
+testdir1="$TEST_DIR/test-$seq"
+rm -rf "$testdir1"
+mkdir "$testdir1"
 
-TESTDIR2=$SCRATCH_MNT/test-$seq
-rm -rf "$TESTDIR2"
-mkdir "$TESTDIR2"
+testdir2=$SCRATCH_MNT/test-$seq
+rm -rf "$testdir2"
+mkdir "$testdir2"
 
 echo "Create the original files"
-BLKSZ="$(stat -f $TESTDIR1 -c '%S')"
-BLKS=1000
-MARGIN=50
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f $TESTDIR1 -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR2/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR2/file2" >> "$seqres.full"
-mkdir "$TESTDIR1/dir1"
-seq 1 $((2 * BLKSZ / 250)) | while read f; do
-       touch "$TESTDIR1/dir1/$f"
+blksz="$(stat -f $testdir1 -c '%S')"
+blks=1000
+margin=50
+sz=$((blksz * blks))
+free_blocks0=$(stat -f $testdir1 -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir2/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir2/file2" >> "$seqres.full"
+mkdir "$testdir1/dir1"
+seq 1 $((2 * blksz / 250)) | while read f; do
+       touch "$testdir1/dir1/$f"
 done
-mknod "$TESTDIR1/dev1" c 1 3
-mkfifo "$TESTDIR1/fifo1"
+mknod "$testdir1/dev1" c 1 3
+mkfifo "$testdir1/fifo1"
 sync
 
 _filter_enotty() {
@@ -88,38 +88,38 @@ _filter_einval() {
 }
 
 echo "Try cross-device reflink"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR2/file1" 0 $BLKSZ
+_reflink_range "$testdir1/file1" 0 "$testdir2/file1" 0 $blksz
 
 echo "Try unaligned reflink"
-_reflink_range "$TESTDIR1/file1" 37 "$TESTDIR1/file1" 59 23
+_reflink_range "$testdir1/file1" 37 "$testdir1/file1" 59 23
 
 echo "Try overlapping reflink"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file1" 1 $((BLKSZ * 2))
+_reflink_range "$testdir1/file1" 0 "$testdir1/file1" 1 $((blksz * 2))
 
 echo "Try reflink past EOF"
-_reflink_range "$TESTDIR1/file1" $(( (BLKS + 10) * BLKSZ)) "$TESTDIR1/file1" 0 $BLKSZ
+_reflink_range "$testdir1/file1" $(( (blks + 10) * blksz)) "$testdir1/file1" 0 $blksz
 
 echo "Try to reflink a dir"
-_reflink_range "$TESTDIR1/dir1" 0 "$TESTDIR1/file2" 0 $BLKSZ
+_reflink_range "$testdir1/dir1" 0 "$testdir1/file2" 0 $blksz
 
 echo "Try to reflink a device"
-_reflink_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ
+_reflink_range "$testdir1/dev1" 0 "$testdir1/file2" 0 $blksz
 
 echo "Try to reflink to a dir"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ 2>&1 | _filter_test_dir
+_reflink_range "$testdir1/file1" 0 "$testdir1/dir1" 0 $blksz 2>&1 | _filter_test_dir
 
 echo "Try to reflink to a device"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ 2>&1 | _filter_enotty
+_reflink_range "$testdir1/file1" 0 "$testdir1/dev1" 0 $blksz 2>&1 | _filter_enotty
 
 echo "Try to reflink to a fifo"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n 2>&1 | _filter_enotty
+_reflink_range "$testdir1/file1" 0 "$testdir1/fifo1" 0 $blksz -n 2>&1 | _filter_enotty
 
 echo "Try to reflink an append-only file"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a 2>&1 | _filter_einval
+_reflink_range "$testdir1/file1" 0 "$testdir1/file3" 0 $blksz -a 2>&1 | _filter_einval
 
 echo "Reflink two files"
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file2" 0 $BLKSZ >> "$seqres.full"
-_reflink_range "$TESTDIR2/file1" 0 "$TESTDIR2/file2" 0 $BLKSZ >> "$seqres.full"
+_reflink_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
+_reflink_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
 echo "Check scratch fs"
 _scratch_unmount
index 18bda382ef1f36ab60741ecbc186104caecac148..58b7090052891156591d41c743156635ee75acea 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -52,32 +52,32 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR1="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR1"
-mkdir "$TESTDIR1"
+testdir1="$TEST_DIR/test-$seq"
+rm -rf "$testdir1"
+mkdir "$testdir1"
 
-TESTDIR2=$SCRATCH_MNT/test-$seq
-rm -rf "$TESTDIR2"
-mkdir "$TESTDIR2"
+testdir2=$SCRATCH_MNT/test-$seq
+rm -rf "$testdir2"
+mkdir "$testdir2"
 
 echo "Create the original files"
-BLKSZ="$(stat -f $TESTDIR1 -c '%S')"
-BLKS=1000
-MARGIN=50
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f $TESTDIR1 -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file3" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR2/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR2/file2" >> "$seqres.full"
-mkdir "$TESTDIR1/dir1"
-seq 1 $((2 * BLKSZ / 250)) | while read f; do
-       touch "$TESTDIR1/dir1/$f"
+blksz="$(stat -f $testdir1 -c '%S')"
+blks=1000
+margin=50
+sz=$((blksz * blks))
+free_blocks0=$(stat -f $testdir1 -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir1/file3" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir2/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir2/file2" >> "$seqres.full"
+mkdir "$testdir1/dir1"
+seq 1 $((2 * blksz / 250)) | while read f; do
+       touch "$testdir1/dir1/$f"
 done
-mknod "$TESTDIR1/dev1" c 1 3
-mkfifo "$TESTDIR1/fifo1"
+mknod "$testdir1/dev1" c 1 3
+mkfifo "$testdir1/fifo1"
 sync
 
 _filter_enotty() {
@@ -89,38 +89,38 @@ _filter_eperm() {
 }
 
 echo "Try cross-device dedupe"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR2/file1" 0 $BLKSZ
+_dedupe_range "$testdir1/file1" 0 "$testdir2/file1" 0 $blksz
 
 echo "Try unaligned dedupe"
-_dedupe_range "$TESTDIR1/file1" 37 "$TESTDIR1/file1" 59 23
+_dedupe_range "$testdir1/file1" 37 "$testdir1/file1" 59 23
 
 echo "Try overlapping dedupe"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/file1" 1 $((BLKSZ * 2))
+_dedupe_range "$testdir1/file1" 0 "$testdir1/file1" 1 $((blksz * 2))
 
 echo "Try dedupe past EOF"
-_dedupe_range "$TESTDIR1/file1" $(( (BLKS + 10) * BLKSZ)) "$TESTDIR1/file1" 0 $BLKSZ
+_dedupe_range "$testdir1/file1" $(( (blks + 10) * blksz)) "$testdir1/file1" 0 $blksz
 
 echo "Try to dedupe a dir"
-_dedupe_range "$TESTDIR1/dir1" 0 "$TESTDIR1/file2" 0 $BLKSZ
+_dedupe_range "$testdir1/dir1" 0 "$testdir1/file2" 0 $blksz
 
 echo "Try to dedupe a device"
-_dedupe_range "$TESTDIR1/dev1" 0 "$TESTDIR1/file2" 0 $BLKSZ 2>&1 | _filter_enotty
+_dedupe_range "$testdir1/dev1" 0 "$testdir1/file2" 0 $blksz 2>&1 | _filter_enotty
 
 echo "Try to dedupe to a dir"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dir1" 0 $BLKSZ 2>&1 | _filter_test_dir
+_dedupe_range "$testdir1/file1" 0 "$testdir1/dir1" 0 $blksz 2>&1 | _filter_test_dir
 
 echo "Try to dedupe to a device"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/dev1" 0 $BLKSZ 2>&1 | _filter_eperm
+_dedupe_range "$testdir1/file1" 0 "$testdir1/dev1" 0 $blksz 2>&1 | _filter_eperm
 
 echo "Try to dedupe to a fifo"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/fifo1" 0 $BLKSZ -n 2>&1 | _filter_eperm
+_dedupe_range "$testdir1/file1" 0 "$testdir1/fifo1" 0 $blksz -n 2>&1 | _filter_eperm
 
 echo "Try to dedupe an append-only file"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/file3" 0 $BLKSZ -a >> "$seqres.full"
+_dedupe_range "$testdir1/file1" 0 "$testdir1/file3" 0 $blksz -a >> "$seqres.full"
 
 echo "Dedupe two files"
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/file2" 0 $BLKSZ >> "$seqres.full"
-_dedupe_range "$TESTDIR2/file1" 0 "$TESTDIR2/file2" 0 $BLKSZ >> "$seqres.full"
+_dedupe_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
+_dedupe_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
 echo "Check scratch fs"
 _scratch_unmount
index 369663db6ad1f3f61c92f83b1a3de6b214e85afb..14baf64b41fe9ec29c4cfce971102225a804caaa 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -49,25 +49,25 @@ _require_test_reflink
 rm -f "$seqres.full"
 
 echo "Format and mount"
-TESTDIR1="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR1"
-mkdir "$TESTDIR1"
+testdir1="$TEST_DIR/test-$seq"
+rm -rf "$testdir1"
+mkdir "$testdir1"
 
 echo "Create the original files"
-BLKSZ="$(stat -f $TESTDIR1 -c '%S')"
-BLKS=1000
-MARGIN=50
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f $TESTDIR1 -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file2" >> "$seqres.full"
+blksz="$(stat -f $testdir1 -c '%S')"
+blks=1000
+margin=50
+sz=$((blksz * blks))
+free_blocks0=$(stat -f $testdir1 -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
 sync
 
 echo "Try reflink on immutable files"
-$CHATTR_PROG +i $TESTDIR1/file1 $TESTDIR1/file2
-_reflink_range "$TESTDIR1/file1" 0 "$TESTDIR1/file2" 0 $BLKSZ 2>&1 | _filter_test_dir
-$CHATTR_PROG -i $TESTDIR1/file1 $TESTDIR1/file2
+$CHATTR_PROG +i $testdir1/file1 $testdir1/file2
+_reflink_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz 2>&1 | _filter_test_dir
+$CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done
 status=0
index 4dfee12b15ee5707cc20d0d836f99d3754f96dc2..acd2c4e89b0f39d2767a69235246fc181ae2a0d4 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -49,25 +49,25 @@ _require_test_dedupe
 rm -f "$seqres.full"
 
 echo "Format and mount"
-TESTDIR1="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR1"
-mkdir "$TESTDIR1"
+testdir1="$TEST_DIR/test-$seq"
+rm -rf "$testdir1"
+mkdir "$testdir1"
 
 echo "Create the original files"
-BLKSZ="$(stat -f $TESTDIR1 -c '%S')"
-BLKS=1000
-MARGIN=50
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f $TESTDIR1 -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR1/file2" >> "$seqres.full"
+blksz="$(stat -f $testdir1 -c '%S')"
+blks=1000
+margin=50
+sz=$((blksz * blks))
+free_blocks0=$(stat -f $testdir1 -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
 sync
 
 echo "Try dedupe on immutable files"
-$CHATTR_PROG +i $TESTDIR1/file1 $TESTDIR1/file2
-_dedupe_range "$TESTDIR1/file1" 0 "$TESTDIR1/file2" 0 $BLKSZ 2>&1 | _filter_test_dir
-$CHATTR_PROG -i $TESTDIR1/file1 $TESTDIR1/file2
+$CHATTR_PROG +i $testdir1/file1 $testdir1/file2
+_dedupe_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz 2>&1 | _filter_test_dir
+$CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done
 status=0
index efb137ca62a539e77d29f23e2b66519415fc4805..7fb89632e9a14e9359ca31be67fe48a2045ba51a 100755 (executable)
@@ -51,22 +51,22 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=4096
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2"
 _scratch_remount
 
 echo "Delete while rewriting"
-rm -rf "$TESTDIR/file1" &
-_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
+rm -rf "$testdir/file1" &
+_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
 wait
 
 echo "Check fs"
index 6bd3a33ece4737a3d88ce2d3b221d5be185d4cca..2fb947a05780ccc4774810109ccc0e4cd79bf982 100755 (executable)
@@ -50,24 +50,24 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=512
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
 _scratch_remount
 
 overwrite() {
-       while [ ! -e "$TESTDIR/finished" ]; do
+       while [ ! -e "$testdir/finished" ]; do
                seq $nr_loops -1 0 | while read i; do
-                       _pwrite_byte 0x61 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+                       _pwrite_byte 0x61 $((i * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
                done
        done
 }
@@ -76,13 +76,13 @@ echo "Dedupe and rewrite the file!"
 overwrite &
 for i in `seq 1 2`; do
        seq $nr_loops -1 0 | while read i; do
-               _dedupe_range   "$TESTDIR/file1" $((i * BLKSZ)) \
-                               "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _dedupe_range   "$testdir/file1" $((i * blksz)) \
+                               "$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && break
        done
 done
 echo "Finished dedupeing"
-touch "$TESTDIR/finished"
+touch "$testdir/finished"
 wait
 
 echo "Check fs"
index 1f5042f15e15771c2d5ec92f7f28251ffb9203f0..018644359937c450b93f84b7f9a63ffb6ac18101 100755 (executable)
@@ -50,24 +50,24 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=512
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
 _scratch_remount
 
 overwrite() {
-       while [ ! -e "$TESTDIR/finished" ]; do
+       while [ ! -e "$testdir/finished" ]; do
                seq $nr_loops -1 0 | while read i; do
-                       _pwrite_byte 0x61 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
+                       _pwrite_byte 0x61 $((i * blksz)) $blksz "$testdir/file1" >> "$seqres.full"
                done
        done
 }
@@ -76,13 +76,13 @@ echo "Dedupe and rewrite the file!"
 overwrite &
 for i in `seq 1 2`; do
        seq $nr_loops -1 0 | while read i; do
-               _dedupe_range   "$TESTDIR/file1" $((i * BLKSZ)) \
-                               "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _dedupe_range   "$testdir/file1" $((i * blksz)) \
+                               "$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && break
        done
 done
 echo "Finished dedupeing"
-touch "$TESTDIR/finished"
+touch "$testdir/finished"
 wait
 
 echo "Check fs"
index 4df953de0b7c1105c4e66d0f8da51278d32c5788..087c6ba03025aaa1733376be0c8f65f9b798bda6 100755 (executable)
@@ -52,19 +52,19 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=512
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file3"
 _scratch_remount
 
 fbytes() {
@@ -72,8 +72,8 @@ fbytes() {
 }
 
 reader() {
-       while [ ! -e "$TESTDIR/finished" ]; do
-               _read_range "$TESTDIR/file3" 0 $((loops * BLKSZ)) | fbytes
+       while [ ! -e "$testdir/finished" ]; do
+               _read_range "$testdir/file3" 0 $((loops * blksz)) | fbytes
        done
 }
 
@@ -81,18 +81,18 @@ echo "Reflink and reread the files!"
 reader &
 for i in `seq 1 2`; do
        seq $nr_loops -1 0 | while read i; do
-               _reflink_range  "$TESTDIR/file1" $((i * BLKSZ)) \
-                               "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _reflink_range  "$testdir/file1" $((i * blksz)) \
+                               "$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && break
        done
        seq $nr_loops -1 0 | while read i; do
-               _reflink_range  "$TESTDIR/file2" $((i * BLKSZ)) \
-                               "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _reflink_range  "$testdir/file2" $((i * blksz)) \
+                               "$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && break
        done
 done
 echo "Finished reflinking"
-touch "$TESTDIR/finished"
+touch "$testdir/finished"
 wait
 
 echo "Check fs"
index 49187ecf4754d74b582b7287afb9026d1aad1ae2..6bd15e17142a5f93bd5c85c41827a376010daf5d 100755 (executable)
@@ -52,19 +52,19 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=512
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full"
-_cp_reflink $TESTDIR/file1 $TESTDIR/file3
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+_cp_reflink $testdir/file1 $testdir/file3
 _scratch_remount
 
 fbytes() {
@@ -72,8 +72,8 @@ fbytes() {
 }
 
 reader() {
-       while [ ! -e "$TESTDIR/finished" ]; do
-               _read_range "$TESTDIR/file3" 0 $((loops * BLKSZ)) -d | fbytes
+       while [ ! -e "$testdir/finished" ]; do
+               _read_range "$testdir/file3" 0 $((loops * blksz)) -d | fbytes
        done
 }
 
@@ -81,18 +81,18 @@ echo "Reflink and dio reread the files!"
 reader &
 for i in `seq 1 2`; do
        seq $nr_loops -1 0 | while read i; do
-               _reflink_range  "$TESTDIR/file1" $((i * BLKSZ)) \
-                               "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _reflink_range  "$testdir/file1" $((i * blksz)) \
+                               "$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && break
        done
        seq $nr_loops -1 0 | while read i; do
-               _reflink_range  "$TESTDIR/file2" $((i * BLKSZ)) \
-                               "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _reflink_range  "$testdir/file2" $((i * blksz)) \
+                               "$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && break
        done
 done
 echo "Finished reflinking"
-touch "$TESTDIR/finished"
+touch "$testdir/finished"
 wait
 
 echo "Check fs"
index 93c4bc9a26dc2dd1c9e6fdb3113e91b78447c7d2..6cfb82119dc50fb795ce20372d4b79246a7beba8 100755 (executable)
@@ -52,24 +52,24 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=1024
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize file"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
 _scratch_remount
 
 # Snapshot creator...
 snappy() {
        n=0
-       while [ ! -e "$TESTDIR/finished" ]; do
-               _cp_reflink "$TESTDIR/file1" "$TESTDIR/snap_$n" || break
+       while [ ! -e "$testdir/finished" ]; do
+               _cp_reflink "$testdir/file1" "$testdir/snap_$n" || break
                n=$((n + 1))
        done
 }
@@ -77,9 +77,9 @@ snappy() {
 echo "Snapshot a file undergoing directio rewrite"
 snappy &
 seq $nr_loops -1 0 | while read i; do
-       _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ -d "$TESTDIR/file1" >> "$seqres.full"
+       _pwrite_byte 0x63 $((i * blksz)) $blksz -d "$testdir/file1" >> "$seqres.full"
 done
-touch $TESTDIR/finished
+touch $testdir/finished
 wait
 
 echo "Check for damage"
index 6d7073715f831461aa5fcae6d194dc8e065ceae0..fc5a86c06d702a898ec8509c2cf188dfc09c1175 100755 (executable)
@@ -52,24 +52,24 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=1024
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize file"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
 _scratch_remount
 
 # Snapshot creator...
 snappy() {
        n=0
-       while [ ! -e "$TESTDIR/finished" ]; do
-               _cp_reflink "$TESTDIR/file1" "$TESTDIR/snap_$n" || break
+       while [ ! -e "$testdir/finished" ]; do
+               _cp_reflink "$testdir/file1" "$testdir/snap_$n" || break
                n=$((n + 1))
        done
 }
@@ -77,9 +77,9 @@ snappy() {
 echo "Snapshot a file undergoing buffered rewrite"
 snappy &
 seq $nr_loops -1 0 | while read i; do
-       _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
+       _pwrite_byte 0x63 $((i * blksz)) $blksz "$testdir/file1" >> "$seqres.full"
 done
-touch $TESTDIR/finished
+touch $testdir/finished
 wait
 
 echo "Check for damage"
index 414dcb01ed5fb9e822bad4d03eef8fbdf641989e..ee3848dba41921799cea0e2f31fabbc4c27bd933 100755 (executable)
@@ -51,25 +51,25 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=1024
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
 _scratch_remount
 
 # Direct I/O overwriter...
 overwrite() {
-       while [ ! -e "$TESTDIR/finished" ]; do
+       while [ ! -e "$testdir/finished" ]; do
                seq $nr_loops -1 0 | while read i; do
-                       _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
+                       _pwrite_byte 0x63 $((i * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
                done
        done
 }
@@ -78,12 +78,12 @@ echo "Reflink and write the target"
 overwrite &
 seq 1 10 | while read j; do
        seq 0 $nr_loops | while read i; do
-               _reflink_range  "$TESTDIR/file1" $((i * BLKSZ)) \
-                               "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _reflink_range  "$testdir/file1" $((i * blksz)) \
+                               "$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && exit
        done
 done
-touch "$TESTDIR/finished"
+touch "$testdir/finished"
 wait
 
 echo "Check for damage"
index 704b646a25c48975d2ebd87fd1db7ad43110eb81..6d27810716b2e3170043c6ff314d4d7e8b07f88c 100755 (executable)
@@ -51,25 +51,25 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 loops=1024
 nr_loops=$((loops - 1))
-BLKSZ=65536
+blksz=65536
 
 echo "Initialize files"
 echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
 _scratch_remount
 
 # Direct I/O overwriter...
 overwrite() {
-       while [ ! -e "$TESTDIR/finished" ]; do
+       while [ ! -e "$testdir/finished" ]; do
                seq $nr_loops -1 0 | while read i; do
-                       _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ -d "$TESTDIR/file2" >> "$seqres.full"
+                       _pwrite_byte 0x63 $((i * blksz)) $blksz -d "$testdir/file2" >> "$seqres.full"
                done
        done
 }
@@ -78,12 +78,12 @@ echo "Reflink and dio write the target"
 overwrite &
 seq 1 10 | while read j; do
        seq 0 $nr_loops | while read i; do
-               _reflink_range  "$TESTDIR/file1" $((i * BLKSZ)) \
-                               "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full"
+               _reflink_range  "$testdir/file1" $((i * blksz)) \
+                               "$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
                [ $? -ne 0 ] && exit
        done
 done
-touch "$TESTDIR/finished"
+touch "$testdir/finished"
 wait
 
 echo "Check for damage"
index 99e4d5e75573d973cb4c97741088b2770de7ee42..ec3729d0c2fbfbb23f8fd4cf3690359d1373b237 100755 (executable)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -53,36 +53,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Reformat with appropriate size"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-NR_BLKS=10240
+blksz="$(stat -f "$testdir" -c '%S')"
+nr_blks=10240
 umount "$SCRATCH_MNT"
-SZ_BYTES=$((NR_BLKS * 8 * BLKSZ))
-if [ $SZ_BYTES -lt $((32 * 1048576)) ]; then
-       SZ_BYTES=$((32 * 1048576))
+sz_bytes=$((nr_blks * 8 * blksz))
+if [ $sz_bytes -lt $((32 * 1048576)) ]; then
+       sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $SZ_BYTES >> "$seqres.full" 2>&1
+_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$TESTDIR/bigfile" "$TESTDIR/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
+_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
 sync
 
 echo "Allocate the rest of the space"
-NR_FREE="$(stat -f -c '%f' "$TESTDIR")"
-touch "$TESTDIR/file0" "$TESTDIR/file1"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_FREE)) "$TESTDIR/eat_my_space" >> "$seqres.full" 2>&1
+nr_free="$(stat -f -c '%f' "$testdir")"
+touch "$testdir/file0" "$testdir/file1"
+_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
 sync
 
 echo "CoW the big file"
-out="$(_pwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" 2>&1)"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
 echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
@@ -90,13 +90,13 @@ echo "${out}"
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_pwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" 2>&1)"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
 echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $TESTDIR/bigfile
-#filefrag -v $TESTDIR/clonefile
+#filefrag -v $testdir/bigfile
+#filefrag -v $testdir/clonefile
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
index eb00f0ac8c11588d7a8ebae59aa035c10928e0ad..1988c8d8df80fb81b5fc30fd7aa47f8cadc12b96 100755 (executable)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -53,36 +53,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Reformat with appropriate size"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-NR_BLKS=10240
+blksz="$(stat -f "$testdir" -c '%S')"
+nr_blks=10240
 umount "$SCRATCH_MNT"
-SZ_BYTES=$((NR_BLKS * 3 / 2 * BLKSZ))
-if [ $SZ_BYTES -lt $((32 * 1048576)) ]; then
-       SZ_BYTES=$((32 * 1048576))
+sz_bytes=$((nr_blks * 3 / 2 * blksz))
+if [ $sz_bytes -lt $((32 * 1048576)) ]; then
+       sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $SZ_BYTES >> "$seqres.full" 2>&1
+_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$TESTDIR/bigfile" "$TESTDIR/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
+_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
 sync
 
 echo "Allocate the rest of the space"
-NR_FREE="$(stat -f -c '%f' "$TESTDIR")"
-touch "$TESTDIR/file0" "$TESTDIR/file1"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_FREE)) "$TESTDIR/eat_my_space" >> "$seqres.full" 2>&1
+nr_free="$(stat -f -c '%f' "$testdir")"
+touch "$testdir/file0" "$testdir/file1"
+_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
 sync
 
 echo "CoW the big file"
-out="$(_pwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" 2>&1)"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
 echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
@@ -90,13 +90,13 @@ echo "${out}"
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_pwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" 2>&1)"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
 echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $TESTDIR/bigfile
-#filefrag -v $TESTDIR/clonefile
+#filefrag -v $testdir/bigfile
+#filefrag -v $testdir/clonefile
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
index 76463d2e65ed5459a57dd4840856a69deae58642..5bb9ce6ef84cc49852effacdb3eb32141c1a5079 100755 (executable)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -53,36 +53,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Reformat with appropriate size"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-NR_BLKS=10240
+blksz="$(stat -f "$testdir" -c '%S')"
+nr_blks=10240
 umount "$SCRATCH_MNT"
-SZ_BYTES=$((NR_BLKS * 8 * BLKSZ))
-if [ $SZ_BYTES -lt $((32 * 1048576)) ]; then
-       SZ_BYTES=$((32 * 1048576))
+sz_bytes=$((nr_blks * 8 * blksz))
+if [ $sz_bytes -lt $((32 * 1048576)) ]; then
+       sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $SZ_BYTES >> "$seqres.full" 2>&1
+_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$TESTDIR/bigfile" "$TESTDIR/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
+_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
 sync
 
 echo "Allocate the rest of the space"
-NR_FREE="$(stat -f -c '%f' "$TESTDIR")"
-touch "$TESTDIR/file0" "$TESTDIR/file1"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_FREE)) "$TESTDIR/eat_my_space" >> "$seqres.full" 2>&1
+nr_free="$(stat -f -c '%f' "$testdir")"
+touch "$testdir/file0" "$testdir/file1"
+_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
 sync
 
 echo "mmap CoW the big file"
-out="$(_mwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" 2>&1)"
+out="$(_mwrite_byte 0x62 0 $((blksz * nr_blks)) $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
 err="$?"
 if [ "$err" -lt 128 ]; then
        echo "mmap CoW should have failed with SIGBUS, got SIG$(kill -l $err)"
@@ -91,14 +91,14 @@ fi
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_mwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" 2>&1)"
+out="$(_mwrite_byte 0x62 0 $((blksz * nr_blks)) $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
 err="$?"
 if [ "$err" -lt 128 ]; then
        echo "mmap CoW should have failed with SIGBUS, got SIG$(kill -l $err)"
 fi
 
-#filefrag -v $TESTDIR/bigfile
-#filefrag -v $TESTDIR/clonefile
+#filefrag -v $testdir/bigfile
+#filefrag -v $testdir/clonefile
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
index 8df292ae998b85112341974d171f9545c109e88e..a8e0bb55ebf31a259a0fd7b34ed29975ae50ed65 100755 (executable)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -53,36 +53,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Reformat with appropriate size"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-NR_BLKS=10240
+blksz="$(stat -f "$testdir" -c '%S')"
+nr_blks=10240
 umount "$SCRATCH_MNT"
-SZ_BYTES=$((NR_BLKS * 8 * BLKSZ))
-if [ $SZ_BYTES -lt $((32 * 1048576)) ]; then
-       SZ_BYTES=$((32 * 1048576))
+sz_bytes=$((nr_blks * 8 * blksz))
+if [ $sz_bytes -lt $((32 * 1048576)) ]; then
+       sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $SZ_BYTES >> "$seqres.full" 2>&1
+_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$TESTDIR/bigfile" "$TESTDIR/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
+_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
 sync
 
 echo "Allocate the rest of the space"
-NR_FREE="$(stat -f -c '%f' "$TESTDIR")"
-touch "$TESTDIR/file0" "$TESTDIR/file1"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_FREE)) "$TESTDIR/eat_my_space" >> "$seqres.full" 2>&1
+nr_free="$(stat -f -c '%f' "$testdir")"
+touch "$testdir/file0" "$testdir/file1"
+_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
 sync
 
 echo "CoW the big file"
-out="$(_pwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" -d 2>&1)"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" -d 2>&1)"
 echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
@@ -90,13 +90,13 @@ echo "${out}"
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_pwrite_byte 0x62 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/bigfile" -d 2>&1)"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" -d 2>&1)"
 echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $TESTDIR/bigfile
-#filefrag -v $TESTDIR/clonefile
+#filefrag -v $testdir/bigfile
+#filefrag -v $testdir/clonefile
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
index a7da5334ce8ecd5724793a7b1e6ce0d259d1f12a..b37ff6606cbb31b954b22569203ef5bbc754e92b 100755 (executable)
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -54,30 +54,30 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 # Well let's hope the maximum reflink count is (less than (ha!)) 2^32...
 
 echo "Create a one block file"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $blksz "$testdir/file2" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
 
 nr=32
 fnr=32
 for i in $(seq 0 $fnr); do
-       echo " ++ Reflink size $i, $(( (2 ** i) * BLKSZ)) bytes" | tee -a "$seqres.full"
-       n=$(( (2 ** i) * BLKSZ))
-       _reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file1" $n $n >> "$seqres.full" || break
+       echo " ++ Reflink size $i, $(( (2 ** i) * blksz)) bytes" | tee -a "$seqres.full"
+       n=$(( (2 ** i) * blksz))
+       _reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full" || break
 done
 
 nrf=$((nr - fnr))
 echo "Clone $((2 ** nrf)) files"
 seq 0 $((2 ** nrf)) | while read i; do
-       _cp-reflink "$TESTDIR/file1" "$TESTDIR/file1-$i"
+       _cp-reflink "$testdir/file1" "$testdir/file1-$i"
 done
 
 echo "Check scratch fs"
index bf930b74e075f767964b1fd181cef7200fcfd7bd..0ca0b177daafc11246637141db315d19c773b2a9 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR1"
+    rm -rf "$tmp".* "$testdir1"
 }
 
 # get standard environment, filters and checks
@@ -51,23 +51,23 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-NR_FREE="$(stat -f -c '%f' "$TESTDIR")"
+blksz="$(stat -f "$testdir" -c '%S')"
+nr_free="$(stat -f -c '%f' "$testdir")"
 echo "Create a big file"
-touch "$TESTDIR/file0" "$TESTDIR/file1"
-_pwrite_byte 0x61 0 $((BLKSZ * NR_FREE)) "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
+touch "$testdir/file0" "$testdir/file1"
+_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/bigfile" >> "$seqres.full" 2>&1
 _scratch_remount
-sz="$(stat -c '%s' "$TESTDIR/bigfile")"
+sz="$(stat -c '%s' "$testdir/bigfile")"
 
-blks="$((sz / BLKSZ))"
+blks="$((sz / blksz))"
 echo "Try to reflink"
 seq 0 $blks | while read lblk; do
-       fname="$TESTDIR/file$((lblk % 2))"
-       out="$(_reflink_range "$TESTDIR/bigfile" $((lblk * BLKSZ)) "$fname" $((lblk * BLKSZ)) $BLKSZ 2>&1)"
+       fname="$testdir/file$((lblk % 2))"
+       out="$(_reflink_range "$testdir/bigfile" $((lblk * blksz)) "$fname" $((lblk * blksz)) $blksz 2>&1)"
        echo "$fname: $out" >> "$seqres.full"
        echo "$out" | grep -q "No space left on device" && break
 done
index 9828dac5497ba74c5312388d62656ee202b00205..f1bc9635166f54b19065e82eee1db6926947a2bd 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -48,29 +48,29 @@ _require_xfs_io_command "fpunch"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-NR=512
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+nr=512
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
 
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_cp_reflink "$testdir/file1" "$testdir/file2"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
 echo "Write and punch"
-_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "fpunch $BLKSZ $((BLKSZ * 254))" "$TESTDIR/file2"
+_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "fpunch $blksz $((blksz * 254))" "$testdir/file2"
 _test_remount
 
 echo "Compare results"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
 
 # success, all done
 status=0
index 9312d4d7a544c0b2efd9e2ad54563c33cfc70d02..8e1e0591e8902e9ee117da474d29f02eb99dd1fe 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,45 +51,45 @@ _require_xfs_io_command "fpunch"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file1" >> "$seqres.full"
 
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_cp_reflink "$testdir/file1" "$testdir/file2"
 
-_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ - 17)) $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz - 17)) $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
 
 echo "fpunch files"
-"$XFS_IO_PROG" -f -c "fpunch $((BLKSZ - 17)) $((BLKSZ + 17))" "$TESTDIR/file2"
+"$XFS_IO_PROG" -f -c "fpunch $((blksz - 17)) $((blksz + 17))" "$testdir/file2"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
index af6f2aeed4d7fdca2b8bf44de775082ef5cd95ea..dc6cbbbf8ded8c526eedc42f6b4aa7b7040521e9 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,45 +51,45 @@ _require_xfs_io_command "fzero"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file1" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file1" >> "$seqres.full"
 
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
+_cp_reflink "$testdir/file1" "$testdir/file2"
 
-_pwrite_byte 0x61 0 $((BLKSZ * 3)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ - 17)) $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz - 17)) $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
 
 echo "fzero files"
-"$XFS_IO_PROG" -f -c "fzero $((BLKSZ - 17)) $((BLKSZ + 17))" "$TESTDIR/file2"
+"$XFS_IO_PROG" -f -c "fzero $((blksz - 17)) $((blksz + 17))" "$testdir/file2"
 _test_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
index 03c9ccc5cc1fa3266cb3e041ce2f2d2f5ca98f98..cb6639f82435114175731ba45c06687136cc6f20 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,30 +50,30 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * 2)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 255)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * 2)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 255)) "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
index 885159e591a5f54b85c0a43f825c3f6234bd0bfd..bf5cd389ea17f3cb23f4e8cd2fa83ac670a01818 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,67 +50,67 @@ _require_cp_reflink
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * 257)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * 257)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * 257)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * 257)) "$testdir/file2.chk" >> "$seqres.full"
+_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 echo "Make the original file almost dedup-able"
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file2.chk" >> "$seqres.full"
+_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
+test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 echo "Make the original file dedup-able"
-_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 257)) "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((BLKSZ * 257)) "$TESTDIR/file2.chk" >> "$seqres.full"
-_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) 0 >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 257)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 257)) "$testdir/file2.chk" >> "$seqres.full"
+_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
 _test_remount
 
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-md5sum "$TESTDIR/file2.chk" | _filter_test_dir
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+md5sum "$testdir/file2.chk" | _filter_test_dir
 
-C1="$(_md5_checksum "$TESTDIR/file1")"
-C2="$(_md5_checksum "$TESTDIR/file2")"
+c1="$(_md5_checksum "$testdir/file1")"
+c2="$(_md5_checksum "$testdir/file2")"
 
-test "${C1}" = "${C2}" || echo "file1 and file2 should match"
+test "${c1}" = "${c2}" || echo "file1 and file2 should match"
 
 echo "Compare against check files"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
index 2cf9ce4ef0ecac8a68d08a3f865c54b3099ef0aa..8141f38d909530b6f2a1765ee8c16d21b4fc5225 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,41 +56,41 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
-seq 1 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 55c54ac4c4a714b6361ec63751b08d365630bf48..1d6dff24e58aa4e956fb5ae6a2a522b593608dc6 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,41 +56,41 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
-seq 1 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index f1c0e6b24e7615b5c82e1b6a9bb4c20de31c78cf..9aac966516b4253661c218b8086d043a767436c7 100755 (executable)
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-#    rm -rf "$tmp".* "$TESTDIR"
+#    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -90,8 +90,8 @@ _fragment_freesp()
        $XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
 
        # Punch out whatever we need
-       seq 1 $((NR * 4)) | while read f; do
-               $XFS_IO_PROG -f -c "fpunch $((f * 2 * BLKSZ)) $BLKSZ" "$file"
+       seq 1 $((nr * 4)) | while read f; do
+               $XFS_IO_PROG -f -c "fpunch $((f * 2 * blksz)) $blksz" "$file"
        done
 }
 
@@ -99,43 +99,43 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=1024
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=1024
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
-seq 1 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
-_fragment_freesp "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
+_fragment_freesp "$testdir/bigfile" >> "$seqres.full" 2>&1
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW with multiple extents?"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index ce35ec0faff00af3de8f1e0584352912f4f3a36e..b3f154271afea17a7a7910977f67f99caaea88ba 100755 (executable)
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-#    rm -rf "$tmp".* "$TESTDIR"
+#    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -90,8 +90,8 @@ _fragment_freesp()
        $XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
 
        # Punch out whatever we need
-       seq 1 $((NR * 4)) | while read f; do
-               $XFS_IO_PROG -f -c "fpunch $((f * 2 * BLKSZ)) $BLKSZ" "$file"
+       seq 1 $((nr * 4)) | while read f; do
+               $XFS_IO_PROG -f -c "fpunch $((f * 2 * blksz)) $blksz" "$file"
        done
 }
 
@@ -99,43 +99,43 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=1024
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=1024
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
-seq 1 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
-_fragment_freesp "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
+_fragment_freesp "$testdir/bigfile" >> "$seqres.full" 2>&1
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW with multiple extents?"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 8e715ecf2b686d7ca82b7ba8b7ffe5144c910752..c67b847d340ea535c30b31d38bf2f76b6ec6716c 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,36 +56,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index a4b984fb320ad8864d76a7961ffc4379031b1465..1954235d2dfec25d1a493415ba69d2fd7636be73 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,36 +56,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index ee53bfddbb1193be15d969dcb0420f5b5c5343b4..d3d573b903cdee51b60aef63e858710048d208d4 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,36 +56,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 6174a79a67fdf433ada3311f94498f5036a525c2..8b190845532a79ac4642620c8451e7f3f382be9c 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,36 +56,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index b88297efaca62e00306ab893c1f575f5b0c3be5f..1fc2cd7a1259bccf3a9896119d45fcf6f4a5ae36 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -57,40 +57,40 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-seq 1 2 $((NR-1)) | while read f; do
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 2 $((nr-1)) | while read f; do
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 464a4d433b36838439408c6898b142b7e25c27fb..087275cd6d78c0b751282d5eab6f58f3aed13985 100755 (executable)
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -57,40 +57,40 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-seq 1 2 $((NR-1)) | while read f; do
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 2 $((nr-1)) | while read f; do
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 48be50c38e192e2def87c490de153fddfdfe8d17..d81523298b572fc6db45828b476180a538d00985 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,36 +56,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 9bffffeea1fb189e18ee89cf34b43a437b20a317..54005aeb8ed448a5ce0fb5c2d0e456336cd25a87 100755 (executable)
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -56,36 +56,36 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index a67c04ac8fcc3dc31f4d46e1159bae0c4e2cffc2..eb567e42c1a2afbb538eb6f1e1b4f1ea97f75c74 100755 (executable)
@@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -62,59 +62,59 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
 # 0 blocks are reflinked
-seq 0 5 $NR | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 5 $nr | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 sync
 # 1 blocks are unwritten
-seq 1 5 $NR | while read f; do
-       $XFS_IO_PROG -f -c "falloc $((BLKSZ * f)) $BLKSZ" "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 5 $nr | while read f; do
+       $XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 sync
 # 2 blocks are holes
-seq 2 5 $NR | while read f; do
-       _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 2 5 $nr | while read f; do
+       _pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 # 3 blocks are regular
-seq 3 5 $NR | while read f; do
-       _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 3 5 $nr | while read f; do
+       _pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 sync
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
 # 4 blocks are delalloc (do later)
-seq 4 5 $NR | while read f; do
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 4 5 $nr | while read f; do
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 # now cow
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 9ef533e2c05fe9aeb0a36a0c6d269db46e4a0ff5..991fed024339f020c4fc3f6aece2bfa7c3e9d8b7 100755 (executable)
@@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -62,59 +62,59 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
 # 0 blocks are reflinked
-seq 0 5 $NR | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 0 5 $nr | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 sync
 # 1 blocks are unwritten
-seq 1 5 $NR | while read f; do
-       $XFS_IO_PROG -f -c "falloc $((BLKSZ * f)) $BLKSZ" "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 1 5 $nr | while read f; do
+       $XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 sync
 # 2 blocks are holes
-seq 2 5 $NR | while read f; do
-       _pwrite_byte 0x00 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 2 5 $nr | while read f; do
+       _pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 # 3 blocks are regular
-seq 3 5 $NR | while read f; do
-       _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x71 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 3 5 $nr | while read f; do
+       _pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 sync
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
 # 4 blocks are delalloc (do later)
-seq 4 5 $NR | while read f; do
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
-       _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+seq 4 5 $nr | while read f; do
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
+       _pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 # now cow
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index fa81b5a4203e70df144179cf930dd7aeff2378b9..ffc1ce475017b908dcf749e26c8a721496e5b233 100755 (executable)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,30 +52,30 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-NR=64
-_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
-seq 0 2 $((NR-1)) | while read f; do
-       _reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
+blksz=65536
+nr=64
+_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+seq 0 2 $((nr-1)) | while read f; do
+       _reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file3.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
-rm "$TESTDIR/file3"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
+rm "$testdir/file3"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 2d03b5538212e0a812d821d0a05200a51486e8cc..375b65f089fd6203c1aca032a273e2855e205f09 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,31 +51,31 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) 17" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) 17" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) 17" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) 17" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 8ed765e805e47110952b1d14698f14277b3aefcc..549f2ba649348ed0a283a0ae1aba10182a03e928 100755 (executable)
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,31 +51,31 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
-BLKSZ=65536
-_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_pwrite_byte 0x61 0 $((BLKSZ + 17)) "$TESTDIR/file2.chk" >> "$seqres.full"
+blksz=65536
+_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $BLKSZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $blksz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $blksz" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 525138a39b655543b7fea81b6aabe6364f7c0f0b..8f0ec450e5b2aa2d6eef9945cc4a2e9ec2878878 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,48 +50,48 @@ _require_scratch_reflink
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 0a734a56a901f89c286828e36c31f8558484a8db..f2c4ecc3672c0199f9b9c774b40f310464cbffb4 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -50,48 +50,48 @@ _require_scratch_reflink
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index d4ab7aa77c77e3f3e3ca77b430f7962933786f23..3789cb07b4638d3228d57f02a3c0034ec84b5c5d 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,48 +51,48 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 5e5c831a4bc9d461fb27552b09857240a2cb44e1..4ae603f1464cf25ef55adb0f70c6e1ad7505da6e 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,48 +51,48 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x00 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 7c310921f44375ad43215359c398bf9a9bf15bf0..d63c06f96258d97ed3f6e0150e04c499b0fa840c 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,42 +51,42 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 3ab9881ec48655c4057e12f028c9e0a254e359b3..ccdb32e824270b59e9919b880f54ee3571b67ec8 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,42 +51,42 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 3e344dcecc83b70858dddccf1394bf651c30d0d4..cb5a7881712018518f9503809bb2cfc154aa5703 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,48 +51,48 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index ad529979acf2ecac6a916dea8970b189f167581b..d2004248bc32edc8eb6b8c018835a238fa761389 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,48 +51,48 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $PAGESZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
 
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
 
-_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || _fail "file1 and file2 don't match."
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
+cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 4a65135e35a035bcc84f1f9fe375975217f3c39f..cdaddafcea08cffcec9abe27814d23925b963300 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,19 +51,19 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 runtest() {
        echo "runtest $1 $2"
@@ -73,19 +73,19 @@ runtest() {
 
        echo "Create the original files"
        mkdir -p "$dir"
-       _pwrite_byte 0x61 0 $PAGESZ "$dir/file1" >> "$seqres.full"
+       _pwrite_byte 0x61 0 $pagesz "$dir/file1" >> "$seqres.full"
 
-       "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2" >> "$seqres.full"
-       "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2.chk" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2.chk" >> "$seqres.full"
 
        case "$b2" in
        "regular")
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "unwritten")
-               "$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x00 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               "$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x00 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "hole")
                ;;
@@ -95,19 +95,19 @@ runtest() {
 
        case "$b4" in
        "regular")
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "unwritten")
-               "$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               "$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x00 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "hole")
                ;;
        esac
 
-       _reflink_range "$dir/file1" $BLKSZ "$dir/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+       _reflink_range "$dir/file1" $blksz "$dir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * 2)) $blksz "$dir/file2.chk" >> "$seqres.full"
        _scratch_remount
 
        echo "Compare files"
@@ -116,17 +116,17 @@ runtest() {
 
        echo "CoW and unmount"
        if [ "$b2" = "delalloc" ]; then
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
        fi
 
        if [ "$b4" = "delalloc" ]; then
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
        fi
 
-       "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$dir/file2" >> "$seqres.full"
-       "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((BLKSZ + 17)) $((BLKSZ * 3 - 34))" "$dir/file2.chk" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$dir/file2" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$dir/file2.chk" >> "$seqres.full"
        _scratch_remount
 
        echo "Compare files"
@@ -134,25 +134,25 @@ runtest() {
        cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
 }
 
-runtest regular delalloc "$TESTDIR/r-d"
-runtest regular unwritten "$TESTDIR/r-u"
-runtest regular hole "$TESTDIR/r-h"
-runtest regular regular "$TESTDIR/r-r"
-
-runtest hole delalloc "$TESTDIR/h-d"
-runtest hole unwritten "$TESTDIR/h-u"
-runtest hole hole "$TESTDIR/h-h"
-runtest hole regular "$TESTDIR/h-r"
-
-runtest unwritten delalloc "$TESTDIR/u-d"
-runtest unwritten unwritten "$TESTDIR/u-u"
-runtest unwritten hole "$TESTDIR/u-h"
-runtest unwritten regular "$TESTDIR/u-r"
-
-runtest delalloc delalloc "$TESTDIR/d-d"
-runtest delalloc unwritten "$TESTDIR/d-u"
-runtest delalloc hole "$TESTDIR/d-h"
-runtest delalloc regular "$TESTDIR/d-r"
+runtest regular delalloc "$testdir/r-d"
+runtest regular unwritten "$testdir/r-u"
+runtest regular hole "$testdir/r-h"
+runtest regular regular "$testdir/r-r"
+
+runtest hole delalloc "$testdir/h-d"
+runtest hole unwritten "$testdir/h-u"
+runtest hole hole "$testdir/h-h"
+runtest hole regular "$testdir/h-r"
+
+runtest unwritten delalloc "$testdir/u-d"
+runtest unwritten unwritten "$testdir/u-u"
+runtest unwritten hole "$testdir/u-h"
+runtest unwritten regular "$testdir/u-r"
+
+runtest delalloc delalloc "$testdir/d-d"
+runtest delalloc unwritten "$testdir/d-u"
+runtest delalloc hole "$testdir/d-h"
+runtest delalloc regular "$testdir/d-r"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index e02396b1f8f01c2ab7030eca326b00f33ac6f7fc..98530e080e1d8b98c7d2e10570ee33239bc8709a 100755 (executable)
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -51,19 +51,19 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-PAGESZ=$(getconf PAGE_SIZE)
-BLKSZ=$((PAGESZ / 4))
+pagesz=$(getconf PAGE_SIZE)
+blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $BLKSZ > "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-REAL_BLKSZ=$(stat -f -c '%S' $TESTDIR)
-test "$REAL_BLKSZ" != "$BLKSZ" && _notrun "Failed to format with small blocksize."
+real_blksz=$(stat -f -c '%S' $testdir)
+test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
 
 runtest() {
        echo "runtest $1 $2"
@@ -73,19 +73,19 @@ runtest() {
 
        echo "Create the original files"
        mkdir -p "$dir"
-       _pwrite_byte 0x61 0 $PAGESZ "$dir/file1" >> "$seqres.full"
+       _pwrite_byte 0x61 0 $pagesz "$dir/file1" >> "$seqres.full"
 
-       "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2" >> "$seqres.full"
-       "$XFS_IO_PROG" -f -c "truncate $PAGESZ" "$dir/file2.chk" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2.chk" >> "$seqres.full"
 
        case "$b2" in
        "regular")
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "unwritten")
-               "$XFS_IO_PROG" -f -c "falloc -k $BLKSZ $BLKSZ" "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x00 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               "$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x00 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "hole")
                ;;
@@ -95,19 +95,19 @@ runtest() {
 
        case "$b4" in
        "regular")
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "unwritten")
-               "$XFS_IO_PROG" -f -c "falloc -k $((BLKSZ * 3)) $BLKSZ" "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x00 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               "$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x00 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
                ;;
        "hole")
                ;;
        esac
 
-       _reflink_range "$dir/file1" $BLKSZ "$dir/file2" $((BLKSZ * 2)) $BLKSZ >> "$seqres.full"
-       _pwrite_byte 0x61 $((BLKSZ * 2)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+       _reflink_range "$dir/file1" $blksz "$dir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
+       _pwrite_byte 0x61 $((blksz * 2)) $blksz "$dir/file2.chk" >> "$seqres.full"
        _scratch_remount
 
        echo "Compare files"
@@ -116,17 +116,17 @@ runtest() {
 
        echo "CoW and unmount"
        if [ "$b2" = "delalloc" ]; then
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $BLKSZ $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
        fi
 
        if [ "$b4" = "delalloc" ]; then
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2" >> "$seqres.full"
-               _pwrite_byte 0x61 $((BLKSZ * 3)) $BLKSZ "$dir/file2.chk" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
+               _pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
        fi
 
-       "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$dir/file2" >> "$seqres.full"
-       "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $BLKSZ $((BLKSZ * 3))" "$dir/file2.chk" >> "$seqres.full"
+       "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$dir/file2" >> "$seqres.full"
+       "$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$dir/file2.chk" >> "$seqres.full"
        _scratch_remount
 
        echo "Compare files"
@@ -134,25 +134,25 @@ runtest() {
        cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
 }
 
-runtest regular delalloc "$TESTDIR/r-d"
-runtest regular unwritten "$TESTDIR/r-u"
-runtest regular hole "$TESTDIR/r-h"
-runtest regular regular "$TESTDIR/r-r"
-
-runtest hole delalloc "$TESTDIR/h-d"
-runtest hole unwritten "$TESTDIR/h-u"
-runtest hole hole "$TESTDIR/h-h"
-runtest hole regular "$TESTDIR/h-r"
-
-runtest unwritten delalloc "$TESTDIR/u-d"
-runtest unwritten unwritten "$TESTDIR/u-u"
-runtest unwritten hole "$TESTDIR/u-h"
-runtest unwritten regular "$TESTDIR/u-r"
-
-runtest delalloc delalloc "$TESTDIR/d-d"
-runtest delalloc unwritten "$TESTDIR/d-u"
-runtest delalloc hole "$TESTDIR/d-h"
-runtest delalloc regular "$TESTDIR/d-r"
+runtest regular delalloc "$testdir/r-d"
+runtest regular unwritten "$testdir/r-u"
+runtest regular hole "$testdir/r-h"
+runtest regular regular "$testdir/r-r"
+
+runtest hole delalloc "$testdir/h-d"
+runtest hole unwritten "$testdir/h-u"
+runtest hole hole "$testdir/h-h"
+runtest hole regular "$testdir/h-r"
+
+runtest unwritten delalloc "$testdir/u-d"
+runtest unwritten unwritten "$testdir/u-u"
+runtest unwritten hole "$testdir/u-h"
+runtest unwritten regular "$testdir/u-r"
+
+runtest delalloc delalloc "$testdir/d-d"
+runtest delalloc unwritten "$testdir/d-u"
+runtest delalloc hole "$testdir/d-h"
+runtest delalloc regular "$testdir/d-r"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 5f1f502ece8ddf8fafaccb951c9920711a0cba5e..a5a17c39770ae8e6b93b2769bfab1e47ac8cf426 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -55,40 +55,40 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-BLKSZ=65536
-NR=6400
-BSZ=1280
+blksz=65536
+nr=6400
+bsz=1280
 
-FREE_BLOCKS=$(stat -f -c '%a' "$TESTDIR")
-REAL_BLKSZ=$(stat -f -c '%S' "$TESTDIR")
-SPACE_NEEDED=$(((BLKSZ * NR * 3) * 5 / 4))
-SPACE_AVAIL=$((FREE_BLOCKS * REAL_BLKSZ))
-test $SPACE_NEEDED -gt $SPACE_AVAIL && _notrun "Not enough space. $SPACE_AVAIL < $SPACE_NEEDED"
+free_blocks=$(stat -f -c '%a' "$testdir")
+real_blksz=$(stat -f -c '%S' "$testdir")
+space_needed=$(((blksz * nr * 3) * 5 / 4))
+space_avail=$((free_blocks * real_blksz))
+test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
 
 echo "Create the original files"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 2162eb728e529b2c90af790b2112af66d42f347e..b7ca466e7c9a23693b239982f376660462a35a45 100755 (executable)
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -55,40 +55,40 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf $TESTDIR
-mkdir $TESTDIR
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf $testdir
+mkdir $testdir
 
-BLKSZ=65536
-NR=6400
-BSZ=1280
+blksz=65536
+nr=6400
+bsz=1280
 
-FREE_BLOCKS=$(stat -f -c '%a' "$TESTDIR")
-REAL_BLKSZ=$(stat -f -c '%S' "$TESTDIR")
-SPACE_NEEDED=$(((BLKSZ * NR * 3) * 5 / 4))
-SPACE_AVAIL=$((FREE_BLOCKS * REAL_BLKSZ))
-test $SPACE_NEEDED -gt $SPACE_AVAIL && _notrun "Not enough space. $SPACE_AVAIL < $SPACE_NEEDED"
+free_blocks=$(stat -f -c '%a' "$testdir")
+real_blksz=$(stat -f -c '%S' "$testdir")
+space_needed=$(((blksz * nr * 3) * 5 / 4))
+space_avail=$((free_blocks * real_blksz))
+test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
 
 echo "Create the original files"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * BSZ)) 0 $((BLKSZ * NR))" "$TESTDIR/file2.chk" >> "$seqres.full"
+"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2" >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file2.chk" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
index 61301de08209a599db58a462ac3a4155dd54e578..c31cd174725556ee0fe78f6b4da84b4c7584ecba 100755 (executable)
@@ -51,22 +51,22 @@ echo "Format and mount"
 _scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file and reflink to copy1, copy2"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-_pwrite_byte 0x61 0 $((BLKSZ * 14 + 71)) "$TESTDIR/original" >> "$seqres.full"
-_cp_reflink "$TESTDIR/original" "$TESTDIR/copy1"
-_cp_reflink "$TESTDIR/copy1" "$TESTDIR/copy2"
+blksz="$(stat -f "$testdir" -c '%S')"
+_pwrite_byte 0x61 0 $((blksz * 14 + 71)) "$testdir/original" >> "$seqres.full"
+_cp_reflink "$testdir/original" "$testdir/copy1"
+_cp_reflink "$testdir/copy1" "$testdir/copy2"
 
 echo "Grow fs"
 "$XFS_GROWFS_PROG" "$SCRATCH_MNT" 2>&1 |  _filter_growfs >> "$seqres.full"
 _scratch_remount
 
 echo "Create more reflink copies"
-_cp_reflink "$TESTDIR/original" "$TESTDIR/copy3"
+_cp_reflink "$testdir/original" "$testdir/copy3"
 
 xfs_info "$SCRATCH_MNT" >> "$seqres.full"
 
index f461c1a1a8196b0be6cead41180f4d33acfc16d0..a96291ac318b3ecf4beefdbd0aa0a2f02456c3c4 100755 (executable)
@@ -52,93 +52,93 @@ echo "Format and mount"
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
+free_blocks0=$(stat -f "$testdir" -c '%f')
 
 echo "Create the original file and reflink to file2, file3"
-BLKS=2000
-MARGIN=160
-BLKSZ=65536
-REAL_BLKSZ="$(stat -f $TESTDIR -c '%S')"
-BLKSZ_FACTOR=$((BLKSZ / REAL_BLKSZ))
-_pwrite_byte 0x61 0 $((BLKS * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
-_cp_reflink "$TESTDIR/file2" "$TESTDIR/file3"
-_cp_reflink "$TESTDIR/file3" "$TESTDIR/file4"
+blks=2000
+margin=160
+blksz=65536
+real_blksz="$(stat -f $testdir -c '%S')"
+blksz_factor=$((blksz / real_blksz))
+_pwrite_byte 0x61 0 $((blks * blksz)) "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink "$testdir/file2" "$testdir/file3"
+_cp_reflink "$testdir/file3" "$testdir/file4"
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
+free_blocks1=$(stat -f "$testdir" -c '%f')
 
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file4" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file4" | _filter_scratch
 
-C01=$(_md5_checksum "$TESTDIR/file1")
-C02=$(_md5_checksum "$TESTDIR/file2")
-C03=$(_md5_checksum "$TESTDIR/file3")
-C04=$(_md5_checksum "$TESTDIR/file4")
+c01=$(_md5_checksum "$testdir/file1")
+c02=$(_md5_checksum "$testdir/file2")
+c03=$(_md5_checksum "$testdir/file3")
+c04=$(_md5_checksum "$testdir/file4")
 
 echo "CoW the reflink copies"
-_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x63 $(( BLKSZ * (BLKS - 1) )) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz "$testdir/file3" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
+free_blocks2=$(stat -f "$testdir" -c '%f')
 
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file4" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file4" | _filter_scratch
 
-C11=$(_md5_checksum "$TESTDIR/file1")
-C12=$(_md5_checksum "$TESTDIR/file2")
-C13=$(_md5_checksum "$TESTDIR/file3")
-C14=$(_md5_checksum "$TESTDIR/file4")
+c11=$(_md5_checksum "$testdir/file1")
+c12=$(_md5_checksum "$testdir/file2")
+c13=$(_md5_checksum "$testdir/file3")
+c14=$(_md5_checksum "$testdir/file4")
 
 echo "Defragment"
-lsattr -l "$TESTDIR/" | _filter_scratch
-xfs_fsr -v -d "$TESTDIR/file1" >> "$seqres.full"
-xfs_fsr -v -d "$TESTDIR/file2" >> "$seqres.full" # fsr probably breaks the link
-xfs_fsr -v -d "$TESTDIR/file3" >> "$seqres.full" # fsr probably breaks the link
-xfs_fsr -v -d "$TESTDIR/file4" >> "$seqres.full" # fsr probably ignores this file
+lsattr -l "$testdir/" | _filter_scratch
+xfs_fsr -v -d "$testdir/file1" >> "$seqres.full"
+xfs_fsr -v -d "$testdir/file2" >> "$seqres.full" # fsr probably breaks the link
+xfs_fsr -v -d "$testdir/file3" >> "$seqres.full" # fsr probably breaks the link
+xfs_fsr -v -d "$testdir/file4" >> "$seqres.full" # fsr probably ignores this file
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
+free_blocks3=$(stat -f "$testdir" -c '%f')
 
-md5sum "$TESTDIR/file1" | _filter_scratch
-md5sum "$TESTDIR/file2" | _filter_scratch
-md5sum "$TESTDIR/file3" | _filter_scratch
-md5sum "$TESTDIR/file4" | _filter_scratch
+md5sum "$testdir/file1" | _filter_scratch
+md5sum "$testdir/file2" | _filter_scratch
+md5sum "$testdir/file3" | _filter_scratch
+md5sum "$testdir/file4" | _filter_scratch
 
-C21=$(_md5_checksum "$TESTDIR/file1")
-C22=$(_md5_checksum "$TESTDIR/file2")
-C23=$(_md5_checksum "$TESTDIR/file3")
-C24=$(_md5_checksum "$TESTDIR/file4")
+c21=$(_md5_checksum "$testdir/file1")
+c22=$(_md5_checksum "$testdir/file2")
+c23=$(_md5_checksum "$testdir/file3")
+c24=$(_md5_checksum "$testdir/file4")
 
 echo "Check files"
-test $C01 = $C02 || echo "Files 1-2 do not match"
-test $C01 = $C03 || echo "Files 1-3 do not match"
-test $C01 = $C04 || echo "Files 1-4 do not match"
-test $C02 = $C03 || echo "Files 2-3 do not match"
-test $C02 = $C04 || echo "Files 2-4 do not match"
-test $C03 = $C04 || echo "Files 3-4 do not match"
-
-test $C01 = $C11 || echo "File1 should not be different after CoW"
-test $C02 != $C12 || echo "File2 should be different after CoW"
-test $C03 != $C13 || echo "File3 should be different after CoW"
-test $C04 = $C14 || echo "File4 should not be different after CoW"
-
-test $C11 = $C21 || echo "File1 changed by defrag"
-test $C12 = $C22 || echo "File2 changed by defrag"
-test $C13 = $C23 || echo "File3 changed by defrag"
-test $C14 = $C24 || echo "File4 changed by defrag"
-
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
-
-_within_tolerance "free blocks after creating some reflink copies" $FREE_BLOCKS1 $((FREE_BLOCKS0 - (BLKS * BLKSZ_FACTOR) )) $MARGIN -v
-_within_tolerance "free blocks after CoW some reflink copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - 2)) $MARGIN -v
-_within_tolerance "free blocks after defragging all reflink copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - (BLKS * 2 * BLKSZ_FACTOR))) $MARGIN -v
-_within_tolerance "free blocks after all tests" $FREE_BLOCKS3 $((FREE_BLOCKS0 - (BLKS * 3 * BLKSZ_FACTOR))) $MARGIN -v
+test $c01 = $c02 || echo "Files 1-2 do not match"
+test $c01 = $c03 || echo "Files 1-3 do not match"
+test $c01 = $c04 || echo "Files 1-4 do not match"
+test $c02 = $c03 || echo "Files 2-3 do not match"
+test $c02 = $c04 || echo "Files 2-4 do not match"
+test $c03 = $c04 || echo "Files 3-4 do not match"
+
+test $c01 = $c11 || echo "File1 should not be different after CoW"
+test $c02 != $c12 || echo "File2 should be different after CoW"
+test $c03 != $c13 || echo "File3 should be different after CoW"
+test $c04 = $c14 || echo "File4 should not be different after CoW"
+
+test $c11 = $c21 || echo "File1 changed by defrag"
+test $c12 = $c22 || echo "File2 changed by defrag"
+test $c13 = $c23 || echo "File3 changed by defrag"
+test $c14 = $c24 || echo "File4 changed by defrag"
+
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
+
+_within_tolerance "free blocks after creating some reflink copies" $free_blocks1 $((free_blocks0 - (blks * blksz_factor) )) $margin -v
+_within_tolerance "free blocks after CoW some reflink copies" $free_blocks2 $((free_blocks1 - 2)) $margin -v
+_within_tolerance "free blocks after defragging all reflink copies" $free_blocks3 $((free_blocks2 - (blks * 2 * blksz_factor))) $margin -v
+_within_tolerance "free blocks after all tests" $free_blocks3 $((free_blocks0 - (blks * 3 * blksz_factor))) $margin -v
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
index 3b7c59ca07bba736e88363306d4083b6c3808e41..8d608f2b75e4af681092488e99c651fe45af5fa4 100755 (executable)
@@ -35,7 +35,7 @@ _cleanup()
 {
     cd /
     umount "$SCRATCH_MNT" > /dev/null 2>&1
-    rm -rf "$tmp".* "$TESTDIR" "$METADUMP_FILE" "$TEST_DIR/image"
+    rm -rf "$tmp".* "$testdir" "$metadump_file" "$TEST_DIR/image"
 }
 
 # get standard environment, filters and checks
@@ -54,34 +54,34 @@ rm -f "$seqres.full"
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
-METADUMP_FILE="$TEST_DIR/${seq}_metadump"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
+metadump_file="$TEST_DIR/${seq}_metadump"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-NR_BLKS=$((4 * BLKSZ / 12))
-_pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+nr_blks=$((4 * blksz / 12))
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/file1" >> "$seqres.full"
 
 echo "Reflink every other block"
-seq 1 2 $((NR_BLKS - 1)) | while read nr; do
-       _reflink_range  "$TESTDIR/file1" $((nr * BLKSZ)) \
-                       "$TESTDIR/file2" $((nr * BLKSZ)) $BLKSZ >> "$seqres.full"
+seq 1 2 $((nr_blks - 1)) | while read nr; do
+       _reflink_range  "$testdir/file1" $((nr * blksz)) \
+                       "$testdir/file2" $((nr * blksz)) $blksz >> "$seqres.full"
 done
 
 echo "Create metadump file"
 _scratch_unmount
-_scratch_metadump "$METADUMP_FILE"
+_scratch_metadump "$metadump_file"
 
 # Now restore the obfuscated one back and take a look around
 echo "Restore metadump"
-xfs_mdrestore "$METADUMP_FILE" "$TEST_DIR/image"
+xfs_mdrestore "$metadump_file" "$TEST_DIR/image"
 _mount -t $FSTYP "$TEST_DIR/image" "$SCRATCH_MNT"
 umount "$SCRATCH_MNT"
 
 echo "Check restored fs"
-_check_generic_filesystem "$METADUMP_FILE"
+_check_generic_filesystem "$metadump_file"
 
 # success, all done
 status=0
index 5d092f1dfe18b8d7a317ee4dfc0b3f9f424aee23..8442821200f8e8791b9d4aabfe5e41b8f7300447 100755 (executable)
@@ -33,7 +33,7 @@ _cleanup()
 {
     cd /
     umount "$SCRATCH_MNT" > /dev/null 2>&1
-    rm -rf "$tmp".* "$TESTDIR" "$METADUMP_FILE"
+    rm -rf "$tmp".* "$testdir" "$metadump_file"
 }
 
 # get standard environment, filters and checks
@@ -54,18 +54,18 @@ echo "Format and mount scratch device"
 _scratch_mkfs >> "$seqres.full"
 _scratch_mount
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ=65536
-$XFS_IO_PROG -R -f -c "truncate $BLKSZ" "$TESTDIR/file1"
+blksz=65536
+$XFS_IO_PROG -R -f -c "truncate $blksz" "$testdir/file1"
 
 echo "Reflink every block"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" 2>&1 | _filter_scratch
+_cp_reflink "$testdir/file1" "$testdir/file2" 2>&1 | _filter_scratch
 
-test -s "$TESTDIR/file2" && _fail "Should not be able to reflink a realtime file."
+test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file."
 
 echo "Check restored fs"
 umount "$SCRATCH_MNT"
index ec7b1788f445c82fdf83c603afd8337e077837dd..79a6d5733799462da58eec527d655dedbc89596f 100755 (executable)
@@ -49,7 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -67,63 +67,63 @@ _require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
-TESTDIR="$TEST_DIR/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
+testdir="$TEST_DIR/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
 
 echo "Create the original file blocks"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
-BLKS=2000
-MARGIN=100
-SZ=$((BLKSZ * BLKS))
-FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
-NR=4
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+blksz="$(stat -f "$testdir" -c '%S')"
+blks=2000
+margin=100
+sz=$((blksz * blks))
+free_blocks0=$(stat -f "$testdir" -c '%f')
+nr=4
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 
 echo "Create the reflink copies"
-for i in `seq 2 $NR`; do
-       _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
+for i in `seq 2 $nr`; do
+       _cp_reflink "$testdir/file1" "$testdir/file$i"
 done
 _test_remount
-FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
-lsattr -l $TESTDIR/ | _filter_test_dir
+free_blocks1=$(stat -f "$testdir" -c '%f')
+lsattr -l $testdir/ | _filter_test_dir
 
 echo "funshare part of a file"
-"$XFS_IO_PROG" -f -c "falloc 0 $((SZ / 2))" "$TESTDIR/file2"
+"$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
 _test_remount
-lsattr -l $TESTDIR/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir
 
 echo "funshare some of the copies"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file2"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file3"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
 _test_remount
-FREE_BLOCKS2=$(stat -f "$TESTDIR" -c '%f')
-lsattr -l $TESTDIR/ | _filter_test_dir
+free_blocks2=$(stat -f "$testdir" -c '%f')
+lsattr -l $testdir/ | _filter_test_dir
 
 echo "funshare the rest of the files"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file4"
-"$XFS_IO_PROG" -f -c "falloc 0 $SZ" "$TESTDIR/file1"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
+"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
 _test_remount
-FREE_BLOCKS3=$(stat -f "$TESTDIR" -c '%f')
-lsattr -l $TESTDIR/ | _filter_test_dir
+free_blocks3=$(stat -f "$testdir" -c '%f')
+lsattr -l $testdir/ | _filter_test_dir
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
-FREE_BLOCKS4=$(stat -f "$TESTDIR" -c '%f')
-lsattr -l $TESTDIR/ | _filter_test_dir
-#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
+free_blocks4=$(stat -f "$testdir" -c '%f')
+lsattr -l $testdir/ | _filter_test_dir
+#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
-_within_tolerance "free blocks after reflinking" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
 
-_within_tolerance "free blocks after nocow'ing some copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - (2 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after nocow'ing some copies" $free_blocks2 $((free_blocks1 - (2 * blks))) $margin -v
 
-_within_tolerance "free blocks after nocow'ing all copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - BLKS)) $MARGIN -v
+_within_tolerance "free blocks after nocow'ing all copies" $free_blocks3 $((free_blocks2 - blks)) $margin -v
 
-_within_tolerance "free blocks after overwriting original" $FREE_BLOCKS4 $FREE_BLOCKS3 $MARGIN -v
+_within_tolerance "free blocks after overwriting original" $free_blocks4 $free_blocks3 $margin -v
 
-_within_tolerance "free blocks after all tests" $FREE_BLOCKS4 $((FREE_BLOCKS0 - (4 * BLKS))) $MARGIN -v
+_within_tolerance "free blocks after all tests" $free_blocks4 $((free_blocks0 - (4 * blks))) $margin -v
 
 # success, all done
 status=0
index 152c6bdadc8f7ea8d41dfc78588fc18658f4b0bd..7400cf88fa7b697e0eacc1729c79bc3f9d7c64d7 100644 (file)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,26 +52,26 @@ echo "Format and mount"
 _scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
-BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
+blksz="$(stat -f "$testdir" -c '%S')"
 
 echo "Create the original files"
-SZ=$((48 * 1048576))
-NR=$((SZ / BLKSZ))
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
+sz=$((48 * 1048576))
+nr=$((sz / blksz))
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
 _scratch_remount
 
 echo "CoW every other block"
-_pwrite_byte 0x62 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz "$testdir/file1" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-md5sum "$TESTDIR/file1" | _filter_test_dir
-md5sum "$TESTDIR/file2" | _filter_test_dir
-#filefrag -v "$TESTDIR/file1" "$TESTDIR/file2"
+md5sum "$testdir/file1" | _filter_test_dir
+md5sum "$testdir/file2" | _filter_test_dir
+#filefrag -v "$testdir/file1" "$testdir/file2"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
index 45be9f499eefc33ff82168e11af38c1226c6ab73..133bb72d6cee73c01bf0ad3608dec048b97c2e2f 100644 (file)
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$TESTDIR"
+    rm -rf "$tmp".* "$testdir"
 }
 
 # get standard environment, filters and checks
@@ -52,33 +52,33 @@ echo "Format and mount"
 _scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
-TESTDIR="$SCRATCH_MNT/test-$seq"
-rm -rf "$TESTDIR"
-mkdir "$TESTDIR"
-BLKSZ="$(stat -f -c '%S' "$TESTDIR")"
+testdir="$SCRATCH_MNT/test-$seq"
+rm -rf "$testdir"
+mkdir "$testdir"
+blksz="$(stat -f -c '%S' "$testdir")"
 
 echo "Create the original files"
-SZ=$((48 * 1048576))
-NR=$((SZ / BLKSZ))
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
-_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $SZ "$TESTDIR/file2.chk" >> "$seqres.full"
+sz=$((48 * 1048576))
+nr=$((sz / blksz))
+_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz "$testdir/file2.chk" >> "$seqres.full"
 _scratch_remount
 
 echo "Compare files"
-cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 do not match"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 do not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 echo "CoW every other block"
-seq 1 2 $((NR - 1)) | while read f; do
-       _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full"
-       _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
+seq 1 2 $((nr - 1)) | while read f; do
+       _pwrite_byte 0x62 $((f * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
+       _pwrite_byte 0x62 $((f * blksz)) $blksz "$testdir/file2.chk" >> "$seqres.full"
 done
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 must not match"
-cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
+! cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 must not match"
+cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"