X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fmpi%2Fwrite_append_truncate.c;h=f2c6cb95344ccc8c16b57b65bc2d74c6c5afc24b;hb=f44fe5abbc74ca79790c100a30193ded1ef1e6c9;hp=5df12023b9c5ff1cb97c1e2424eeabe07fc724d3;hpb=7418dd0d056ef994d4f84037e98da1f9e86de1d5;p=fs%2Flustre-release.git diff --git a/lustre/tests/mpi/write_append_truncate.c b/lustre/tests/mpi/write_append_truncate.c index 5df1202..f2c6cb9 100644 --- a/lustre/tests/mpi/write_append_truncate.c +++ b/lustre/tests/mpi/write_append_truncate.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -17,17 +15,15 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -161,7 +157,7 @@ int main(int argc, char *argv[]) switch(c) { case 'a': append_max = strtoul(optarg, &end, 0); - if (append_max == 0 || *end) { + if (append_max < 2 || *end) { fprintf(stderr, "%s: bad append option '%s'\n", prog, optarg); usage(prog); @@ -202,7 +198,7 @@ int main(int argc, char *argv[]) break; case 'w': write_max = strtoul(optarg, &end, 0); - if (write_max == 0 || *end) { + if (write_max < 2 || *end) { fprintf(stderr, "%s: bad write option '%s'\n", prog, optarg); usage(prog); @@ -303,7 +299,8 @@ int main(int argc, char *argv[]) if (rank == 0) { write_size = (rand() % (write_max - 1)) + 1; append_size = (rand() % (append_max - 1)) + 1; - trunc_size = (rand() % ((trunc_max?: append_size)-1))+1; + trunc_size = (append_size == 1) ? 1 : + (rand() % ((trunc_max?: append_size)-1))+1; trunc_offset = write_size + trunc_size; if (verbose || n % 1000 == 0) @@ -527,7 +524,6 @@ int main(int argc, char *argv[]) if (error == 1) { char command[4096]; - int rc; rprintf(rank, n, 0, STATUS_FMT"\n", write_char, write_size, write_size, @@ -535,7 +531,7 @@ int main(int argc, char *argv[]) trunc_offset, trunc_offset); sprintf(command, "od -Ax -a %s", fnames[0]); - rc = system(command); + ret = system(command); MPI_Abort(MPI_COMM_WORLD, 1); } }