φ(.. )メモシテオコウ xfstestsめも

xfstestsの使い方めも

物理ディスクではなくてイメージファイルで実行する場合は以下を実行してイメージファイルとファイルシステムの作成をする。

[root@saga xfstests]# dd if=/dev/zero of=test.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 0.508285 s, 2.1 GB/s
[root@saga xfstests]# mkfs.ext4 ./test.img
mke2fs 1.42.8 (20-Jun-2013)
./test.img is not a block special device.
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

xfstestsはTEST_DIRとTEST_DEVの2個の環境変数が必須なのでセットする。
TEST_DIRはテスト対象のデバイスをマウントするディレクトリ。TEST_DEVはテスト対象のデバイス(/dev/XXX)。

[root@saga xfstests]# TEST_DIR=/mnt ; export TEST_DIR

ループバックを使う場合は下記のように。

[root@saga xfstests]# losetup -f
/dev/loop0
[root@saga xfstests]# losetup /dev/loop0 ./test.img

TEST_DEVの設定

[root@saga xfstests]# TEST_DEV=/dev/loop0 ; export TEST_DEV

xfstestsはgitから落としてきてmakeしただけの状態でもmake installしても以下の用にcheckコマンドがあるディレクトリにtestsのディレクトリがある。

/path/to/somewhere/check
                          |-- tests
                          |-- common

特定のテストを実行する場合はtestsの下からのPATHで指定。

[root@saga xfstests]# ./check generic/001
FSTYP         -- ext4
PLATFORM      -- Linux/x86_64 saga 3.11.6-1-ARCH

generic/001 1s ... 2s
Ran: generic/001
Passed all 1 tests