From: fsgqa Date: Wed, 4 Sep 2002 07:44:40 +0000 (+0000) Subject: exercises O_APPEND write functionality using a test case which was once X-Git-Tag: v1.1.0~1051 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=57460d542ec442b228bafe14292196eab16e1e0e;ds=sidebyside exercises O_APPEND write functionality using a test case which was once known to be broken. --- diff --git a/069 b/069 new file mode 100755 index 00000000..a40d69d3 --- /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 1ec56d06..496dde1c 100644 --- 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 diff --git a/src/append_writer.c b/src/append_writer.c index acf093cb..a8e4525d 100644 --- a/src/append_writer.c +++ b/src/append_writer.c @@ -13,7 +13,12 @@ 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);