Whamcloud - gitweb
LU-14543 target: prevent overflowing of tgd->tgd_tot_granted
[fs/lustre-release.git] / lustre / tests / mpi / lp_utils.h
index e30b60f..2963898 100644 (file)
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/tests/lp_utils.h
  *
 
 #include <linux/lustre/lustre_user.h>
 
-#define FAIL(msg) \
- \
+#define FAILF(fmt, ...) \
 do { \
-        printf("%s: Process %d (%s)\n", timestamp(), rank, hostname); \
-        if (debug) \
-                printf("\tFAILED in %s:%d:%s()\n", __FILE__, __LINE__, __func__); \
-        else \
-                printf("\tFAILED in %s()\n", __func__); \
-        printf("%s", msg); \
-        fflush(stdout); \
-        MPI_Abort(MPI_COMM_WORLD, 1); \
-} while(0)
+       printf("%s: Process %d (%s)\n", timestamp(), rank, hostname); \
+       if (debug) \
+               printf("\tFAILED in %s:%d:%s()\n", \
+                      __FILE__, __LINE__, __func__); \
+       else \
+               printf("\tFAILED in %s()\n", __func__); \
+       printf(fmt, ##__VA_ARGS__); \
+       fflush(stdout); \
+       MPI_Abort(MPI_COMM_WORLD, 1); \
+} while (0)
+
+#define FAIL(msg)      FAILF("%s", (msg))
+
+#ifndef MAX
+#define MAX(a, b)      ((a) > (b) ? (b) : (a))
+#endif
 
 #define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH
 #define MAX_FILENAME_LEN 512