Skip to content

Commit

Permalink
Per #1510, update the scripts to use the new sub-directories and read…
Browse files Browse the repository at this point in the history
… from the environment files.
  • Loading branch information
MET Tools Test Account committed Oct 6, 2020
1 parent b668f20 commit 53f1c29
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 101 deletions.
6 changes: 5 additions & 1 deletion scripts/environment/development.dakota
Expand Up @@ -35,9 +35,13 @@ export LDFLAGS="${LDFLAGS} -Wl,-rpath,${MET_DST}/lib:${MET_HDFEOS}/lib:${MET_NET
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${MET_HDFLIB}:${MET_HDF5}/lib:${MET_PYTHON}/lib"

# Variables required to run MET
export MET_FONT_DIR=${MET_PROJ_DIR}/MET_test_data/unit_test/fonts
export MET_TEST_INPUT=${MET_PROJ_DIR}/MET_test_data/unit_test
export MET_FONT_DIR=${MET_TEST_INPUT}/fonts

# This is a cron script -- create the shell environment for this job
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\
/usr/bin/X11:/opt/bin:${MET_NETCDF}/bin"

# Fortify bin directory
export FORTIFY_BIN=/d3/projects/Fortify/19.2.0/Fortify_SCA_and_Apps_19.2.0/bin

5 changes: 4 additions & 1 deletion scripts/environment/development.kiowa
Expand Up @@ -34,9 +34,12 @@ export LDFLAGS="${LDFLAGS} -Wl,-rpath,${MET_DST}/lib:${MET_HDFEOS}/lib:${MET_NET
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${MET_HDFLIB}:${MET_HDF5}/lib:${MET_PYTHON}/lib"

# Variables required to run MET
export MET_FONT_DIR=${MET_PROJ_DIR}/MET_test_data/unit_test/fonts
export MET_TEST_INPUT=${MET_PROJ_DIR}/MET_test_data/unit_test
export MET_FONT_DIR=${MET_TEST_INPUT}/fonts

# This is a cron script -- create the shell environment for this job
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\
/usr/bin/X11:/opt/bin:${MET_NETCDF}/bin"

# Fortify bin directory
export FORTIFY_BIN=/d1/projects/Fortify/19.2.0/Fortify_SCA_and_Apps_19.2.0/bin
9 changes: 7 additions & 2 deletions scripts/fortify/run_fortify_sca.sh
Expand Up @@ -9,7 +9,7 @@
# then run:
#
# git clone https://github.com/dtcenter/MET
# MET/scripts/run_fortify_sca.sh name
# MET/scripts/fortify/run_fortify_sca.sh name
#
# Usage: run_fortify_sca.sh name
# Test the specified branched version of MET:
Expand All @@ -21,7 +21,6 @@

# Constants
GIT_REPO="https://github.com/dtcenter/MET"
FORTIFY_BIN=/d3/projects/Fortify/19.2.0/Fortify_SCA_and_Apps_19.2.0/bin

