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.
9 #-----------------------------------------------------------------------
15 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
28 _filter_dmapi_print_event() {
30 # replace session/file specific output with generic placeholders
31 s/token\s+\d+/token TOKEN/g ;
32 s/sequence\s+\d+/sequence SEQ/g ;
33 s/^\s+parent\s+dir\s+\w+/parent dir PARENT_DIR/g ;
34 s/^\s+name\s+.*/name FILE_NAME/g ;
35 s/^\s+mode\s+bits\s+mode\s+\d+:\s+/mode bits mode MODE: /g ;
36 s/perm\s+[\w|-]+\s[\w|-]+\s[\w|-]+/perm PERMISSIONS/g ;
37 s/,\s+type\s+.*/, type FILE_TYPE/g ;
38 s/^\s+object\s+\w+/object OBJECT/g ;
39 s/^\s+new\s+object\s+\w+/new object OBJECT/g ;
40 s/^\s+handle\s+\w+/handle HANDLE/g ;
42 # when print_event is killed, the following is output. trim it
43 s/^\s*print_event: Processing any undelivered event messages.*\n//g ;
44 s/^\s*print_event: Shutting down the session.*\n//g ;
51 # get standard environment, filters and checks
56 # real QA test starts here
61 _scratch_mkfs_xfs >/dev/null 2>&1
64 qa_file_noattr=$SCRATCH_MNT/dmapi_file_noattr
65 qa_file_withattr=$SCRATCH_MNT/dmapi_file_withattr
67 # run dmapi print_event in background to capture events triggered during test
68 ${DMAPI_QASUITE1_DIR}cmd/print_event $SCRATCH_MNT > $tmp.print_event_out 2>&1 &
69 dmapi_print_event_pid=$!
71 # give time for print_event to start capturing events
74 # enable DMAPI set_return_on_destroy for $SCRATCH_MNT
75 ${DMAPI_COMMON_DIR}cmd/set_return_on_destroy -F $SCRATCH_MNT ATTR_NAME_1
83 touch $qa_file_withattr
84 echo "# set dmapi attributes on file"
85 ${DMAPI_QASUITE1_DIR}cmd/set_dmattr $qa_file_withattr ATTR_NAME_1 ATTR_VALUE_1
87 rm -f $qa_file_withattr
89 # kill off background dmapi print_event process
90 kill $dmapi_print_event_pid
91 # give dmapi print_event time to finish writing out any events not yet output
94 # dmapi destroy events are asyncronous, don't rely on fixed ordering of events
95 # in print_event output, use sort.
96 echo "# here comes the dmapi print_event filtered and sorted output"
97 cat $tmp.print_event_out | tee -a $here/$seq.full | _filter_dmapi_print_event | LC_COLLATE=POSIX sort
98 rm $tmp.print_event_out