Files
apfstests/tests/xfs/054
T
Darrick J. Wong a860a167d8 common: kill _supported_os
fstests only supports Linux, so get rid of this unnecessary predicate.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2020-09-21 01:16:50 +08:00

89 lines
2.8 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
#
# FS QA Test 054
#
# Exercise the xfs_io inode command
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# remove previous $seqres.full before test
rm -f $seqres.full
# real QA test starts here
# Modify as appropriate.
_supported_fs xfs
_require_test
_require_xfs_io_command "inode"
# We know the root inode is there
ROOT_INO=`ls -id $TEST_DIR | awk '{print $1}'`
touch $TEST_DIR/file
$XFS_IO_PROG -c "inode" $TEST_DIR/file
$XFS_IO_PROG -c "inode -v" $TEST_DIR/file | \
grep -vw "^$ROOT_INO" | sed -e s/.*:/LAST:/
# These should fail, -n requires an inode
$XFS_IO_PROG -c "inode -n" $TEST_DIR/file 2>&1 | grep -q Query \
|| echo "bare -n succeeded"
$XFS_IO_PROG -c "inode -nv" $TEST_DIR/file 2>&1 | grep -q Query \
|| echo "bare -nv succeeded"
$XFS_IO_PROG -c "inode -n -v" $TEST_DIR/file 2>&1 | grep -q Query \
|| echo "bare -n -v succeeded"
# These fail too, requires a valid inode number
$XFS_IO_PROG -c "inode badnumber" $TEST_DIR/file | grep -q numeric \
|| echo "Bad inode number succeeded"
$XFS_IO_PROG -c "inode -v badnumber" $TEST_DIR/file | grep -q numeric \
|| echo "Bad inode number succeeded"
$XFS_IO_PROG -c "inode -n badnumber" $TEST_DIR/file | grep -q numeric \
|| echo "Bad inode number succeeded"
$XFS_IO_PROG -c "inode -nv badnumber" $TEST_DIR/file | grep -q numeric \
|| echo "Bad inode number succeeded"
$XFS_IO_PROG -c "inode -n -v badnumber" $TEST_DIR/file | grep -q numeric \
|| echo "Bad inode number succeeded"
# These should all work, and return $ROOT_INO or the next inode...
# grep out ROOT_INO (which is incorrect) when we should be getting next inode
$XFS_IO_PROG -c "inode $ROOT_INO" $TEST_DIR/file | \
sed -e s/$ROOT_INO/ROOT_INO/
$XFS_IO_PROG -c "inode -v $ROOT_INO" $TEST_DIR/file | \
sed -e s/$ROOT_INO/ROOT_INO/
$XFS_IO_PROG -c "inode -n $ROOT_INO" $TEST_DIR/file | \
grep -vw "^$ROOT_INO" | sed -e s/.*/NEXT/
$XFS_IO_PROG -c "inode -nv $ROOT_INO" $TEST_DIR/file | \
grep -vw "^$ROOT_INO" | sed -e s/.*:/NEXT:/
$XFS_IO_PROG -c "inode -n -v $ROOT_INO" $TEST_DIR/file | \
grep -vw "^$ROOT_INO" | sed -e s/.*:/NEXT:/
# Try one that doesn't exist, 2^64-2? Should get 0
$XFS_IO_PROG -c "inode 18446744073709551614" $TEST_DIR/file
$XFS_IO_PROG -c "inode -v 18446744073709551614" $TEST_DIR/file
$XFS_IO_PROG -c "inode -n 18446744073709551614" $TEST_DIR/file
$XFS_IO_PROG -c "inode -nv 18446744073709551614" $TEST_DIR/file
$XFS_IO_PROG -c "inode -n -v 18446744073709551614" $TEST_DIR/file
status=0
exit