Framework: Fix bug in PullRequestLinuxDriver for SERIAL builds
Created by: william76
@trilinos/framework @jwillenbring @prwolfe
the update to PullRequestLinuxDriver.sh
script to wildcard "*_SERIAL" is wrong.
This If/Else condition fails to correctly identify the _SERIAL piece, take this sample test code to illustrate:
#!/usr/bin/env bash
# uncomment one of these
JOB_BASE_NAME="Trilinos_pullrequest_gcc_4.9.3_SERIAL"
# JOB_BASE_NAME="Trilinos_pullrequest_gcc_4.9.3"
echo "JOB_BASE_NAME: $JOB_BASE_NAME"
echo "Test old method:"
if [ "*_SERIAL" != "${JOB_BASE_NAME:?}" ]; then
echo -e "- Job is MPI"
else
echo -e "- Job is SERIAL"
fi
echo "Test new method:"
regex=".*(_SERIAL)$"
if [[ ! ${JOB_BASE_NAME:?} =~ ${regex} ]]; then
echo -e "- Job name is MPI"
else
echo -e "- Job name is SERIAL"
fi
Run it with the non-serial version of JOB_BASE_NAME
and you get:
$ ./test.sh
JOB_BASE_NAME: Trilinos_pullrequest_gcc_4.9.3
Test old method:
- Job is MPI
Test new method:
- Job name is MPI
Looks correct, right? Nope, it's just lucking into it via a bug. Run it with the _SERIAL
job and you get this:
$ ./test.sh
JOB_BASE_NAME: Trilinos_pullrequest_gcc_4.9.3_SERIAL
Test old method:
- Job is MPI
Test new method:
- Job name is SERIAL
The method just comparing against "*_SERIAL" incorrectly thinks the string matches. I think this expression will always evaluate to true
which is not what we want.
TODO
-
Fix the script to use the new method described here to make that conditional operate properly.