hypre/src/test/TEST_ij/versioncheck.sh
Rob Falgout 408f361bd0
Add HYPRE_DEVELOP variables (#472)
This commit introduces three new variables to the 'HYPRE_config' file through both the autoconf and CMake builds. They are defined only when there is a '.git' directory present, and are otherwise left undefined.  These new variables may help users who work directly with the development branch of hypre to keep their code current and backward compatible with previous releases and also individual commits between those releases.  The new variables are:

HYPRE_DEVELOP_STRING - a string created from the 'git describe' command that indicates the last release tag, the number of commits beyond that last release, and the corresponding commit hash.
HYPRE_DEVELOP_NUMBER - the number of commits since the last release.
HYPRE_DEVELOP_BRANCH - defined only if the main development branch is being used, and is set to the name of that branch (currently master).

The commit also adds runtime regression tests for the variables in the 'src/test' directory.
2021-09-20 20:05:58 -07:00

34 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
TNAME=`basename $0 .sh`
#=============================================================================
# Check the HYPRE_DEVELOP variables
#=============================================================================
grep "Using HYPRE_DEVELOP_STRING" ${TNAME}.out.1 > ${TNAME}.testdata
if [ -d ../../../.git ]; then
DEVSTRING=`git describe --match 'v*' --long --abbrev=9`
DEVNUMBER=`echo $DEVSTRING | awk -F- '{print $2}'`
DEVBRANCH=`git rev-parse --abbrev-ref HEAD`
if [ -n "$DEVBRANCH" ]; then
echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (not main development branch)" \
> ${TNAME}.testdatacheck
else
echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (main development branch $DEVBRANCH)" \
> ${TNAME}.testdatacheck
fi
fi
diff ${TNAME}.testdata ${TNAME}.testdatacheck >&2
#=============================================================================
# remove temporary files
#=============================================================================
rm -f ${TNAME}.testdata*