diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-08-30 14:13:12 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-08-30 18:55:59 +0200 |
commit | 9eb4c31eb78c28dd9f72d1cbb940270311be343c (patch) | |
tree | ea3078bc1b002a9f948ed41445ca32318002a1d3 /tests/cp/sparse-fiemap | |
parent | 00f5ba15dd91a3d9780fe1fbd06a4df436ae6714 (diff) | |
download | coreutils-9eb4c31eb78c28dd9f72d1cbb940270311be343c.tar.xz |
tests: add .sh and .pl suffixes to shell and perl tests, respectively
Not only this shrinks the size of the generated Makefile (from > 6300
lines to ~3000), but will allow further simplifications in future
changes.
* tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'.
(PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to
$(LOG_COMPILER) for the time being.
(TESTS, root_tests): Adjust as described.
* All tests: Rename as described.
Diffstat (limited to 'tests/cp/sparse-fiemap')
-rwxr-xr-x | tests/cp/sparse-fiemap | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap deleted file mode 100755 index f2e5f330d..000000000 --- a/tests/cp/sparse-fiemap +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -# Test cp --sparse=always through fiemap copy - -# Copyright (C) 2010-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ cp -require_perl_ - -# The test was seen to fail on ext3 so exclude that type -# (or any file system where the type can't be determined) -touch fiemap_chk -if fiemap_capable_ fiemap_chk && ! df -t ext3 . >/dev/null; then - : # Current partition has working extents. Good! -else - # FIXME: temporarily(?) skip this variant, at least until after this bug - # is fixed: http://thread.gmane.org/gmane.comp.file-systems.ext4/24495 - skip_ "current file system has insufficient FIEMAP support" - - # It's not; we need to create one, hence we need root access. - require_root_ - - cwd=$PWD - cleanup_() { cd /; umount "$cwd/mnt"; } - - skip=0 - # Create an ext4 loopback file system - dd if=/dev/zero of=blob bs=32k count=1000 || skip=1 - mkdir mnt - mkfs -t ext4 -F blob || - skip_ "failed to create ext4 file system" - mount -oloop blob mnt || skip=1 - cd mnt || skip=1 - echo test > f || skip=1 - test -s f || skip=1 - - test $skip = 1 && - skip_ "insufficient mount/ext4 support" -fi - -# ================================================= -# Ensure that we exercise the FIEMAP-copying code enough -# to provoke at least two iterations of the do...while loop -# in which it calls ioctl (fd, FS_IOC_FIEMAP,... -# This also verifies that non-trivial extents are preserved. - -# Extract logical block number and length pairs from filefrag -v output. -# The initial sed is to remove the "eof" from the normally-empty "flags" field. -# Similarly, remove flags values like "unknown,delalloc,eof". -# That is required when that final extent has no number in the "expected" field. -f() -{ - sed 's/ [a-z,][a-z,]*$//' $@ \ - | $AWK '/^ *[0-9]/ {printf "%d %d ", $2, (NF<5 ? $NF : $5) } END {print ""}' -} - -for i in $(seq 1 2 21); do - for j in 1 2 31 100; do - $PERL -e '$n = '$i' * 1024; *F = *STDOUT;' \ - -e 'for (1..'$j') { sysseek (*F, $n, 1)' \ - -e '&& syswrite (*F, chr($_)x$n) or die "$!"}' > j1 || fail=1 - - # Note there is an implicit sync performed by cp on Linux kernels - # before 2.6.39 to work around bugs in EXT4 and BTRFS. - # Note also the -s parameter to the filefrag commands below - # for the same reasons. - cp --sparse=always j1 j2 || fail=1 - - cmp j1 j2 || fail_ "data loss i=$i j=$j" - if ! filefrag -vs j1 | grep -F extent >/dev/null; then - test $skip != 1 && warn_ 'skipping part; you lack filefrag' - skip=1 - else - # Here is sample filefrag output: - # $ perl -e 'BEGIN{$n=16*1024; *F=*STDOUT}' \ - # -e 'for (1..5) { sysseek(*F,$n,1)' \ - # -e '&& syswrite *F,"."x$n or die "$!"}' > j - # $ filefrag -v j - # File system type is: ef53 - # File size of j is 163840 (40 blocks, blocksize 4096) - # ext logical physical expected length flags - # 0 4 6258884 4 - # 1 12 6258892 6258887 4 - # 2 20 6258900 6258895 4 - # 3 28 6258908 6258903 4 - # 4 36 6258916 6258911 4 eof - # j: 6 extents found - - # exclude the physical block numbers; they always differ - filefrag -v j1 > ff1 || framework_failure_ - filefrag -vs j2 > ff2 || framework_failure_ - { f ff1; f ff2; } | $PERL $abs_top_srcdir/tests/filefrag-extent-compare \ - || { - warn_ ignoring filefrag-reported extent map differences - # Show the differing extent maps. - head -n99 ff1 ff2 - } - fi - test $fail = 1 && break 2 - done -done - -Exit $fail |