1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # This script is intended to test binaries downloaded to a user-end machine.
|
---|
4 | #
|
---|
5 | # NOTE: Tarball must already exist in INSTALL_DIR
|
---|
6 | #
|
---|
7 |
|
---|
8 | MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota')]"
|
---|
9 | MATLAB_PATH="/usr/local/MATLAB/R2019b"
|
---|
10 | INSTALL_DIR=~/Downloads
|
---|
11 | PACKAGE_NAME="ISSM"
|
---|
12 | TARBALL_NAME="issm-linux"
|
---|
13 | TARBALL="${TARBALL_NAME}.tar.gz"
|
---|
14 |
|
---|
15 | export ISSM_DIR="${INSTALL_DIR}/${PACKAGE_NAME}"
|
---|
16 | export PATH="${PATH}:${ISSM_DIR}/bin:${ISSM_DIR}/scripts"
|
---|
17 |
|
---|
18 | cd ${INSTALL_DIR}
|
---|
19 | rm -rf ${PACKAGE_NAME}
|
---|
20 | tar -zxvf ${TARBALL}
|
---|
21 | cd ${PACKAGE_NAME}/test/NightlyRun
|
---|
22 |
|
---|
23 | # Check that MATLAB tests run
|
---|
24 | echo "Running MATLAB tests"
|
---|
25 | rm matlab.log 2> /dev/null
|
---|
26 |
|
---|
27 | # Run MATLAB tests redirecting output to logfile and suppressing output to console
|
---|
28 | ${MATLAB_PATH}/bin/matlab -nosplash -nodesktop -nojvm -r "try, addpath ../../bin; addpath ../../lib; runme(${MATLAB_NROPTIONS}); exit; catch me,fprintf('%s',getReport(me)); exit; end" -logfile matlab.log &> /dev/null
|
---|
29 |
|
---|
30 | # Check that MATLAB did not exit in error
|
---|
31 | matlabExitCode=`echo $?`
|
---|
32 | matlabExitedInError=`grep -E "Activation cannot proceed|license|Error" matlab.log | wc -l`
|
---|
33 |
|
---|
34 | if [[ ${matlabExitCode} -ne 0 || ${matlabExitedInError} -ne 0 ]]; then
|
---|
35 | echo "----------MATLAB exited in error!----------"
|
---|
36 | cat matlab.log
|
---|
37 | echo "-----------End of matlab.log-----------"
|
---|
38 | exit 1
|
---|
39 | fi
|
---|
40 |
|
---|
41 | # Check that all MATLAB tests passed
|
---|
42 | numMatlabTestsFailed=`cat matlab.log | grep -c -e "FAILED|ERROR"`
|
---|
43 |
|
---|
44 | if [[ ${numMatlabTestsFailed} -ne 0 ]]; then
|
---|
45 | echo "One or more MATLAB tests FAILED"
|
---|
46 | exit 1
|
---|
47 | else
|
---|
48 | echo "All MATLAB tests PASSED"
|
---|
49 | fi
|
---|