From 7320256db3e08bfa5e728b110a0635fc33c320d6 Mon Sep 17 00:00:00 2001
From: grev <grev>
Date: Thu, 31 Jul 2008 18:56:35 +0000
Subject: [PATCH] b=15266 i=Adilger integrate mdsrate to acc-sm; cofigure and
 make mpi tests

---
 lustre/autoconf/lustre-core.m4     | 36 ++++++++++++++++++++++++++----
 lustre/liblustre/tests/Makefile.am |  3 ++-
 lustre/tests/Makefile.am           |  9 +++++---
 lustre/tests/lp_utils.c            |  2 +-
 lustre/tests/parallel_grouplock.c  |  2 +-
 5 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 4af293404f..5cff79ffeb 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -1408,11 +1408,39 @@ if test x$enable_liblustre_acl = xyes ; then
   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
 fi
 
+#
+# check --with-mpi option
+#
+AC_ARG_WITH([mpi],
+            AC_HELP_STRING([--with-mpi=path],
+                           [set path to mpi install (default=/opt/mpich)]),
+            [
+             case $with_mpi in
+             [[\\/$]]* | ?:[[\\/]]* )
+                 ;;
+             *)
+                 AC_MSG_ERROR([expected absolute directory name for --with-mpi])
+                 ;;
+             esac
+
+             MPI_ROOT=$with_mpi
+             LDFLAGS="$LDFLAGS -L$with_mpi/lib"
+             CFLAGS="$CFLAGS -I$with_mpi/include"
+            ],
+            [
+             MPI_ROOT=/opt/mpich
+             LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
+             CFLAGS="$CFLAGS -I$MPI_ROOT/include"
+            ])
+AC_SUBST(MPI_ROOT)
+
+#
+# check mpi's includes and library
+#
 AC_MSG_CHECKING([whether to build mpitests])
-AC_ARG_ENABLE([mpitests],
-	AC_HELP_STRING([--enable-mpitests],
-			[build liblustre mpi tests]),
-	[],[enable_mpitests=no])
+AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
+              [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
+              [enable_mpitests=no])
 AC_MSG_RESULT([$enable_mpitests])
 
 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
diff --git a/lustre/liblustre/tests/Makefile.am b/lustre/liblustre/tests/Makefile.am
index 08bd86b1ac..bbc30e8d87 100644
--- a/lustre/liblustre/tests/Makefile.am
+++ b/lustre/liblustre/tests/Makefile.am
@@ -52,7 +52,8 @@ replay_ost_single_DEPENDENCIES = $(top_builddir)/lustre/liblustre/liblustre.a li
 if MPITESTS
 test_lock_cancel_SOURCES = test_lock_cancel.c
 test_lock_cancel_CFLAGS = $(LL_CFLAGS) -I/opt/lam/include
-test_lock_cancel_LDADD :=  $(LLIB_EXEC)  -L/opt/lam/lib -lmpi -llam
+#test_lock_cancel_LDADD :=  $(LLIB_EXEC)  -L/opt/lam/lib -lmpi -llam
+test_lock_cancel_LDADD :=  $(LLIB_EXEC)  -lmpich
 endif
 
 
diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am
index f82d16eeeb..8e9605047c 100644
--- a/lustre/tests/Makefile.am
+++ b/lustre/tests/Makefile.am
@@ -32,7 +32,7 @@ noinst_PROGRAMS += openfilleddirunlink rename_many memhog iopentest1 iopentest2
 noinst_PROGRAMS += mmap_sanity flock_test writemany reads flocks_test
 noinst_PROGRAMS += ll_getstripe_info
 if MPITESTS
-noinst_PROGRAMS += parallel_grouplock write_append_truncate createmany_mpi
+noinst_PROGRAMS += parallel_grouplock write_append_truncate createmany_mpi mdsrate
 endif
 # noinst_PROGRAMS += ldaptest copy_attr mkdirdeep 
 bin_PROGRAMS = mcreate munlink
@@ -54,13 +54,16 @@ ll_dirstripe_verify_SOURCES= ll_dirstripe_verify.c
 ll_dirstripe_verify_LDADD= -L$(top_builddir)/lustre/utils -llustreapi
 
 if MPITESTS
-LAM_LD_FLAGS=-L/opt/lam/lib -lmpi -llam -lpthread
+#LAM_LD_FLAGS=-L/opt/lam/lib -lmpi -llam -lpthread
+LAM_LD_FLAGS=-lmpich -lpthread
 write_append_truncate_SOURCES=write_append_truncate.c
 write_append_truncate_LDADD=$(LAM_LD_FLAGS)
 createmany_mpi_SOURCES=createmany-mpi.c
 createmany_mpi_LDADD=$(LAM_LD_FLAGS)
-parallel_grouplock_SOURCES=parallel_grouplock.c lp_utils.c
+parallel_grouplock_SOURCES=parallel_grouplock.c lp_utils.c lp_utils.h
 parallel_grouplock_LDADD=$(LAM_LD_FLAGS)
+mdsrate_SOURCES=mdsrate.c
+mdsrate_LDADD=$(LAM_LD_FLAGS) -L$(top_builddir)/lustre/utils -llustreapi
 endif
 
 #copy_attr_LDADD= -lattr
diff --git a/lustre/tests/lp_utils.c b/lustre/tests/lp_utils.c
index 4944d5883b..facf66f48e 100644
--- a/lustre/tests/lp_utils.c
+++ b/lustre/tests/lp_utils.c
@@ -50,7 +50,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include "lustre/lustre_user.h"
-#include "lp_utils.h"
+#include "lustre/tests/lp_utils.h"
 
 #define MAX_PROCESSES 8
 
diff --git a/lustre/tests/parallel_grouplock.c b/lustre/tests/parallel_grouplock.c
index 7a047e0e83..acc3de0f4b 100644
--- a/lustre/tests/parallel_grouplock.c
+++ b/lustre/tests/parallel_grouplock.c
@@ -50,7 +50,7 @@
 #include <time.h>
 #include <errno.h>
 #include <lustre/lustre_user.h>
-#include "lp_utils.h"
+#include <lustre/tests/lp_utils.h>
 
 #define LPGL_FILEN 700000
 #define LPGL_TEST_ITEMS 7
-- 
GitLab