Skip to content

Commit

Permalink
Correct String FIND for runTest and grepTest (#4022)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Feb 15, 2024
1 parent 7392a10 commit bdddf43
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 28 deletions.
17 changes: 12 additions & 5 deletions HDF5Examples/config/cmake/grepTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}")
message (STATUS "COMMAND Error: ${TEST_ERROR}")

# remove special output
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}")
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
endif ()

# if the TEST_ERRREF exists grep the error output with the error reference
Expand Down
19 changes: 13 additions & 6 deletions HDF5Examples/config/cmake/runTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,18 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")

# remove special output
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}")
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
endif ()

# remove special error output
Expand All @@ -148,7 +155,7 @@ else ()
# the error stack remains in the .err file
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
endif ()
string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT)
string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
# write back the changes to the original files
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/HDF5UseFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ string (REGEX REPLACE "}" "" OUT_VAR2 ${OUT_VAR2})
set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR2}/)")

# Setting definition if there is a 16 byte fortran integer
string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos)
string (FIND "${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}" "16" pos)
if (${pos} EQUAL -1)
set (${HDF_PREFIX}_HAVE_Fortran_INTEGER_SIZEOF_16 0)
else ()
Expand Down
17 changes: 12 additions & 5 deletions config/cmake/grepTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}")
message (STATUS "COMMAND Error: ${TEST_ERROR}")

# remove special output
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}")
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
endif ()

# if the TEST_ERRREF exists grep the error output with the error reference
Expand Down
24 changes: 13 additions & 11 deletions config/cmake/runTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,18 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")

# remove special output
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
endif ()
string (FIND TEST_STREAM "ulimit -s" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*ulimit -s.*\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}")
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
endif ()
string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
endif ()
endif ()

# remove special error output
Expand All @@ -153,7 +155,7 @@ else ()
# the error stack remains in the .err file
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
endif ()
string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT)
string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
# write back the changes to the original files
Expand Down

0 comments on commit bdddf43

Please sign in to comment.