diff options
author | Anand Avati <avati@redhat.com> | 2013-02-21 16:42:17 -0800 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-21 23:26:57 -0800 |
commit | 91052d8b5677920f2e5aea56fc082e243c76ca43 (patch) | |
tree | 3cd68c12b9bf0e159e967ee5e69728a67d484f3b /tests/bugs/bug-846240.t | |
parent | 72ad9a3a8b684595dc394252c88c76c859919a45 (diff) |
tests/fileio.rc: library for file descriptor based IO in tests
There are situations in test scripts where we want to keep open file
descriptors while performing other commands. Bash has abilities
to manage file descriptors by numbers, but the syntax is a little
brain damaging.
This library provides wrappers around it to abstract away bash's
syntax and also provides a helper function to pick a free file
descriptor on the fly.
The APIs are pretty self explanatory.
Change-Id: I82f1d1957646dd6c468d9e85c90ec30c978c7ad6
BUG: 764966
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4565
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'tests/bugs/bug-846240.t')
-rw-r--r-- | tests/bugs/bug-846240.t | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/bugs/bug-846240.t b/tests/bugs/bug-846240.t index 5c5fbf0147a..12e4949ef36 100644 --- a/tests/bugs/bug-846240.t +++ b/tests/bugs/bug-846240.t @@ -2,6 +2,7 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc +. $(dirname $0)/../fileio.rc cleanup; @@ -30,7 +31,8 @@ TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M1; TEST touch $M0/testfile; # open the file with the fd as 4 -exec 4>"$M0/testfile"; +TEST fd=`fd_available`; +TEST fd_open $fd 'w' "$M0/testfile"; # remove the file from the other mount point. If unlink is sent from # $M0 itself, then the file will be actually opened by open-behind which @@ -47,7 +49,7 @@ TEST rm -f $M1/testfile; echo "data" >> $M0/testfile 2>/dev/null 1>/dev/null; TEST [ $? -ne 0 ] -exec 4>&- +TEST fd_close $fd; TEST rm -rf $MOUNTDIR/* |