generic/520: Remove sync in clean_dir
[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 _supported_os Linux
31
32 _require_test
33 _require_xfs_io_command "-T"
34 _require_xfs_io_command "flink"
35
36 rm -f $seqres.full
37
38 testfile="${TEST_DIR}/tst-tmpfile-flink"
39
40 # test creating a r/w tmpfile, do I/O and link it into the namespace
41 $XFS_IO_PROG -T \
42         -c "pwrite 0 4096" \
43         -c "pread 0 4096" \
44         -c "flink ${testfile}" \
45         ${TEST_DIR} | _filter_xfs_io
46
47 rm ${testfile}
48
49 # test creating a r/o tmpfile.  Should fail
50 $XFS_IO_PROG -Tr ${TEST_DIR} -c "close" 2>&1 | _filter_test_dir
51
52 # success, all done
53 status=0
54 exit