From 843990ea04ac6cb100920d5760db6111f8b09959 Mon Sep 17 00:00:00 2001 From: Enol Fernandez <enolfc@ifca.unican.es> Date: Thu, 26 Sep 2013 13:09:00 +0200 Subject: [PATCH] Should fix issue #9, enhanced test for issue #1. --- modules/mpi/mpich2/mpich2.mpi | 8 +++++++- modules/mpi/osc_mpiexec.sh | 15 ++++++++++++--- tests/run_tests.sh | 4 ++-- tests/{test_issue_1.sh => test_issue_1_and_9.sh} | 12 +++++++++++- 4 files changed, 32 insertions(+), 7 deletions(-) rename tests/{test_issue_1.sh => test_issue_1_and_9.sh} (77%) diff --git a/modules/mpi/mpich2/mpich2.mpi b/modules/mpi/mpich2/mpich2.mpi index f105ddb..66d4ca7 100644 --- a/modules/mpi/mpich2/mpich2.mpi +++ b/modules/mpi/mpich2/mpich2.mpi @@ -22,12 +22,18 @@ mpi_start_get_plugin "osc_mpiexec.sh" 1 # further determine if the mpiexec is hydra if test $OSC_MPIEXEC -eq 0 ; then if test "x$MPI_MPIEXEC" != "x"; then - # try with mpiexec.hydra + # No mpiexec? try finding mpiexec.hydra MPIEXEC=`which mpiexec.hydra 2> /dev/null` if test $? -eq 0 -a "x$MPI_MPICH2_DISABLE_HYDRA" != "x1" ; then export HYDRA_MPIEXEC=1 MPI_MPIEXEC=$MPIEXEC fi + else + # check if defined mpiexec is hydra + $MPI_MPIEXEC -version 2>&1 | grep -i "hydra" > /dev/null 2>&1 + if test $? -eq 0 ; then + export HYDRA_MPIEXEC=1 + fi fi fi diff --git a/modules/mpi/osc_mpiexec.sh b/modules/mpi/osc_mpiexec.sh index 8c3578c..ccd649a 100644 --- a/modules/mpi/osc_mpiexec.sh +++ b/modules/mpi/osc_mpiexec.sh @@ -7,10 +7,19 @@ unset I2G_MPIEXEC_COMM # detect OSC mpiexec if test "x$MPI_MPIEXEC" != "x"; then - $MPI_MPIEXEC 2>&1 | grep -e "-\<np\>" > /dev/null 2>&1 + local VERSION_INFO=`$MPI_MPIEXEC -version 2>&1` st=$? - if test $st -ne 0 ; then - export OSC_MPIEXEC=1 + if test $st -eq 0 ; then + echo $VERSION_INFO | grep -i "hydra" > /dev/null 2>&1 + st=$? + if test $st -ne 0 ; then + # for sure not hydra, check that we do not have -np option + $MPI_MPIEXEC 2>&1 | grep -e "-\<np\>" > /dev/null 2>&1 + st=$? + if test $st -ne 0 ; then + export OSC_MPIEXEC=1 + fi + fi fi fi diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 6878613..e4f33f6 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -94,8 +94,8 @@ if test "x${RUN_UNIT_TESTS}" = "x1" ; then ./test_unit.sh || exitcode=1 echo "* RFC #63" ./test_trac_63.sh || exitcode=1 - echo "* Issue #1" - ./test_issue_1.sh || exitcode=1 + echo "* Issue #1, #9" + ./test_issue_1_and_9.sh || exitcode=1 echo "* Issue #6" ./test_issue_6.sh || exitcode=1 echo "***************************" diff --git a/tests/test_issue_1.sh b/tests/test_issue_1_and_9.sh similarity index 77% rename from tests/test_issue_1.sh rename to tests/test_issue_1_and_9.sh index 80cf4bd..c2ee0e1 100755 --- a/tests/test_issue_1.sh +++ b/tests/test_issue_1_and_9.sh @@ -23,6 +23,10 @@ fake_mpiexec() { echo "fake mpiexec -np option" 1>&2 } +fake_hydra_mpiexec() { + echo "fake hydra mpiexec, fake no options" 1>&2 +} + testValidOSCmpiexec() { export MPI_MPIEXEC=fake_osc_mpiexec mpi_start_get_plugin "osc_mpiexec.sh" 1 @@ -37,6 +41,12 @@ testInvalidOSCmpiexec() { assertEquals "0" "$OSC_MPIEXEC" } -# XXX missing tests for OSC mpiexec with the implementations +testHydrampiexec() { + export MPI_MPIEXEC=fake_hydra_mpiexec + mpi_start_get_plugin "osc_mpiexec.sh" 1 + . $MPI_START_PLUGIN_FILES + assertEquals "0" "$OSC_MPIEXEC" +} + . $SHUNIT2 -- GitLab