Skip to content

Commit adf4afa

Browse files
jsquyresbwbarrett
authored andcommitted
jenkins: Use a perl regexp for the mpirun versio
The sed regexp is a bit challenging to make portable (e.g., what works on Linux may not work in OS X / BSDs). So just switch to Perl, because Perl's regexps are nicely uniform across platforms. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 84c839a commit adf4afa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jenkins/open-mpi-build-script.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ run_example() {
214214
if test "${MPIRUN_MODE}" != "none"; then
215215
echo "--> running examples"
216216
echo "localhost cpu=2" > "${WORKSPACE}/hostfile"
217-
mpirun_version=`"${WORKSPACE}/install/bin/mpirun" --version | sed -n 's/.*\([0-9]\+\.[0-9]\+\)\..*/\1/p'`
217+
# Note: using perl here because figuring out a portable sed regexp
218+
# proved to be a little challenging.
219+
mpirun_version=`"${WORKSPACE}/install/bin/mpirun --version | perl -wnE 'say $1 if /mpirun [^\d]*(\d+.\d+)/'`
218220
echo "--> mpirun version: ${mpirun_version}"
219221
case ${mpirun_version} in
220222
1.*|2.0*)

0 commit comments

Comments
 (0)