//
// Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
//
// This test will use the following files:
//
ctf stf ls_to_copy ctest.c
fcntl open_test truncate rd wf 
read_invis write_invis
set_region set_return_on_destroy 
--------------------------------------------
// These setup commands are run before the daemon starts.
// They reset the file structure of the test directory
// to a known state.
//
rm $real_dir/???
rm $real_dir/ctest.c
$1/ctf $1 $real_dir
$1/stf $1 $real_dir/l??
cp $1/ctest.c $real_dir
chown $lname $real_dir/l??
chown $lname $real_dir/ctest.c
$1/set_return_on_destroy $real_dir test
--------------------------------------------
@@ Aborted events testing (1 of 7):
@@     Read ls0 successfully.
@@
$1/open_test $2/ls0 o_rdwr
event_count 1
event[0] read
--------------------------------------------
@@ Aborted events testing (2 of 7):
@@    Set the daemon to halt events with DM_RESP_ABORT
@@    and errno EEXIST. 
@@
run_as_root
$1/send_msg unfriendly_17
event_count 1
event[0] user
msg_str[0] unfriendly_17
--------------------------------------------
@@ Aborted events testing (3 of 7):
@@    Try to read ls0.  this should fail with EEXIST.
@@
$1/open_test $2/ls0 o_rdwr
event_count 1
event[0] read
failure
--------------------------------------------
@@ Aborted events testing (4 of 7):
@@    Try to read ls1.  This should fail with EEXIST.
@@
$1/open_test $2/ls1 o_rdwr o_trunc
event_count 1
event[0] truncate
failure
--------------------------------------------
@@ Aborted events testing (5 of 7):
@@    Reset the daemon to respond with DM_RESP_CONTINUE.
@@
run_as_root
$1/send_msg friendly
event_count 1
event[0] user
msg_str[0] friendly
--------------------------------------------
@@ Aborted events testing (6 of 7):
@@    Again, try to read ls0.  This should succeed.
@@
$1/open_test $2/ls0 o_rdwr
event_count 1
event[0] read
--------------------------------------------
@@ Aborted events testing (7 of 7):
@@    Again, try to read ls1.  This time, 
@@    it should succeed.
@@
$1/open_test $2/ls1 o_rdwr o_trunc
event_count 2
event[0] truncate
event[1] attribute
--------------------------------------------
@@ dm_send_msg test
@@
run_as_root
$1/send_msg dmapi-test-foo-abc123
event_count 1
event[0] user
msg_str[0] dmapi-test-foo-abc123
--------------------------------------------
@@ Test of invisible i/o (1 of 2):  write
@@
run_as_root
$1/write_invis -o 64 -l 16 $2/ls0
event_count 0
--------------------------------------------
@@ Test of invisible i/o (2 of 2):  read
@@
run_as_root
$1/read_invis -o 64 -l 16 $2/ls0
event_count 0
--------------------------------------------
@@ Test of direct i/o (1 of 2):  write
@@
$1/wf  -l 327680 -b 32768 -d $2/ls9
event_count 10
event[0] write
event[1] write
event[2] write
event[3] write
event[4] write
event[5] write
event[6] write
event[7] write
event[8] write
event[9] write
--------------------------------------------
@@ Test of direct i/o (2 of 2):  read
@@
$1/rd -b 32768 -d $2/ls9
event_count 11
event[0] read
event[1] read
event[2] read
event[3] read
event[4] read
event[5] read
event[6] read
event[7] read
event[8] read
event[9] read
event[10] read