function usage {
echo
Expand All @@ -33,6 +32,12 @@ function usage {
# Check for arguments
if [[ $# -lt 1 ]]; then usage; exit; fi

# Check that FORTIFY_BIN is defined
if [ -z ${FORTIFY_BIN+x} ]; then
echo "ERROR: ${FORTIFY_BIN} must be defined!"
exit 1
fi

# Sub-routine for running a command and checking return status
function run_command() {

Expand Down
88 changes: 0 additions & 88 deletions scripts/fortify/run_fortify_sca_nightly.sh

This file was deleted.

70 changes: 70 additions & 0 deletions scripts/fortify/run_nightly.sh
@@ -0,0 +1,70 @@
#!/bin/bash
#
# Run nightly Fortify scan
#=======================================================================
#
# This run_nightly.sh script calls the run_fortify_sca.sh script.
# It is intented to be run nightly through cron. Output should be
# directed to the LOGFILE, per cron convention. To run this script, use
# the following commands:
#
# git clone https://github.com/dtcenter/MET
# MET/scripts/fortify/run_nightly.sh name
#
# Usage: run_nightly.sh name
# where "name" specifies a branch, tag, or hash
#
# For example, scan the develop branch:
# run_nightly.sh develop
#
#=======================================================================

# Constants
#EMAIL_LIST="johnhg@ucar.edu bullock@ucar.edu mccabe@ucar.edu"
EMAIL_LIST="johnhg@ucar.edu"
KEEP_DAYS=5

function usage {
echo
echo "USAGE: run_nightly.sh name"
echo " where \"name\" specifies a branch, tag, or hash."
echo
}

# Check for arguments
if [ $# -lt 1 ]; then usage; exit 1; fi

# Store the full path to the scripts directory
SCRIPT_DIR=`dirname $0`
if [[ ${0:0:1} != "/" ]]; then SCRIPT_DIR=$(pwd)/${SCRIPT_DIR}; fi

# Define the development environment
MACHINE=`uname -n`
ENV_FILE=${SCRIPT_DIR}/../environment/development.${MACHINE}
if [[ ! -e ${ENV_FILE} ]]; then
echo "$0: ERROR -> Development environment file missing: ${ENV_FILE}"
exit 1
fi
source ${ENV_FILE}

# Delete old directories
find ${MET_PROJ_DIR}/MET_regression/fortify \
-mtime +${KEEP_DAYS} -name "NB*" | \
xargs rm -rf

# Create and switch to a run directory
RUN_DIR=${MET_PROJ_DIR}/MET_regression/fortify/NB`date +%Y%m%d`
if [[ -e ${RUN_DIR} ]]; then rm -rf ${RUN_DIR}; fi
mkdir -p ${RUN_DIR}
cd ${RUN_DIR}

# Create a logfile
LOGFILE=${RUN_DIR}/run_fortify_sca_`date +%Y%m%d`.log

# Run scan and check for bad return status
${SCRIPT_DIR}/run_fortify_sca.sh ${1} > ${LOGFILE}
if [[ $? -ne 0 ]]; then
echo "$0: The nightly Fortify scan FAILED on ${TODAY}." >> ${LOGFILE}
cat ${LOGFILE} | mail -s "MET Fortify Scan Failed for ${1} (autogen msg)" ${EMAIL_LIST}
exit 1
fi
6 changes: 3 additions & 3 deletions scripts/regression/test_nightly.sh
Expand Up @@ -23,7 +23,7 @@
# Constants
#EMAIL_LIST="johnhg@ucar.edu bullock@ucar.edu hsoh@ucar.edu mccabe@ucar.edu fillmore@ucar.edu"
EMAIL_LIST="johnhg@ucar.edu"
KEEP_STUFF_DURATION=5 # In days
KEEP_DAYS=5

# Usage statement
function usage {
Expand All @@ -38,7 +38,7 @@ function usage {
# Check for arguments
if [ $# -lt 1 ]; then usage; fi

# Store full path to the script directory
# Store the full path to the scripts directory
SCRIPT_DIR=`dirname $0`
if [[ ${0:0:1} != "/" ]]; then SCRIPT_DIR=$(pwd)/${SCRIPT_DIR}; fi

Expand All @@ -56,7 +56,7 @@ umask 0002

# Delete old directories
find ${MET_PROJ_DIR}/MET_regression/${1} \
-mtime +${KEEP_STUFF_DURATION} -name "NB*" | \
-mtime +${KEEP_DAYS} -name "NB*" | \
xargs rm -rf

# Create and switch to a run directory
Expand Down
9 changes: 5 additions & 4 deletions scripts/regression/test_regression.sh
Expand Up @@ -10,7 +10,7 @@
# two sets of tests. To run this script, use the following commands:
#
# git clone https://github.com/dtcenter/MET
# MET/scripts/test_regression.sh version1 version2
# MET/scripts/regression/test_regression.sh version1 version2
#
# Usage: test_regression.sh version1 version2
# where version1 and version2 are named branches, tags, or hashes.
Expand Down Expand Up @@ -54,8 +54,9 @@ function run_command() {
return ${STATUS}
}

# Store the scripts location
SCRIPTS=`dirname $0`
# Store the full path to the scripts directory
SCRIPT_DIR=`dirname $0`
if [[ ${0:0:1} != "/" ]]; then SCRIPT_DIR=$(pwd)/${SCRIPT_DIR}; fi

# Run the unit test script for each version
PID_LIST=""
Expand All @@ -65,7 +66,7 @@ for VERSION in `echo "${1} ${2}"`; do
LOG="$(pwd)/test_unit_${VERSION}.log"

# Run the unit tests in the background
UNIT_CMD="${SCRIPTS}/test_unit.sh ${VERSION}"
UNIT_CMD="${SCRIPT_DIR}/test_unit.sh ${VERSION}"
echo "CALLING: ${UNIT_CMD}"
echo "LOGGING: ${LOG}"
$UNIT_CMD > $LOG 2>&1 &
Expand Down
9 changes: 7 additions & 2 deletions scripts/regression/test_unit.sh
Expand Up @@ -7,7 +7,7 @@
# compile the code, and run the unit tests.
#
# git clone https://github.com/dtcenter/MET
# MET/scripts/test_unit.sh name
# MET/scripts/build/test_unit.sh name
#
# Usage: test_unit.sh name
# Test the specified branched version of MET:
Expand Down Expand Up @@ -82,12 +82,17 @@ run_command "./configure --prefix=`pwd` \
run_command "make install"
run_command "cd .."

# Check that MET_TEST_INPUT is defined
if [ -z ${MET_TEST_INPUT+x} ]; then
echo "ERROR: ${MET_TEST_INPUT} must be defined!"
exit 1
fi

# Run the unit tests
export MET_BUILD_BASE=$(pwd)/met
export MET_BASE=$MET_BUILD_BASE/share/met
export MET_TEST_BASE=$(pwd)/test
export MET_TEST_OUTPUT=$(pwd)/test_output
export MET_TMP_DIR=$(pwd)/test/tmp
export MET_TEST_INPUT=${MET_TEST_INPUT:-/d3/projects/MET/MET_test_data/unit_test}
run_command "mkdir -p ${MET_TMP_DIR}"
run_command "test/bin/unit_test.sh"

0 comments on commit 53f1c29

Please sign in to comment.