Files
apfstests/doc/requirement-checking.txt
T
Amir Goldstein 5210726732 src/open_by_handle: flexible usage options
More usage options for testing open_by_handle, which are needed
for testing stable handles across copy up in overlayfs.

usage: open_by_handle [-c|-l|-u|-d] <test_dir> [num_files]

Examples:

1. Create test set of N files and try to get their NFS handles:

   open_by_handle -c <test_dir> [N]

   This is used by new helper _require_exportfs() to check
   if filesystem supports exportfs

2. Get file handles for existing test set, drop caches and try to
   open all files by handle:

   open_by_handle <test_dir> [N]

3. Get file handles for existing test set, unlink all test files,
   drop caches, try to open all files by handle and expect ESTALE:

   open_by_handle -d <test_dir> [N]

4. Get file handles for existing test set, hardlink all test files,
   then unlink the original files, drop caches and try to open all
   files by handle (should work):

   open_by_handle -l <test_dir> [N]
   open_by_handle -u <test_dir> [N]

   This test is done with 2 invocations of the program, first to
   hardlink (-l) and then to unlink the originals (-u), because
   we would like to be able to perform the hardlinks on overlay
   lower layer and unlink on upper layer.

   NOTE that open_by_handle -u doesn't check if the files are
   hardlinked, it just assumes that they are.  If they are not
   then the test will fail, because file handles would be stale.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-04-21 11:14:34 +08:00

105 lines
2.8 KiB
Plaintext

========================================
TESTING FOR REQUIREMENTS IN TEST SCRIPTS
========================================
Test scripts need to indicate to the infrastructure what sorts of requirements
they have. This is done with _require_<xxx> macros, which may take parameters.
(1) General requirements.
_require_command "$<NAME_PROG>" <name>
_require_test
_require_test_program <name>
_require_xfs_io_command <name> [<switch>]
(2) Filesystem capability requirements.
_require_chattr <letters>
_require_exportfs
(3) System call requirements.
_require_statx
====================
GENERAL REQUIREMENTS
====================
_require_command "$NAME_PROG" name
The test requires an external command, called 'name' be present on the
system and that '$VAR' should be set with the path to that command. $VAR
should then be used to refer to the command when executing it. For
example:
_require_command "KILLALL_PROG" killall
to locate the killall command and then:
$KILLALL_PROG -q $FSSTRESS_PROG
to make use of it.
_require_test
The test requires that the block device specified by $TEST_DEV be mounted
on $TEST_DIR.
_require_test_program <name>
The test requires a program by the name of 'name' be present and built in
the src/ directory. For example:
_require_test_program "stat_test"
requires that src/stat_test be built.
_require_xfs_io_command <name> [<switch>]
The test requires that the xfs_io command be available, that it supports
command <name> and, optionally, that that command supports the specified
switch. For example:
_require_xfs_io_command "falloc"
_require_xfs_io_command "chattr" "+/-x"
The first requires that xfs_io support the falloc command and the second
that it supports the chattr command and that the chattr command supports
the +x and -x arguments (DAX attribute).
==================================
FILESYSTEM CAPABILITY REQUIREMENTS
==================================
_require_chattr <letters>
The test requires that the filesystem attribute set by the chattr command
with +<letters> as an argument be available and supported by the $TEST_DEV
filesystem. No check is made of the scratch filesystem. For example:
_require_chattr ai
tests to see if setting the append-only and immutable attributes on a file
(chattr +a +i) is supported.
_require_exportfs
The test requires that the $TEST_DEV filesystem supports NFS export.
The test also requires the use of the open_by_handle_at() system call and
will be skipped if it isn't available in the kernel.
========================
SYSTEM CALL REQUIREMENTS
========================
_require_statx
The test requires the use of the statx() system call and will be skipped
if it isn't available in the kernel.