common: kill _supported_os
[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 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -f ${testfile}
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs generic
30
31 _require_test
32 _require_xfs_io_command "-T"
33 _require_xfs_io_command "flink"
34
35 rm -f $seqres.full
36
37 testfile="${TEST_DIR}/tst-tmpfile-flink"
38
39 # test creating a r/w tmpfile, do I/O and link it into the namespace
40 $XFS_IO_PROG -T \
41         -c "pwrite 0 4096" \
42         -c "pread 0 4096" \
43         -c "flink ${testfile}" \
44         ${TEST_DIR} | _filter_xfs_io
45
46 rm ${testfile}
47
48 # test creating a r/o tmpfile.  Should fail
49 $XFS_IO_PROG -Tr ${TEST_DIR} -c "close" 2>&1 | _filter_test_dir
50
51 # success, all done
52 status=0
53 exit