mcnptools icon indicating copy to clipboard operation
mcnptools copied to clipboard

test files not working on windows

Open kermitnuc opened this issue 1 year ago • 5 comments

The run_test_compare.cmake files for meshtal2vtk and l3d2vtk do not seem to work correctly on windows machines.

I propose the following to fix this issue:

For the meshtal2vtk file change:foreach(OUTFILE ${OUTFILES})

Convert line endings to be consistent

configure_file("${OUTFILE}" "${OUTFILE}.unix" NEWLINE_STYLE LF)

get_filename_component(outfile_baseline "${OUTFILE}" NAME) execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files "${CMAKE_CURRENT_BINARY_DIR}/${OUTFILE}.unix" "${baselinedir}/${outfile_baseline}" RESULT_VARIABLE out_failed ) if ( out_failed ) message(SEND_ERROR "output .vts files do not match") endif ( out_failed ) endforeach()

to

foreach(OUTFILE ${OUTFILES})

Convert line endings to be consistent

configure_file("${OUTFILE}" "${OUTFILE}.unix" NEWLINE_STYLE LF)

get_filename_component(outfile_baseline "${OUTFILE}" NAME) execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol "${CMAKE_CURRENT_BINARY_DIR}/${OUTFILE}" "${baselinedir}/${outfile_baseline}" RESULT_VARIABLE out_failed ) if ( out_failed ) message(SEND_ERROR "output .vts files do not match") endif ( out_failed ) endforeach()

compare_files now understands that unix and windows have different line endings since the "--ignore-eol". Then the configure_file command is un-nesessary. There maybe an issue with needing complete file names to make compare_files work correctly on some windows machines.

For the l3d2vtk run_test_compare.cmake file: replace this

Convert line endings to be consistent

configure_file("${l3d2vtk_output}" "${l3d2vtk_output}.unix" NEWLINE_STYLE LF)

execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol "${l3d2vtk_output}.unix" "${baselinedir}/${l3d2vtk_output}" RESULT_VARIABLE out_failed )

with

Convert line endings to be consistent

configure_file("${l3d2vtk_output}" "${l3d2vtk_output}.unix" NEWLINE_STYLE LF)

execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol

"${l3d2vtk_output}.unix"

"${CMAKE_CURRENT_BINARY_DIR}/${l3d2vtk_output}"
"${baselinedir}/${l3d2vtk_output}"

RESULT_VARIABLE out_failed )

Same reasons as above.

Kermit Bunde

kermitnuc avatar Mar 30 '23 15:03 kermitnuc