aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaun Jackman2015-01-08 11:02:21 -0800
committerJack Nagel2015-01-12 20:35:04 -0500
commit57b5d2751bbfda337232500b92f2ee3ff7ec81ad (patch)
treef7ead9ae6a8bd48e71a22a053a458cb7e69c093a
parent8c01a48bca19faa8befca228678517e384a97de2 (diff)
downloadhomebrew-57b5d2751bbfda337232500b92f2ee3ff7ec81ad.tar.bz2
open-mpi: add test
Closes #35669. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
-rw-r--r--Library/Formula/open-mpi.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/Library/Formula/open-mpi.rb b/Library/Formula/open-mpi.rb
index 25042d661..be341746c 100644
--- a/Library/Formula/open-mpi.rb
+++ b/Library/Formula/open-mpi.rb
@@ -49,4 +49,27 @@ class OpenMpi < Formula
libexec.install bin/'vtsetup.jar'
inreplace bin/'vtsetup', '$bindir/vtsetup.jar', '$prefix/libexec/vtsetup.jar'
end
+
+ test do
+ (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