Ignore:
Timestamp:
02/26/21 10:56:08 (4 years ago)
Author:
jdquinn
Message:

CHG: Modifications to build system and additional configurations in support of Windows 10 MSYS2 MinGW build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/jenkins/jenkins.sh

    r25979 r26034  
    77# members of the ISSM development team.
    88#
     9# NOTE:
     10# - Variable OS is set in environment by running
     11#       `source $ISSM_DIR/etc/environment.sh`.
     12#
    913# TODO:
    1014# - Rename TEMP to something more descriptive (ensure first that other parts of
     
    1418
    1519echo "Cleaning up execution directory"
    16 rm -rf $ISSM_DIR/execution/*
    17 rm -rf $ISSM_DIR/nightlylog
    18 mkdir $ISSM_DIR/nightlylog
     20rm -rf ${ISSM_DIR}/execution/*
     21rm -rf ${ISSM_DIR}/nightlylog
     22mkdir ${ISSM_DIR}/nightlylog
    1923
    2024#Server URI
     
    5357fi
    5458
    55 #Get Operating system (OS) name{{{
    56 OS=$(uname -s)
    57 if [[ $OS == CYGWIN* ]]; then
    58         OS="win";
    59 fi
    60 #}}}
    61 
    6259#Install ISSM
    6360#Determining installation type depending on svn changes{{{
     
    6562echo "             Determining Installation type            "
    6663echo "======================================================";
    67 if [ -a $ISSM_DIR/svn_revision_old ]; then
    68         SVN_PREVIOUS=$(cat $ISSM_DIR/svn_revision_old)
     64if [ -a ${ISSM_DIR}/svn_revision_old ]; then
     65        SVN_PREVIOUS=$(cat ${ISSM_DIR}/svn_revision_old)
    6966        SVN_CURRENT=$SVN_REVISION_1
    7067        echo "Previous revision number: $SVN_PREVIOUS"
     
    7471        #
    7572
    76         #svn --non-interactive --no-auth-cache --trust-server-cert diff -r $SVN_PREVIOUS:$SVN_CURRENT --summarize $ISSM_DIR | awk '{print $NF}' > $ISSM_DIR/TEMP
     73        #svn --non-interactive --no-auth-cache --trust-server-cert diff -r $SVN_PREVIOUS:$SVN_CURRENT --summarize ${ISSM_DIR} | awk '{print $NF}' > ${ISSM_DIR}/TEMP
    7774
    7875        # Get list of changes from Jenkins itself as svn requires credentials
     
    8178
    8279        # Process html page and get the list of files that has changed (tricky...)
    83         #cat changes | grep '="The file was modified"' | sed -e 's/.*<\/td><td><a>\(.*\)<\/a><\/td><td>.*/\1/' > $ISSM_DIR/TEMP
     80        #cat changes | grep '="The file was modified"' | sed -e 's/.*<\/td><td><a>\(.*\)<\/a><\/td><td>.*/\1/' > ${ISSM_DIR}/TEMP
    8481        #cat changes | grep 'document_edit' |sed -e 's/document_edit.png/document_edit.png\
    85                 #/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v 'document_edit.png' > $ISSM_DIR/TEMP
    86         cat changes | tr " " "\n" | grep trunk | sed -e 's/.*<a>\(.*\)<\/a>.*/\1/' > $ISSM_DIR/TEMP
     82                #/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v 'document_edit.png' > ${ISSM_DIR}/TEMP
     83        cat changes | tr " " "\n" | grep trunk | sed -e 's/.*<a>\(.*\)<\/a>.*/\1/' > ${ISSM_DIR}/TEMP
    8784
    8885        # Print list of changed files
    8986        echo "   "
    9087        echo "List of updated files"
    91         cat $ISSM_DIR/TEMP
     88        cat ${ISSM_DIR}/TEMP
    9289        echo "   "
    9390
     
    9996        # If the contents of the externalpackages directory were modified in any
    10097        # way, check for changed external packages
    101         if [ ! -z "$(cat $ISSM_DIR/TEMP | grep externalpackages)" ]; then
     98        if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep externalpackages)" ]; then
    10299                echo "  -- checking for changed externalpackages... yes"
    103100                ISSM_EXTERNALPACKAGES="yes"
     
    109106        # If the Makefile or m4 diirectory were changed in any way or if certain
    110107        # binary files from a previous compilation do not exist, reconfigure
    111         if [ ! -z "$(cat $ISSM_DIR/TEMP | grep -e "Makefile.am" -e "m4" )" ] ||
    112                 [ ! -f "$ISSM_DIR/bin/issm.exe" ] && [ ! -f "$ISSM_DIR/bin/issm-bin.js" ] ||
     108        if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep -e "Makefile.am" -e "m4" )" ] ||
     109                [ ! -f "${ISSM_DIR}/bin/issm.exe" ] && [ ! -f "${ISSM_DIR}/bin/issm-bin.js" ] ||
    113110                [ "$ISSM_EXTERNALPACKAGES" == "yes" ]; then
    114111                echo "  -- checking for reconfiguration... yes"
     
    120117
    121118        # If source files were changed in any way, recompile
    122         if [ ! -z "$(cat $ISSM_DIR/TEMP | grep -e "\.cpp" -e "\.h" )" ] ||
     119        if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep -e "\.cpp" -e "\.h" )" ] ||
    123120                [ "$ISSM_RECONFIGURE" == "yes" ]; then
    124121                echo "  -- checking for recompilation... yes"
     
    131128        # Cleanup
    132129        rm changes
    133         rm $ISSM_DIR/TEMP
     130        rm ${ISSM_DIR}/TEMP
    134131else
    135132        echo "Previous revision not found, this must be a fresh install"
     
    144141echo " "
    145142echo "Recording current svn version: $SVN_REVISION_1"
    146 echo $SVN_REVISION_1 > $ISSM_DIR/svn_revision_old
     143echo $SVN_REVISION_1 > ${ISSM_DIR}/svn_revision_old
    147144#}}}
    148145
     
    154151
    155152#Jenkins XML files for individual packages
    156 EXTERNAL_TEST_FILE="$ISSM_DIR/nightlylog/results/external.xml"
    157 mkdir -p $ISSM_DIR/nightlylog/results
     153EXTERNAL_TEST_FILE="${ISSM_DIR}/nightlylog/results/external.xml"
     154mkdir -p ${ISSM_DIR}/nightlylog/results
    158155echo "<testsuite tests=\"$NUMPACKAGES\">" > $EXTERNAL_TEST_FILE
    159156
    160157# Need a source here for when builds start midway through installation of externalpackages.
    161 source $ISSM_DIR/etc/environment.sh
    162 
    163 if [ "$OS" == "win" ]; then
     158source ${ISSM_DIR}/etc/environment.sh
     159
     160if [ "${OS}" == CYGWIN* ]; then
    164161        echo " == WINDOWS ENVIRONMENT DETECTED =="
    165         source $ISSM_DIR/externalpackages/windows/windows_environment.sh
     162        source ${ISSM_DIR}/externalpackages/windows/windows_environment.sh
    166163fi
    167164
     
    175172
    176173        #install if requested or if previous install has not been successful
    177         if [ "$ISSM_EXTERNALPACKAGES" == "yes" ]; then # NOTE: Removed check on if 'install' directory exist
    178                 cd $ISSM_DIR/externalpackages/$PACKAGENAME
     174        if [ "${ISSM_EXTERNALPACKAGES}" == "yes" ]; then # NOTE: Removed check on if 'install' directory exist
     175                cd ${ISSM_DIR}/externalpackages/$PACKAGENAME
    179176
    180177                echo "======================================================";
     
    183180
    184181                ./$PACKAGEINST $NUMCPUS_INSTALL &> compil.log
    185                 if [ $? -ne 0 ] && [ "$PACKAGENAME" != "boost" ]; then
     182                if [ $? -ne 0 ] && [ "${PACKAGENAME}" != "boost" ]; then
    186183                        cat compil.log
    187184                        echo "======================================================";
     
    197194                        echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\"/>" >> $EXTERNAL_TEST_FILE
    198195                fi
    199                 source $ISSM_DIR/etc/environment.sh
     196                source ${ISSM_DIR}/etc/environment.sh
    200197
    201198                #If external package is rebuilt, we also need to recompile
     
    220217
    221218# Source here to include any newly installed externalpackages on the path.
    222 source $ISSM_DIR/etc/environment.sh
    223 
    224 if [ "$OS" == "win" ]; then
     219source ${ISSM_DIR}/etc/environment.sh
     220
     221if [ "${OS}" == CYGWIN* ]; then
    225222        echo " == WINDOWS ENVIRONMENT DETECTED =="
    226         source $ISSM_DIR/externalpackages/windows/windows_environment.sh
     223        source ${ISSM_DIR}/externalpackages/windows/windows_environment.sh
    227224fi
    228225
     
    244241        #export EMCC_DEBUG=1 # Uncomment to enable debugging
    245242        export EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" # Required after v1.38.14 to avoid undefined symbol warnings from our Fortran object files being treated as errors
    246         source $ISSM_DIR/externalpackages/emscripten/install/emsdk_env.sh
     243        source ${ISSM_DIR}/externalpackages/emscripten/install/emsdk_env.sh
    247244fi
    248245
    249246#}}}
    250247#ISSM compilation yes/no                (ISSM_COMPILATION) {{{
    251 if [ "$ISSM_COMPILATION" == "yes" ]; then
     248if [ "${ISSM_COMPILATION}" == "yes" ]; then
    252249        cd $ISSM_DIR
    253         if [ "$ISSM_RECONFIGURE" == "yes" ]; then
     250        if [ "${ISSM_RECONFIGURE}" == "yes" ]; then
    254251                echo "======================================================";
    255252                echo "             Cleaning up and reconfiguring            "
     
    262259                        exit 1
    263260                fi
    264                 eval "./configure $ISSM_CONFIG"
     261                eval "./configure ${ISSM_CONFIG}"
    265262                if [ $? -ne 0 ]; then
    266263                        echo "ISSM configuration failed (see options below)"
     
    276273        echo "======================================================"
    277274        if [ $NUMCPUS_INSTALL -gt 1 ]; then
    278                 echo "Making with " $NUMCPUS_INSTALL " cpus"
     275                echo "Making with ${NUMCPUS_INSTALL} cpus"
     276
     277                # To debug compilation/linking, add 'V=1' option to the call to make
     278                #make -j $NUMCPUS_INSTALL V=1
    279279                make -j $NUMCPUS_INSTALL
    280280        else
     281                #make V=1
    281282                make
    282283        fi
     
    292293        fi
    293294        make install
    294 elif [ "$ISSM_COMPILATION" == "no" ]
    295 then
     295elif [ "${ISSM_COMPILATION}" == "no" ]; then
    296296        echo "Skipping ISSM compilation"
    297297else
     
    311311        for (( i=1;i<=$NUMCPUS_RUN;i++ )); do
    312312                #Launch matlab and the nightly run script
    313                 cat > $ISSM_DIR/nightlylog/matlab_run$i.m << EOF
     313                cat > ${ISSM_DIR}/nightlylog/matlab_run$i.m << EOF
    314314                warning off %necessary to avoid a log of several Go for parallel runs
    315315                try,
    316                         $(if [ "$MATLAB_NROPTIONS" = "" ]; then
    317                                 echo "runme('output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
     316                        $(if [ "${MATLAB_NROPTIONS}" = "" ]; then
     317                                echo "runme('output','nightly','rank',${i},'numprocs',${NUMCPUS_RUN});"
    318318                        else
    319                                 echo "runme($MATLAB_NROPTIONS,'output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"
     319                                echo "runme(${MATLAB_NROPTIONS},'output','nightly','rank',${i},'numprocs',${NUMCPUS_RUN});"
    320320                        fi)
    321321                catch me,
     
    332332EOF
    333333                cd $ISSM_DIR/test/NightlyRun
    334                 if [ "$OS" = "win" ]; then
    335                         $MATLAB_PATH/bin/matlab -nodisplay -nosplash -r "addpath $ISSM_DIR_WIN/src/m/dev; devpath; addpath $ISSM_DIR_WIN/nightlylog/; matlab_run$i" -logfile $ISSM_DIR_WIN/nightlylog/matlab_log$i.log &
     334                if [[ "${OS}" == CYGWIN* || "${OS}" == MINGW* ]]; then
     335                        $MATLAB_PATH/bin/matlab -nodesktop -nosplash -nojvm -r "addpath ${ISSM_DIR_WIN}/src/m/dev; devpath; addpath ${ISSM_DIR_WIN}/nightlylog; matlab_run$i" -logfile ${ISSM_DIR_WIN}/nightlylog/matlab_log$i.log &
    336336                else
    337                         $MATLAB_PATH/bin/matlab -nodisplay -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
     337                        $MATLAB_PATH/bin/matlab -nodisplay -nosplash -r "addpath ${ISSM_DIR}/src/m/dev; devpath; addpath ${ISSM_DIR}/nightlylog; matlab_run$i" -logfile ${ISSM_DIR}/nightlylog/matlab_log$i.log &
    338338                fi
    339339        done
    340340
    341         #wait until matlab closes
    342         if [ "$OS" = "win" ]; then
     341        # Wait for MATLAB to exit
     342        if [[ "${OS}" == CYGWIN* ]]; then
    343343                sleep 5;
    344                 echo "Waiting for matlab on windows"
     344                echo "Waiting for MATLAB to exit"
    345345                pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}')
    346346                echo '-----------------------------'
    347                 echo "pid: $pid"
     347                echo "pid: ${pid}"
    348348                echo '-----------------------------'
    349                 while [ -n "$pid" ]; do
     349                while [ -n "${pid}" ]; do
    350350                        pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}')
    351351                        sleep 1;
    352352                done
    353353                echo "DONE!"
     354        elif [[ "${OS}" == MINGW* ]]; then
     355                # NOTE: The PID query used here may work as well on Cygwin. If so, combine the two conditional blocks.
     356                sleep 5;
     357                echo "Waiting for MATLAB to exit"
     358                pid=$(ps -W | grep MATLAB | awk '{print $1}')
     359                echo '-----------------------------'
     360                echo "pid: ${pid}"
     361                echo '-----------------------------'
     362                while [ -n "${pid}" ]; do
     363                        pid=$(ps -W | grep MATLAB | awk '{print $1}')
     364                        sleep 1;
     365                done
    354366        else
    355367                wait
    356368        fi
    357369
    358         #concatenate reports
    359         cd $ISSM_DIR/nightlylog/
    360         #echo 'CHECKING NIGHTLYLOG DIRECTORY'
    361         #echo '-----------------------------'
    362         #ls -la
    363         #echo '-----------------------------'
     370        # Concatenate logs
     371        cd $ISSM_DIR/nightlylog
    364372
    365373        if [ -f matlab_log.log ]; then
     
    368376
    369377        for job in `jobs -p`; do
    370                 echo "Waiting on: $job"
     378                #echo "Waiting on: ${job}" # Commented out because it really has nothing to do with MATLAB processes
    371379                wait $job
    372380        done
     
    387395if [ $PYTHON_TEST -eq 1 ]; then
    388396        #Launch all tests on different cpus
    389         export PYTHONPATH="$ISSM_DIR/src/m/dev"
     397        export PYTHONPATH="${ISSM_DIR}/src/m/dev"
    390398        export PYTHONSTARTUP="${PYTHONPATH}/devpath.py"
    391399        export PYTHONUNBUFFERED=1 #we don't want python to buffer otherwise issm.exe output is not captured
     
    398406        done
    399407
    400         # concatenate reports
    401         cd $ISSM_DIR/nightlylog/
     408        # Concatenate logs
     409        cd $ISSM_DIR/nightlylog
    402410        if [ -f python_log.log ]; then
    403411                rm python_log.log
     
    406414        for job in `jobs -p`
    407415        do
    408                 echo "Waiting on: $job"
     416                echo "Waiting on: ${job}"
    409417                wait $job
    410418        done
     
    429437# }}}
    430438
    431 #process logs to be junit compatible
     439# Process logs to be JUnit compatible
    432440#{{{
    433441cd $ISSM_DIR/nightlylog
Note: See TracChangeset for help on using the changeset viewer.