add null files tests to auto group
[xfstests-dev.git] / 168
1 #! /bin/sh
2 # FSQA Test No. 168
3 #
4 # Check for DMAPI destroy events when removing files without attributes
5 # See PV960928 for details
6 #
7 #-----------------------------------------------------------------------
8 #  Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
9 #-----------------------------------------------------------------------
10 #
11 # creator
12 owner=ddiss@sgi.com
13
14 seq=`basename $0`
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1    # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24     _cleanup_testdir
25 }
26
27 # get standard environment, filters and checks
28 . ./common.rc
29 . ./common.filter
30 . ./common.dmapi
31
32 # real QA test starts here
33 _supported_fs xfs
34 _supported_os Linux
35
36 _require_scratch
37 _scratch_mkfs_xfs >/dev/null 2>&1
38 _dmapi_scratch_mount
39
40 qa_file_noattr=$SCRATCH_MNT/dmapi_file_noattr
41 qa_file_withattr=$SCRATCH_MNT/dmapi_file_withattr
42
43 # run dmapi print_event in background to capture events triggered during test
44 ${DMAPI_QASUITE1_DIR}cmd/print_event $SCRATCH_MNT > $tmp.print_event_out 2>&1 &
45 dmapi_print_event_pid=$!
46
47 # enable DMAPI set_return_on_destroy for $SCRATCH_MNT
48 ${DMAPI_COMMON_DIR}cmd/set_return_on_destroy -F $SCRATCH_MNT ATTR_NAME_1
49
50 echo "# create file"
51 touch $qa_file_noattr
52 echo "# remove file"
53 rm -f $qa_file_noattr
54
55 echo "# create file"
56 touch $qa_file_withattr
57 echo "# set dmapi attributes on file"
58 ${DMAPI_QASUITE1_DIR}cmd/set_dmattr $qa_file_withattr ATTR_NAME_1 ATTR_VALUE_1
59 echo "# remove file"
60 rm -f $qa_file_withattr
61
62 # kill off background dmapi print_event process
63 kill $dmapi_print_event_pid
64 # give dmapi print_event time to finish writing out any events not yet output
65 wait
66
67 # dmapi destroy events are asyncronous,  don't rely on fixed ordering of events
68 # in print_event output, use sort.
69 echo "# here comes the dmapi print_event filtered and sorted output"
70 cat $tmp.print_event_out | tee -a $here/$seq.full | _filter_dmapi_print_event | LC_COLLATE=POSIX sort
71 rm $tmp.print_event_out
72
73 status=0
74 exit