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