exercises O_APPEND write functionality using a test case which was once
authorfsgqa <fsgqa>
Wed, 4 Sep 2002 07:44:40 +0000 (07:44 +0000)
committerfsgqa <fsgqa>
Wed, 4 Sep 2002 07:44:40 +0000 (07:44 +0000)
known to be broken.

069 [new file with mode: 0755]
group
src/append_writer.c

diff --git a/069 b/069
new file mode 100755 (executable)
index 0000000..a40d69d
--- /dev/null
+++ b/069
@@ -0,0 +1,93 @@
+#! /bin/sh
+# XFS QA Test No. 069
+# $Id: 069,v 1.1 2002/09/04 07:44:40 fsgqa Exp $
+#
+# Test out writes with O_APPEND flag sets.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.
+# 
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+# 
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# 
+# Further, this software is distributed without any warranty that it is
+# free of the rightful claim of any third person regarding infringement
+# or the like.  Any license provided herein, whether implied or
+# otherwise, applies only to this software file.  Patent licenses, if
+# any, provided herein do not apply to combinations of this program with
+# other software, or any other product whatsoever.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston MA 02111-1307, USA.
+# 
+# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+# Mountain View, CA  94043, or:
+# 
+# http://www.sgi.com 
+# 
+# For further information regarding this notice, see: 
+# 
+# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#-----------------------------------------------------------------------
+#
+# creator
+owner=nathans@sgi.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=0       # success is the default!
+trap "rm -rf $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# real QA test starts here
+
+_require_scratch
+rm -f $seq.full
+
+umount $SCRATCH_DEV >/dev/null 2>&1
+
+echo "*** mkfs"
+mkfs_xfs $SCRATCH_DEV >/dev/null \
+       || _fail "mkfs failed"
+  
+echo "*** mount FS"
+mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >/dev/null \
+       || _fail "mount failed"
+
+cd $SCRATCH_MNT
+
+sizes="1 20 300 40000 3000000 200000000 12345"
+for size in $sizes ; do
+       $here/src/append_writer $size &
+       echo $! $size >> pids
+done
+
+wait
+ls -lh >> $seq.full
+echo "*** PIDs file"
+cat pids >> $seq.full
+
+cat pids | while read pid size
+do
+       echo "*** checking file with $size integers $pid"
+       echo checking pid=$pid size=$size >> $seq.full
+       $here/src/append_reader testfile.$pid
+       status=$?
+       [ $status -ne 0 ] && echo "corrupt O_APPEND to testfile.$pid!"
+       echo status: $status >> $seq.full
+done
+
+# success, all done
+exit
diff --git a/group b/group
index 1ec56d063e6c0b96dbf75339b19f9f3c9a4011e0..496dde1c135903b67335fb72635b6d272dffcf49 100644 (file)
--- a/group
+++ b/group
@@ -123,3 +123,4 @@ ioctl               nathans@sgi.com
 066 xfsdump ioctl auto
 067 acl attr auto
 068 other auto
+069 rw auto
index acf093cbf75f72ed1d3b4e1d9fe824bdc8063594..a8e4525d7e4ea8e2308c80ef0f22e8d99a69e681 100644 (file)
 int main(int argc, char **argv)
 {
        char file[MAXPATHLEN];
-       int fd, i;
+       int fd, i, iterations;
+
+       if (argc < 2)
+               exit(1);
+
+       iterations = atoi(argv[1]);
 
        sprintf(file, "testfile.%d", getpid());
 
@@ -22,7 +27,7 @@ int main(int argc, char **argv)
                exit(1);
        }
 
-       for (i = 0; ;i ++) {
+       for (i = 0; i < iterations;i++) {
                if (write(fd, &i, sizeof(i)) != sizeof(i)) {
                        perror("couldn't write");
                        exit(1);