1#! /bin/sh
2##
3## Copyright (C) by Argonne National Laboratory
4##     See COPYRIGHT in top-level directory
5##
6
7# Configure and build the most common configurations.  Does not do
8# extensive tests
9#
10# ----------------------------------------------------------------------------
11# Set defaults
12#
13do_tests=yes
14builddir=/sandbox/$LOGNAME/mpich2
15instdir=/sandbox/$LOGNAME/mpi2-inst
16srcdir=/home/MPI/testing/mpich2/mpich2
17# ----------------------------------------------------------------------------
18# Get arguments
19for arg in "$@" ; do
20    case $arg in
21	-echo) set -x ;;
22	-local)
23	# Do the testing in place.
24	builddir=`pwd`
25	instdir=`(cd .. && pwd)`"/mpi2-inst"
26	srcdir=`pwd`
27	;;
28	-notest)
29	do_tests=no
30	;;
31	*)
32	if [ -n "$arg" ] ; then
33	    echo "Unknown argument $arg"
34	    exit 1
35	fi
36	;;
37    esac
38done
39
40# ----------------------------------------------------------------------------
41# Validate arguments
42#
43if [ ! -d $srcdir ] ; then
44    if [ -d /homes/MPI/testing/mpich2/mpich2 ] ; then
45        srcdir=/homes/MPI/testing/mpich2/mpich2
46    else
47	echo "Cannot find source directory"
48	exit 1
49    fi
50fi
51#
52if cd $builddir ; then
53    :
54else
55    echo "Could not change directory to $builddir"
56    exit 1
57fi
58if [ ! -x $srcdir/configure ] ; then
59    echo "Cannot find configure in $srcdir"
60    exit 1
61fi
62#
63# ---------------------------------------------------------------------------
64# BuildMPICH uses the following global variables:
65#    testname    - string name for test
66#    config_args - arguments to pass to configure
67#    do_tests    - yes or no; controls tests
68#    srcdir,instdir - directories for source, installation
69# This uses XML-style tags to mark the various segments, but does not
70# filter the output from the individual steps for XML/SGML characters (e.g.,
71# the <,>,& characters aren't handled).
72# Note: we could filter through sed with
73# sed -e 's/>/-AMP-gt;/g' -e 's/</-AMP-lt;/g' -e 's/\&/-AMP-amp;/g' | \
74# sed -e 's/-AMP-/&/g'
75#
76BuildMPICH2 () {
77echo "<BUILDTEST NAME=\"$testname\">"
78echo "<CONFIG>"
79if $srcdir/configure --prefix=$instdir $config_args ; then
80    echo "</CONFIG>"
81    echo "<MAKE>"
82    # Remove any lingering libraries
83    rm -f lib/libmpi*.a lib/libpmpi*.a lib/libmpifort*.a
84    rm -f lib/libmpi*.so lib/libpmpi*.so lib/libmpifort*.so
85    if make ; then
86        echo "</MAKE>"
87	echo "<MAKEINST>"
88	if make install ; then
89	    echo "</MAKEINST>"
90	    if [ "$do_tests" = "yes" ] ; then
91	        echo "<RUNTEST>"
92	        if make testing ; then
93		    echo "Tests completed in test/mpi/summary.xml"
94		    # Really should copy failures if any
95	        else
96		    echo "Tests failed ($testname)"
97	        fi
98	        echo "</RUNTEST>"
99	    fi
100	else
101	    rc=$?
102	    echo "Install failed ($testname)"
103	    echo "</MAKEINST STATUS=\"$rc\">"
104	fi
105    else
106        rc = $?
107	echo "make failed ($testname)"
108	echo "</MAKE STATUS=\"$rc\">"
109    fi
110else
111    rc=$?
112    echo "Configure failed ($testname)"
113    echo "</CONFIG STATUS=\"$rc\">"
114fi
115echo "</BUILDTEST>"
116}
117# ---------------------------------------------------------------------------
118# Preamble
119echo "<MPICH2BUILD>"
120echo "<DATE>"
121date
122echo "</DATE>"
123# ---------------------------------------------------------------------------
124# Basic test
125testname="basic"
126config_args=""
127BuildMPICH2
128
129#
130# No Fortran or C++
131testname="no f77/c++"
132config_args="--disable-f77 --disable-cxx"
133BuildMPICH2
134
135#
136# No Weak symbols
137testname="no weak symbols"
138config_args="--disable-weak-symbols"
139BuildMPICH2
140
141#
142# --enable-fast
143testname="fast"
144config_args="--enable-fast"
145BuildMPICH2
146
147#
148# forker pm, strict
149testname="strict and forker"
150config_args="--enable-strict --with-pm=forker"
151BuildMPICH2
152
153#
154# Build and link with a logging library
155testname="logging with lwlog"
156config_args="--with-logging=lwlog --with-pm=forker"
157BuildMPICH2
158
159#
160# Build with memory checking
161testname="memory tests"
162config_args="--enable-g=all --enable-strict"
163BuildMPICH2
164
165#
166# Build with shared libraries
167testname="sharedlibs"
168config_args="--enable-sharedlibs=gcc"
169BuildMPICH2
170
171#
172# Build with PVFS if available
173# --with-romio=--with-file-system=ufs+nfs+testfs+pvfs
174# Tests could be run in /pvfs/pvfsstage/$LOGNAME on Chiba
175if [ -d /pvfs ] ; then
176    testname="pvfs"
177    config_args="--with-romio=--with-file-system=ufs+nfs+testfs+pvfs"
178    BuildMPICH2
179fi
180# ---------------------------------------------------------------------------
181# Postamble
182echo "</MPICH2BUILD>"
183