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

Last change on this file since 25836 was 25836, checked in by Mathieu Morlighem, 4 years ago

merged trunk-jpl and trunk for revision 25834

  • Property svn:executable set to *
File size: 3.8 KB
Line 
1#!/bin/bash
2
3
4# Script to test, package, and transfer distributable to ISSM Web site.
5# Corresponds with build generated by configuration in
6# $ISSM_DIR/jenkins/ross-debian_linux-binaries.
7#
8
9## Constants
10#
11LIBGFORTRAN="/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0" # Important that this is the library itself
12LIBGFORTRAN_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
13MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota')]"
14MATLAB_PATH="/usr/local/MATLAB/R2019b"
15PACKAGE="ISSM" # Name of directory to copy distributable files to
16TARBALL_NAME="issm-linux"
17TARBALL="${TARBALL_NAME}.tar.gz"
18
19## Environment
20#
21export PATH="${ISSM_DIR}/bin:$(getconf PATH)" # Ensure that we pick up binaries from 'bin' directory rather than 'externalpackages'
22
23# Check if MATLAB exists
24if ! [ -d ${MATLAB_PATH} ]; then
25 echo "${MATLAB_PATH} does not point to a MATLAB installation! Please modify MATLAB_PATH variable in $(basename $0) and try again."
26 exit 1
27fi
28
29# Clean up from previous packaging
30echo "Cleaning up existing assets"
31cd ${ISSM_DIR}
32rm -rf ${PACKAGE}
33mkdir ${PACKAGE}
34
35# Add/modify required binaries and libraries
36cd ${ISSM_DIR}/bin
37
38echo "Modify generic"
39cat generic_static.m | sed -e "s/generic_static/generic/g" > generic.m
40
41echo "Moving MPICH binaries to bin/"
42if [ -f ${ISSM_DIR}/externalpackages/petsc/install/bin/mpiexec ]; then
43 cp ${ISSM_DIR}/externalpackages/petsc/install/bin/mpiexec .
44 cp ${ISSM_DIR}/externalpackages/petsc/install/bin/hydra_pmi_proxy .
45elif [ -f ${ISSM_DIR}/externalpackages/mpich/install/bin/mpiexec ]; then
46 cp ${ISSM_DIR}/externalpackages/mpich/install/bin/mpiexec .
47 cp ${ISSM_DIR}/externalpackages/mpich/install/bin/hydra_pmi_proxy .
48else
49 echo "MPICH not found"
50 exit 1
51fi
52
53echo "Moving libgfortran to lib/"
54cp ${LIBGFORTRAN} ${LIBGFORTRAN_DIST} 2> /dev/null
55
56# Run tests
57echo "Running tests"
58cd ${ISSM_DIR}/test/NightlyRun
59
60# Check that MATLAB tests run
61echo "Running MATLAB tests"
62
63rm matlab.log 2> /dev/null
64
65# Run MATLAB tests redirecting output to logfile and suppressing output to console
66${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
67
68# Check that MATLAB did not exit in error
69matlabExitCode=`echo $?`
70matlabExitedInError=`grep -E "Activation cannot proceed|license|Error" matlab.log | wc -l`
71
72if [[ ${matlabExitCode} -ne 0 || ${matlabExitedInError} -ne 0 ]]; then
73 echo "----------MATLAB exited in error!----------"
74 cat matlab.log
75 echo "-----------End of matlab.log-----------"
76
77 # Clean up execution directory
78 rm -rf ${ISSM_DIR}/execution/*
79
80 exit 1
81fi
82
83# Check that all MATLAB tests passed
84numMatlabTestsFailed=`cat matlab.log | grep -c -e "FAILED|ERROR"`
85
86if [[ ${numMatlabTestsFailed} -ne 0 ]]; then
87 echo "One or more MATLAB tests FAILED"
88 exit 1
89else
90 echo "All MATLAB tests PASSED"
91fi
92
93# Create tarball
94cd ${ISSM_DIR}
95rm -f ${TARBALL}
96svn cleanup --remove-ignored --remove-unversioned test # Clean up test directory (before copying to package)
97echo "Copying assets to package: ${PACKAGE}"
98cp -rf bin examples lib scripts test ${PACKAGE}/
99echo "Cleaning up unneeded/unwanted files"
100rm -f ${PACKAGE}/bin/generic_static.* # Remove static versions of generic cluster classes
101rm -f ${PACKAGE}/lib/*.a # Remove static libraries from package
102rm -f ${PACKAGE}/lib/*.la # Remove libtool libraries from package
103rm -rf ${PACKAGE}/test/SandBox # Remove testing sandbox from package
104echo "Creating tarball: ${TARBALL_NAME}"
105tar -czf ${TARBALL} ${PACKAGE}
106ls -lah ${ISSM_DIR}/${TARBALL}
107
108echo "Transferring binaries to ISSM Web site"
109scp -i ~/.ssh/debian_linux-vm_to_ross ${TARBALL} jenkins@ross.ics.uci.edu:/var/www/html/${TARBALL}
110
111if [ $? -ne 0 ]; then
112 echo "FAILED: Manually check connection"
113 exit 1
114fi
Note: See TracBrowser for help on using the repository browser.