source: issm/trunk/packagers/linux/package-issm-linux-binaries.sh@ 24686

Last change on this file since 24686 was 24651, checked in by jdquinn, 5 years ago

BUG: Accidentally committed grep for “Error” in MATLAB log

  • Property svn:executable set to *
File size: 3.8 KB
Line 
1#!/bin/bash
2
3
4## Constants
5#
6LIBGFORTRAN="/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0" # Important that this is the library itself
7LIBGFORTRAN_DIST="${ISSM_DIR}/lib/libgfortran.so.5" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it
8MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota'),125,126]" # Exclude Dakota tests and any tests with transient solutions that require a restart
9MATLAB_PATH="/usr/local/MATLAB/R2019b"
10PACKAGE="ISSM" # Name of directory to copy distributable files to
11TARBALL_NAME="issm-linux"
12TARBALL="${TARBALL_NAME}.tar.gz"
13
14# Clean up from previous packaging
15echo "Cleaning up existing assets"
16cd ${ISSM_DIR}
17rm -rf ${PACKAGE}
18mkdir ${PACKAGE}
19
20# Add/modify required binaries and libraries
21cd ${ISSM_DIR}/bin
22
23echo "Modify generic"
24cat generic_static.m | sed -e "s/generic_static/generic/g" > generic.m
25
26echo "Moving MPICH binaries to bin/"
27if [ -f ${ISSM_DIR}/externalpackages/petsc/install/bin/mpiexec ]; then
28 cp ${ISSM_DIR}/externalpackages/petsc/install/bin/mpiexec .
29 cp ${ISSM_DIR}/externalpackages/petsc/install/bin/hydra_pmi_proxy .
30elif [ -f ${ISSM_DIR}/externalpackages/mpich/install/bin/mpiexec ]; then
31 cp ${ISSM_DIR}/externalpackages/mpich/install/bin/mpiexec .
32 cp ${ISSM_DIR}/externalpackages/mpich/install/bin/hydra_pmi_proxy .
33else
34 echo "MPICH not found"
35 exit 1
36fi
37
38echo "Moving libgfortran to lib/"
39cp ${LIBGFORTRAN} ${LIBGFORTRAN_DIST} 2> /dev/null
40
41# Run tests
42echo "Running tests"
43cd ${ISSM_DIR}/test/NightlyRun
44
45# Check that MATLAB tests run
46echo "Running MATLAB tests"
47
48rm matlab.log 2> /dev/null
49
50# Run MATLAB tests redirecting output to logfile and suppressing output to console
51${MATLAB_PATH}/bin/matlab -nojvm -nosplash -r "try, addpath ${ISSM_DIR}/bin ${ISSM_DIR}/lib; runme(${MATLAB_NROPTIONS}); exit; catch me,fprintf('%s',getReport(me)); exit; end" -logfile matlab.log &> /dev/null
52
53# Check that MATLAB did not exit in error
54matlabExitCode=`echo $?`
55matlabExitedInError=`grep -E "Activation cannot proceed|license" matlab.log | wc -l`
56
57if [[ ${matlabExitCode} -ne 0 || ${matlabExitedInError} -ne 0 ]]; then
58 echo "----------MATLAB exited in error!----------"
59 cat matlab.log
60 echo "-----------End of matlab.log-----------"
61
62 # Clean up execution directory
63 rm -rf ${ISSM_DIR}/execution/*
64
65 exit 1
66fi
67
68# Check that all MATLAB tests passed
69numMatlabTestsFailed=`cat matlab.log | grep -c -e "FAILED|ERROR"`
70
71if [[ ${numMatlabTestsFailed} -ne 0 ]]; then
72 echo "One or more MATLAB tests FAILED"
73 exit 1;
74else
75 echo "All MATLAB tests PASSED"
76fi
77
78# Create tarball
79cd ${ISSM_DIR}
80rm -f ${TARBALL}
81svn cleanup --remove-ignored --remove-unversioned test # Clean up test directory (before copying to package)
82echo "Copying assets to package: ${PACKAGE}"
83cp -rf bin examples lib scripts test ${PACKAGE}/
84echo "Cleaning up unneeded/unwanted files"
85rm -f ${PACKAGE}/bin/generic_static.* # Remove static versions of generic cluster classes
86rm -f ${PACKAGE}/lib/*.a # Remove static libraries from package
87rm -f ${PACKAGE}/lib/*.la # Remove libtool libraries from package
88echo "Creating tarball: ${TARBALL_NAME}"
89tar -czf ${TARBALL} ${PACKAGE}
90ls -lah ${ISSM_DIR}/${TARBALL}
91
92echo "Shipping binaries to website"
93
94# We're using public key authentication method to upload the tarball The
95# following lines check to see if the SSH Agent is running. If not, then it is
96# started and relevant information is forwarded to a script.
97pgrep "ssh-agent" > /dev/null
98if [ $? -ne 0 ]; then
99 echo "SSH Agent is not running. Starting it..."
100 ssh-agent > ~/.ssh/agent.sh
101else
102 echo "SSH Agent is running..."
103fi
104
105source ~/.ssh/agent.sh
106ssh-add ~/.ssh/debian_linux-vm-to-ross
107
108scp ${TARBALL} ross.ics.uci.edu:/var/www/html/${TARBALL}
109
110if [ $? -ne 0 ]; then
111 echo "The upload failed."
112 echo "Perhaps the SSH Agent was started by some other means."
113 echo "Try killing the agent and running again."
114fi
Note: See TracBrowser for help on using the repository browser.