From 40152332d617353e1bb68905c6a8d6473b81d85c Mon Sep 17 00:00:00 2001
From: Jeff Squyres <jsquyres@cisco.com>
Date: Fri, 19 Aug 2022 21:23:26 -0400
Subject: [PATCH] open-mpi-build-script.sh: run singletons

Run the "hello" examples as singletons (just "./hello_c" with no
"mpirun").  Tweak the run_example() subroutine to handle the case
where only one parameter is passed.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
---
 jenkins/open-mpi-build-script.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/jenkins/open-mpi-build-script.sh b/jenkins/open-mpi-build-script.sh
index 555a762..1e9ee18 100755
--- a/jenkins/open-mpi-build-script.sh
+++ b/jenkins/open-mpi-build-script.sh
@@ -240,7 +240,11 @@ cd ..
 set +e
 
 run_example() {
-    example=`basename ${2}`
+    if test -n "{$2}"; then
+        example=`basename ${2}`
+    else
+        example=`basename ${1}`
+    fi
     echo "--> Running example: $example"
     ${1} ${2}
     ret=$?
@@ -267,11 +271,13 @@ if test "${MPIRUN_MODE}" != "none"; then
 	    ;;
     esac
     run_example "${exec}" ./examples/hello_c
+    run_example ./examples/hello_c
     run_example "${exec}" ./examples/ring_c
     run_example "${exec}" ./examples/connectivity_c
     if ompi_info --parsable | grep -q bindings:cxx:yes >/dev/null; then
         echo "--> running C++ examples"
         run_example "${exec}" ./examples/hello_cxx
+        run_example ./examples/hello_cxx
         run_example "${exec}" ./examples/ring_cxx
     else
         echo "--> skipping C++ examples"
@@ -279,6 +285,7 @@ if test "${MPIRUN_MODE}" != "none"; then
     if ompi_info --parsable | grep -q bindings:mpif.h:yes >/dev/null; then
         echo "--> running mpif examples"
         run_example "${exec}" ./examples/hello_mpifh
+        run_example ./examples/hello_mpifh
         run_example "${exec}" ./examples/ring_mpifh
     else
         echo "--> skipping mpif examples"
@@ -286,6 +293,7 @@ if test "${MPIRUN_MODE}" != "none"; then
     if ompi_info --parsable | egrep -q bindings:use_mpi:\"\?yes >/dev/null; then
         echo "--> running usempi examples"
         run_example "${exec}" ./examples/hello_usempi
+        run_example ./examples/hello_usempi
         run_example "${exec}" ./examples/ring_usempi
     else
         echo "--> skipping usempi examples"
@@ -293,6 +301,7 @@ if test "${MPIRUN_MODE}" != "none"; then
     if ompi_info --parsable | grep -q bindings:use_mpi_f08:yes >/dev/null; then
         echo "--> running usempif08 examples"
         run_example "${exec}" ./examples/hello_usempif08
+        run_example ./examples/hello_usempif08
         run_example "${exec}" ./examples/ring_usempif08
     else
         echo "--> skipping usempif08 examples"