4 # Check for DMAPI destroy events when removing files without attributes
5 # See PV960928 for details
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
29 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
42 _filter_dmapi_print_event() {
44 # replace session/file specific output with generic placeholders
45 s/token\s+\d+/token TOKEN/g ;
46 s/sequence\s+\d+/sequence SEQ/g ;
47 s/^\s+parent\s+dir\s+\w+/parent dir PARENT_DIR/g ;
48 s/^\s+name\s+.*/name FILE_NAME/g ;
49 s/^\s+mode\s+bits\s+mode\s+\d+:\s+/mode bits mode MODE: /g ;
50 s/perm\s+[\w|-]+\s[\w|-]+\s[\w|-]+/perm PERMISSIONS/g ;
51 s/,\s+type\s+.*/, type FILE_TYPE/g ;
52 s/^\s+object\s+\w+/object OBJECT/g ;
53 s/^\s+new\s+object\s+\w+/new object OBJECT/g ;
54 s/^\s+handle\s+\w+/handle HANDLE/g ;
56 # when print_event is killed, the following is output. trim it
57 s/^\s*print_event: Processing any undelivered event messages.*\n//g ;
58 s/^\s*print_event: Shutting down the session.*\n//g ;
65 # get standard environment, filters and checks
70 # real QA test starts here
75 _scratch_mkfs_xfs >/dev/null 2>&1
78 qa_file_noattr=$SCRATCH_MNT/dmapi_file_noattr
79 qa_file_withattr=$SCRATCH_MNT/dmapi_file_withattr
81 # run dmapi print_event in background to capture events triggered during test
82 ${DMAPI_QASUITE1_DIR}cmd/print_event $SCRATCH_MNT > $tmp.print_event_out 2>&1 &
83 dmapi_print_event_pid=$!
85 # give time for print_event to start capturing events
88 # enable DMAPI set_return_on_destroy for $SCRATCH_MNT
89 ${DMAPI_COMMON_DIR}cmd/set_return_on_destroy -F $SCRATCH_MNT ATTR_NAME_1
97 touch $qa_file_withattr
98 echo "# set dmapi attributes on file"
99 ${DMAPI_QASUITE1_DIR}cmd/set_dmattr $qa_file_withattr ATTR_NAME_1 ATTR_VALUE_1
101 rm -f $qa_file_withattr
103 # kill off background dmapi print_event process
104 kill $dmapi_print_event_pid
105 # give dmapi print_event time to finish writing out any events not yet output
108 # dmapi destroy events are asyncronous, don't rely on fixed ordering of events
109 # in print_event output, use sort.
110 echo "# here comes the dmapi print_event filtered and sorted output"
111 cat $tmp.print_event_out | tee -a $here/$seq.full | _filter_dmapi_print_event | LC_COLLATE=POSIX sort
112 rm $tmp.print_event_out