Whamcloud - gitweb
LU-9511 utils: fix parallel_grouplock test timeout
[fs/lustre-release.git] / lustre / tests / mpi / parallel_grouplock.c
index e572e4e..dfe3cfa 100644 (file)
@@ -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.
  *
  * 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  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -38,6 +32,7 @@
  * Author: You Feng <youfeng@clusterfs.com>
  */
 
+#include <limits.h>
 #include <mpi.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -50,7 +45,6 @@
 #include <unistd.h>
 #include <time.h>
 #include <errno.h>
-#include <libcfs/libcfs.h>
 #include <lustre/lustre_user.h>
 #include "lp_utils.h"
 
@@ -595,12 +589,10 @@ void grouplock_test4(char *filename, int fd)
                  * task0's write to start. */
                 MPI_Recv(&temp1, 1, MPI_INT, 0, 1, MPI_COMM_WORLD,
                          MPI_STATUS_IGNORE);
-                usleep(10000);
-                usleep(10000);
 
                 /* tell task2 to go. */
                 MPI_Send(&gid, 1, MPI_INT, 2, 1, MPI_COMM_WORLD);
-
+               sleep(WAIT_TIME);
 
                 read_buf(fd);
                 MPI_Send(&gid, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
@@ -609,8 +601,7 @@ void grouplock_test4(char *filename, int fd)
                 /* Give task0 & 1 a chance to start. */
                 MPI_Recv(&temp1, 1, MPI_INT, 1, 1, MPI_COMM_WORLD,
                          MPI_STATUS_IGNORE);
-                usleep(25000);
-                usleep(25000);
+               sleep(2 * WAIT_TIME);
 
                 if ((rc = ioctl(fd, LL_IOC_GROUP_LOCK, gid)) == -1) {
                         sprintf(errmsg,
@@ -1013,7 +1004,8 @@ int main(int argc, char *argv[])
 
         if (size < MIN_GLHOST) {
                 fprintf(stderr, "Error: "
-                        "should be at least four tasks to run the test!\n");
+                        "%d tasks run, but should be at least %d tasks to run "
+                        "the test!\n", size, MIN_GLHOST);
                 MPI_Abort(MPI_COMM_WORLD, 2);
         }