Print a warning if the underlying filesystem doesnn't support xattrs
[ciopfs.git] / testsuite.sh
blob201fd43b0e25c097ba5385f8e80a1b9c6b8dce3d
1 #!/bin/sh
3 [ -z "$CIOPFS" ] && CIOPFS="ciopfs"
5 FSTEST=http://tuxera.com/sw/qa/pjd-fstest-20090130-RC.tgz
6 CIOPFS_ARGS="-f -o direct_io,allow_other,use_ino,noauto_cache,ac_attr_timeout=0,attr_timeout=0,entry_timeout=0"
7 CIOPFS_XATTR_NAME="user.filename"
9 die() {
10 [ $# -ne 0 ] && echo "$0: $*"
11 exit 1
14 # $1 => fs type, $2 => image size, $3 => mkfs options
15 mkfs_image() {
16 local loopdev size
17 dd if=/dev/zero of="$1.img" bs=1M count=$2
18 loopdev=`losetup -f`
19 losetup "$loopdev" "$1.img"
20 mkfs.$1 $3 "$loopdev"
21 losetup -d "$loopdev"
24 # $1 => dir in which to perform the tests, $2 => fs type, $3 => log file
25 run_fstest() {
26 tar -C "$1" -xzf fstest.tgz
27 cd "$1"/pjd-fstest*
28 echo fs="$2" >> tests/conf
29 [[ $2 == ntfs ]] && echo fs="ntfs-3g" >> tests/conf
30 make
31 prove -r tests 2>&1 | tee "$3"
32 cd -
35 # $1 => fs type, $2 => mount options
36 test_image() {
37 echo mount -t $1 -o "loop,$2" "$1.img" mnt
38 mount -t $1 -o "loop,$2" "$1.img" mnt || die "could not mount $1 image"
39 mkdir -p "mnt/$1" "mnt/ciopfs-$1"
40 run_fstest "mnt/$1" $1 "../../../$1.result"
41 "$CIOPFS" $CIOPFS_ARGS "mnt/ciopfs-$1" ciopfs-mnt &> "ciopfs-$1.log" &
42 ps -p $! &> /dev/null || die "ciopfs not running, aborting..."
43 touch ciopfs-mnt/CiOpFs &&
44 getfattr -n $CIOPFS_XATTR_NAME mnt/ciopfs-$1/ciopfs | grep CiOpFs &> /dev/null ||
45 die "ciopfs not working correctly"
46 run_fstest "ciopfs-mnt" $1 "../../ciopfs-$1.result"
47 umount -f ciopfs-mnt || kill -9 $!
48 umount -f mnt || die "couldn't umount $1 image"
51 [ $# -eq 0 ] && die "specify a directory in which to run the testsuite in"
53 [ ! -d "$1" ] && mkdir "$1"
55 cd "$1" && rm -rf mnt ciopfs-mnt *.img *.result *.log && mkdir -p mnt ciopfs-mnt || die
57 [ ! -f fstest.tgz ] && wget "$FSTEST" -O fstest.tgz
59 mkfs_image ext3 20 -F
60 test_image ext3 user_xattr
62 mkfs_image ntfs 20
63 test_image ntfs
65 mkfs_image xfs 20
66 test_image xfs
68 # btrfs needs at least 256M
69 mkfs_image btrfs 256
70 test_image btrfs