Skip to content

Commit

Permalink
ATDM: Switch cee-rhel6/environment.sh to keyword matching and strengt…
Browse files Browse the repository at this point in the history
…hen unit tests (ATDV-322, #5939)
  • Loading branch information
bartlettroscoe committed Apr 20, 2020
1 parent c9e95fb commit 2623c40
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 28 deletions.
1 change: 0 additions & 1 deletion cmake/std/atdm/cee-rhel6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ TRIBITS_ADD_ADVANCED_TEST( cee-rhel6_custom_builds_unit_tests
TEST_0 CMND env
ARGS SHUNIT_COLOR=none ${CMAKE_CURRENT_SOURCE_DIR}/custom_builds_unit_tests.sh
PASS_REGULAR_EXPRESSION_ALL
"ERROR: A supported compiler was not selected for 'cee-rhel6' env in buildname 'anything-unsupported-compiler'"
"Ran 1 test"
"[^]OK[$]"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand Down
53 changes: 30 additions & 23 deletions cmake/std/atdm/cee-rhel6/custom_builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,47 @@

# Custom compiler selection logic

if [[ $ATDM_CONFIG_BUILD_NAME == *"clang-9.0.1-openmpi-4.0.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"clang-9.0.1_openmpi-4.0.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"clang-9.0.1"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"clang-9"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"clang"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"default" ]] \
if atdm_match_any_buildname_keyword \
clang-9.0.1-openmpi-4.0.2 \
clang-9.0.1_openmpi-4.0.2 \
clang-9.0.1 \
clang-9 \
clang \
default \
; then
export ATDM_CONFIG_COMPILER=CLANG-9.0.1_OPENMPI-4.0.2
# Must list the default clang build last for correct matching of of defaults
# Must list the default clang build last of all the 'clang' builds for
# correct matching of of defaults

elif [[ $ATDM_CONFIG_BUILD_NAME == *"gnu-7.2.0-openmpi-4.0.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"gnu-7.2.0_openmpi-4.0.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"gnu-7.2.0"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"gnu-7"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"gnu"* ]] \
elif atdm_match_any_buildname_keyword \
gnu-7.2.0-openmpi-4.0.2 \
gnu-7.2.0_openmpi-4.0.2 \
gnu-7.2.0 \
gnu-7 \
gnu \
; then
export ATDM_CONFIG_COMPILER=GNU-7.2.0_OPENMPI-4.0.2
# List default "gnu"* build last for correct matching of defaults
# List default "gnu"* build last of all the 'gnu' builds for correct
# matching of defaults

elif [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18.0.2-mpich2-3.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18.0.2_mpich2-3.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18.0.2"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18"* ]] \
elif atdm_match_any_buildname_keyword \
intel-18.0.2-mpich2-3.2 \
intel-18.0.2_mpich2-3.2 \
intel-18.0.2 \
intel-18 \
; then
export ATDM_CONFIG_COMPILER=INTEL-18.0.2_MPICH2-3.2

elif [[ $ATDM_CONFIG_BUILD_NAME == *"intel-19.0.3-intelmpi-2018.4"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel-19.0.3_intelmpi-2018.4"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel-19.0.3"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel-19"* ]] \
|| [[ $ATDM_CONFIG_BUILD_NAME == *"intel"* ]] \
elif atdm_match_any_buildname_keyword \
intel-19.0.3-intelmpi-2018.4 \
intel-19.0.3_intelmpi-2018.4 \
intel-19.0.3 \
intel-19 \
intel \
; then
export ATDM_CONFIG_COMPILER=INTEL-19.0.3_INTELMPI-2018.4
# List default "intel"* build last for correct matching!
# List default intel build last of all the 'intel' builds for correct
# matching!

else
echo
Expand Down
36 changes: 32 additions & 4 deletions cmake/std/atdm/cee-rhel6/custom_builds_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ testAll() {
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} CLANG-9.0.1_OPENMPI-4.0.2

ATDM_CONFIG_BUILD_NAME=default-after
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} CLANG-9.0.1_OPENMPI-4.0.2

ATDM_CONFIG_BUILD_NAME=before-clang-9.0.1-openmpi-4.0.2_after
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} CLANG-9.0.1_OPENMPI-4.0.2
Expand Down Expand Up @@ -56,6 +60,16 @@ testAll() {
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} GNU-7.2.0_OPENMPI-4.0.2

# Check that 'gnus' does not match 'gnu'! (Shows true keyword matching is
# working)
ATDM_CONFIG_BUILD_NAME=before_gnus-after
STDOUT=$(. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh 2>&1)
GREP_LINE=$(echo "${STDOUT}" | grep "ERROR: A supported compiler was not selected")
GREP_LINE_EXPECTED="*** ERROR: A supported compiler was not selected for 'cee-rhel6' env in buildname 'before_gnus-after'"
#echo "GREP_LINE = [${GREP_LINE}]"
echo "GREP_LINE_EXPECTED = [${GREP_LINE_EXPECTED}]"
${_ASSERT_EQUALS_} '"${GREP_LINE}"' '"${GREP_LINE_EXPECTED}"'

ATDM_CONFIG_BUILD_NAME=before_intel-18.0.2-mpich2-3.2-after
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} INTEL-18.0.2_MPICH2-3.2
Expand Down Expand Up @@ -92,10 +106,24 @@ testAll() {
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} INTEL-19.0.3_INTELMPI-2018.4

# Run the error case
ATDM_CONFIG_BUILD_NAME=anything-unsupported-compiler
. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh
${_ASSERT_EQUALS_} ${ATDM_CONFIG_COMPILER} DEFAULT
# Check that 'somethingintel' does not match 'intl'! (Shows true keyword
# matching is working)
ATDM_CONFIG_BUILD_NAME=somethingintel
STDOUT=$(. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh 2>&1)
GREP_LINE=$(echo "${STDOUT}" | grep "ERROR: A supported compiler was not selected")
GREP_LINE_EXPECTED="*** ERROR: A supported compiler was not selected for 'cee-rhel6' env in buildname 'somethingintel'"
#echo "GREP_LINE = [${GREP_LINE}]"
echo "GREP_LINE_EXPECTED = [${GREP_LINE_EXPECTED}]"
${_ASSERT_EQUALS_} '"${GREP_LINE}"' '"${GREP_LINE_EXPECTED}"'

# Check that missing compiler prints right error messagematch 'gnu'!
ATDM_CONFIG_BUILD_NAME=help
STDOUT=$(. ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh 2>&1)
GREP_LINE=$(echo "${STDOUT}" | grep "ERROR: A supported compiler was not selected")
GREP_LINE_EXPECTED="*** ERROR: A supported compiler was not selected for 'cee-rhel6' env in buildname 'help'"
#echo "GREP_LINE = [${GREP_LINE}]"
echo "GREP_LINE_EXPECTED = [${GREP_LINE_EXPECTED}]"
${_ASSERT_EQUALS_} '"${GREP_LINE}"' '"${GREP_LINE_EXPECTED}"'

}

Expand Down

0 comments on commit 2623c40

Please sign in to comment.