aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mpich2.rb
diff options
context:
space:
mode:
authorDominique Orban2015-01-22 23:04:36 -0500
committerMike McQuaid2015-01-23 18:05:47 +0100
commitdf98643417aec5939dbcfcabcf51061c353325a9 (patch)
tree1fb05bcf4da977f2a999a978d23268b190640b80 /Library/Formula/mpich2.rb
parentb949aebef55205efeb9597c2049433f891f3aa51 (diff)
downloadhomebrew-df98643417aec5939dbcfcabcf51061c353325a9.tar.bz2
mpich2: add tests, fix style issues.
Closes #36155. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula/mpich2.rb')
-rw-r--r--Library/Formula/mpich2.rb53
1 files changed, 35 insertions, 18 deletions
diff --git a/Library/Formula/mpich2.rb b/Library/Formula/mpich2.rb
index 8bf7e150c..c1bf757cf 100644
--- a/Library/Formula/mpich2.rb
+++ b/Library/Formula/mpich2.rb
@@ -1,12 +1,10 @@
-require 'formula'
-
# This should really be named Mpich now, but homebrew cannot currently handle
# formula renames, see homebrew issue #14374.
class Mpich2 < Formula
- homepage 'http://www.mpich.org/'
- url 'http://www.mpich.org/static/downloads/3.1.3/mpich-3.1.3.tar.gz'
- mirror 'http://fossies.org/linux/misc/mpich-3.1.3.tar.gz'
- sha1 'aa9907891ef4a4a584ab2f90a86775f29ca0dec0'
+ homepage "http://www.mpich.org/"
+ url "http://www.mpich.org/static/downloads/3.1.3/mpich-3.1.3.tar.gz"
+ mirror "https://fossies.org/linux/misc/mpich-3.1.3.tar.gz"
+ sha1 "aa9907891ef4a4a584ab2f90a86775f29ca0dec0"
revision 1
bottle do
@@ -16,29 +14,29 @@ class Mpich2 < Formula
end
head do
- url 'git://git.mpich.org/mpich.git'
+ url "git://git.mpich.org/mpich.git"
- depends_on 'autoconf' => :build
- depends_on 'automake' => :build
- depends_on 'libtool' => :build
+ depends_on "autoconf" => :build
+ depends_on "automake" => :build
+ depends_on "libtool" => :build
end
devel do
- url 'http://www.mpich.org/static/downloads/3.2a2/mpich-3.2a2.tar.gz'
- sha1 '2bea3f7cb3d69d2ea372e48f376187e91b929bb6'
+ url "http://www.mpich.org/static/downloads/3.2a2/mpich-3.2a2.tar.gz"
+ sha1 "2bea3f7cb3d69d2ea372e48f376187e91b929bb6"
end
deprecated_option "disable-fortran" => "without-fortran"
depends_on :fortran => :recommended
- conflicts_with 'open-mpi', :because => 'both install mpi__ compiler wrappers'
+ conflicts_with "open-mpi", :because => "both install mpi__ compiler wrappers"
def install
if build.head?
# ensure that the consistent set of autotools built by homebrew is used to
# build MPICH, otherwise very bizarre build errors can occur
- ENV['MPICH_AUTOTOOLS_DIR'] = HOMEBREW_PREFIX+'bin'
+ ENV["MPICH_AUTOTOOLS_DIR"] = HOMEBREW_PREFIX + "bin"
system "./autogen.sh"
end
@@ -46,18 +44,37 @@ class Mpich2 < Formula
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
- "--mandir=#{man}"
+ "--mandir=#{man}",
]
args << "--disable-fortran" if build.without? "fortran"
system "./configure", *args
system "make"
- system "make install"
+ system "make", "testing"
+ system "make", "install"
end
test do
- # a better test would be to build and run a small MPI program
- system "#{bin}/mpicc", "-show"
+ (testpath/"hello.c").write <<-EOS.undent
+ #include <mpi.h>
+ #include <stdio.h>
+
+ int main()
+ {
+ int size, rank, nameLen;
+ char name[MPI_MAX_PROCESSOR_NAME];
+ MPI_Init(NULL, NULL);
+ MPI_Comm_size(MPI_COMM_WORLD, &size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Get_processor_name(name, &nameLen);
+ printf("[%d/%d] Hello, world! My name is %s.\\n", rank, size, name);
+ MPI_Finalize();
+ return 0;
+ }
+ EOS
+ system "#{bin}/mpicc", "hello.c", "-o", "hello"
+ system "./hello"
+ system "#{bin}/mpirun", "-np", "4", "./hello"
end
end