fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 004
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Christoph Hellwig.  All Rights Reserved.
4 #
5 # FS QA Test No. 004
6 #
7 # Test O_TMPFILE opens, and linking them back into the namespace.
8 #
9 . ./common/preamble
10 _begin_fstest auto quick
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15     cd /
16     rm -f ${testfile}
17 }
18
19 # Import common functions.
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs generic
24
25 _require_test
26 _require_xfs_io_command "-T"
27 _require_xfs_io_command "flink"
28
29 testfile="${TEST_DIR}/tst-tmpfile-flink"
30
31 # test creating a r/w tmpfile, do I/O and link it into the namespace
32 $XFS_IO_PROG -T \
33         -c "pwrite 0 4096" \
34         -c "pread 0 4096" \
35         -c "flink ${testfile}" \
36         ${TEST_DIR} | _filter_xfs_io
37
38 rm ${testfile}
39
40 # test creating a r/o tmpfile.  Should fail
41 $XFS_IO_PROG -Tr ${TEST_DIR} -c "close" 2>&1 | _filter_test_dir
42
43 # success, all done
44 status=0
45 exit