diff --git a/AUTOTEST/runtests-struct b/AUTOTEST/runtests-struct index 0d28db497..ac43572dc 100644 --- a/AUTOTEST/runtests-struct +++ b/AUTOTEST/runtests-struct @@ -1,2 +1 @@ -TEST_struct/[^b]*.sh - +TEST_struct/*.sh diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96a9c1fe8..4aea9062f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,6 +28,30 @@ if (${HYPRE_SOURCE_DIR} STREQUAL ${HYPRE_BINARY_DIR}) message(FATAL_ERROR "In-place build not allowed! Please use a separate build directory. See the Users Manual or INSTALL file for details.") endif () +if (EXISTS ${HYPRE_SOURCE_DIR}/../.git) + execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} describe --match v* --long --abbrev=9 + OUTPUT_VARIABLE develop_string + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} describe --match v* --abbrev=0 + OUTPUT_VARIABLE develop_lastag + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} rev-list --count ${develop_lastag}..HEAD + OUTPUT_VARIABLE develop_number + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE develop_branch + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(HYPRE_DEVELOP_STRING ${develop_string}) + set(HYPRE_DEVELOP_NUMBER ${develop_number}) + if (develop_branch MATCHES "master") + set(HYPRE_DEVELOP_BRANCH ${develop_branch}) + else () + message(STATUS "NOTE: On branch ${develop_branch}, not the main development branch") + endif () +else () + message(STATUS "NOTE: Could not find .git directory") +endif () + # Set cmake module path set(CMAKE_MODULE_PATH "${HYPRE_SOURCE_DIR}/config/cmake" "${CMAKE_MODULE_PATH}") include(HYPRE_CMakeUtilities) diff --git a/src/config/HYPRE_config.h.cmake.in b/src/config/HYPRE_config.h.cmake.in index a2ae68e20..86006a16b 100644 --- a/src/config/HYPRE_config.h.cmake.in +++ b/src/config/HYPRE_config.h.cmake.in @@ -12,6 +12,10 @@ #define HYPRE_RELEASE_TIME "@HYPRE_TIME@" #define HYPRE_RELEASE_BUGS "@HYPRE_BUGS@" +#cmakedefine HYPRE_DEVELOP_STRING "@HYPRE_DEVELOP_STRING@" +#cmakedefine HYPRE_DEVELOP_NUMBER @HYPRE_DEVELOP_NUMBER@ +#cmakedefine HYPRE_DEVELOP_BRANCH "@HYPRE_DEVELOP_BRANCH@" + /* Use long long int for HYPRE_BigInt */ #cmakedefine HYPRE_MIXEDINT 1 diff --git a/src/config/HYPRE_config.h.in b/src/config/HYPRE_config.h.in index 98425a654..7ac425810 100644 --- a/src/config/HYPRE_config.h.in +++ b/src/config/HYPRE_config.h.in @@ -62,6 +62,15 @@ /* Define to 1 if in debug mode */ #undef HYPRE_DEBUG +/* Main development branch? */ +#undef HYPRE_DEVELOP_BRANCH + +/* Develop branch commit number */ +#undef HYPRE_DEVELOP_NUMBER + +/* Develop branch string */ +#undef HYPRE_DEVELOP_STRING + /* Define to 1 if using OpenMP on device [target alloc version] */ #undef HYPRE_DEVICE_OPENMP_ALLOC diff --git a/src/config/configure.in b/src/config/configure.in index 75908c852..c7e02bf83 100644 --- a/src/config/configure.in +++ b/src/config/configure.in @@ -105,6 +105,20 @@ AC_SUBST(HYPRE_BUGS) AC_SUBST(HYPRE_SRCDIR) +AC_CHECK_FILE([$HYPRE_SRCDIR/../.git], + [develop_string=$(git -C $HYPRE_SRCDIR describe --match 'v*' --long --abbrev=9) + develop_lastag=$(git -C $HYPRE_SRCDIR describe --match 'v*' --abbrev=0) + develop_number=$(git -C $HYPRE_SRCDIR rev-list --count $develop_lastag..HEAD) + develop_branch=$(git -C $HYPRE_SRCDIR rev-parse --abbrev-ref HEAD) + AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_STRING, ["$develop_string"], [Develop branch string]) + AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_NUMBER, [$develop_number], [Develop branch commit number]) + AS_IF([test "x$develop_branch" = "xmaster"], + [AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_BRANCH, ["$develop_branch"], [Main development branch?])], + [AC_MSG_NOTICE([NOTE: On branch $develop_branch, not the main development branch])] + )], + [AC_MSG_NOTICE([NOTE: Could not find .git directory])] +) + dnl ********************************************************************* dnl * Clear variables defined by AC_INIT to avoid name conflicts with dnl * other packages. diff --git a/src/configure b/src/configure index d1fa2adaf..53b4fd6d2 100755 --- a/src/configure +++ b/src/configure @@ -2683,6 +2683,56 @@ _ACEOF +as_ac_File=`$as_echo "ac_cv_file_$HYPRE_SRCDIR/../.git" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $HYPRE_SRCDIR/../.git" >&5 +$as_echo_n "checking for $HYPRE_SRCDIR/../.git... " >&6; } +if eval \${$as_ac_File+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "$HYPRE_SRCDIR/../.git"; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + develop_string=$(git -C $HYPRE_SRCDIR describe --match 'v*' --long --abbrev=9) + develop_lastag=$(git -C $HYPRE_SRCDIR describe --match 'v*' --abbrev=0) + develop_number=$(git -C $HYPRE_SRCDIR rev-list --count $develop_lastag..HEAD) + develop_branch=$(git -C $HYPRE_SRCDIR rev-parse --abbrev-ref HEAD) + +cat >>confdefs.h <<_ACEOF +#define HYPRE_DEVELOP_STRING "$develop_string" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HYPRE_DEVELOP_NUMBER $develop_number +_ACEOF + + if test "x$develop_branch" = "xmaster"; then : + +cat >>confdefs.h <<_ACEOF +#define HYPRE_DEVELOP_BRANCH "$develop_branch" +_ACEOF + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: On branch $develop_branch, not the main development branch" >&5 +$as_echo "$as_me: NOTE: On branch $develop_branch, not the main development branch" >&6;} + +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: Could not find .git directory" >&5 +$as_echo "$as_me: NOTE: Could not find .git directory" >&6;} + +fi + + PACKAGE_DATE= PACKAGE_TIME= PACKAGE_DATETIME= diff --git a/src/test/TEST_ij/versioncheck.jobs b/src/test/TEST_ij/versioncheck.jobs new file mode 100755 index 000000000..76e9f943d --- /dev/null +++ b/src/test/TEST_ij/versioncheck.jobs @@ -0,0 +1,12 @@ +#!/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) + +#============================================================================= +# Check the version header file variables +#============================================================================= + +mpirun -np 1 ./ij > versioncheck.out.1 + diff --git a/src/test/TEST_ij/versioncheck.sh b/src/test/TEST_ij/versioncheck.sh new file mode 100755 index 000000000..388267fe6 --- /dev/null +++ b/src/test/TEST_ij/versioncheck.sh @@ -0,0 +1,33 @@ +#!/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* diff --git a/src/test/TEST_sstruct/versioncheck.jobs b/src/test/TEST_sstruct/versioncheck.jobs new file mode 100755 index 000000000..9b6e99d2b --- /dev/null +++ b/src/test/TEST_sstruct/versioncheck.jobs @@ -0,0 +1,12 @@ +#!/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) + +#============================================================================= +# Check the version header file variables +#============================================================================= + +mpirun -np 1 ./sstruct > versioncheck.out.1 + diff --git a/src/test/TEST_sstruct/versioncheck.sh b/src/test/TEST_sstruct/versioncheck.sh new file mode 100755 index 000000000..388267fe6 --- /dev/null +++ b/src/test/TEST_sstruct/versioncheck.sh @@ -0,0 +1,33 @@ +#!/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* diff --git a/src/test/TEST_struct/versioncheck.jobs b/src/test/TEST_struct/versioncheck.jobs new file mode 100755 index 000000000..52a55dcf1 --- /dev/null +++ b/src/test/TEST_struct/versioncheck.jobs @@ -0,0 +1,12 @@ +#!/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) + +#============================================================================= +# Check the version header file variables +#============================================================================= + +mpirun -np 1 ./struct > versioncheck.out.1 + diff --git a/src/test/TEST_struct/versioncheck.sh b/src/test/TEST_struct/versioncheck.sh new file mode 100755 index 000000000..388267fe6 --- /dev/null +++ b/src/test/TEST_struct/versioncheck.sh @@ -0,0 +1,33 @@ +#!/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* diff --git a/src/test/ij.c b/src/test/ij.c index 923283dc8..4b7e3aa74 100644 --- a/src/test/ij.c +++ b/src/test/ij.c @@ -2194,6 +2194,15 @@ main( hypre_int argc, if (myid == 0) { +#ifdef HYPRE_DEVELOP_STRING +#ifdef HYPRE_DEVELOP_BRANCH + hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (main development branch %s)\n\n", + HYPRE_DEVELOP_STRING, HYPRE_DEVELOP_BRANCH); +#else + hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (not main development branch)\n\n", + HYPRE_DEVELOP_STRING); +#endif +#endif hypre_printf("Running with these driver parameters:\n"); hypre_printf(" solver ID = %d\n\n", solver_id); } diff --git a/src/test/sstruct.c b/src/test/sstruct.c index d327f709c..0106f1cc1 100644 --- a/src/test/sstruct.c +++ b/src/test/sstruct.c @@ -2812,8 +2812,18 @@ main( hypre_int argc, /*----------------------------------------------------------- * Print driver parameters TODO *-----------------------------------------------------------*/ + if (myid == 0) { +#ifdef HYPRE_DEVELOP_STRING +#ifdef HYPRE_DEVELOP_BRANCH + hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (main development branch %s)\n\n", + HYPRE_DEVELOP_STRING, HYPRE_DEVELOP_BRANCH); +#else + hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (not main development branch)\n\n", + HYPRE_DEVELOP_STRING); +#endif +#endif } /*----------------------------------------------------------- diff --git a/src/test/struct.c b/src/test/struct.c index 2d6ad28ce..8d0686b8c 100644 --- a/src/test/struct.c +++ b/src/test/struct.c @@ -681,6 +681,15 @@ main( hypre_int argc, if (myid == 0 && sum == 0) { +#ifdef HYPRE_DEVELOP_STRING +#ifdef HYPRE_DEVELOP_BRANCH + hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (main development branch %s)\n\n", + HYPRE_DEVELOP_STRING, HYPRE_DEVELOP_BRANCH); +#else + hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (not main development branch)\n\n", + HYPRE_DEVELOP_STRING); +#endif +#endif hypre_printf("Running with these driver parameters:\n"); hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); hypre_printf(" (istart[0],istart[1],istart[2]) = (%d, %d, %d)\n", \