Convert path to test inputs folder to native syntax on windows to make tests with file copying portable.

This commit is contained in:
Axel Kohlmeyer
2022-08-06 22:46:52 -04:00
parent 0f68aa80fe
commit 42594bbbb7
3 changed files with 8 additions and 6 deletions

View File

@ -36,7 +36,11 @@ if(Python_EXECUTABLE)
COMMENT "Check completeness of force style tests") COMMENT "Check completeness of force style tests")
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
string(REPLACE "/" "\\\\" TEST_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/tests")
else()
set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests) set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests)
endif()
add_library(style_tests STATIC yaml_writer.cpp error_stats.cpp test_config_reader.cpp test_main.cpp) add_library(style_tests STATIC yaml_writer.cpp error_stats.cpp test_config_reader.cpp test_main.cpp)
if(YAML_FOUND) if(YAML_FOUND)
target_compile_definitions(style_tests PRIVATE TEST_INPUT_FOLDER=${TEST_INPUT_FOLDER}) target_compile_definitions(style_tests PRIVATE TEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})

View File

@ -10,8 +10,7 @@ pre_commands: ! |
variable units index real variable units index real
variable newton_pair delete variable newton_pair delete
variable newton_pair index on variable newton_pair index on
if $(is_os(^Windows)) then "variable copycmd string copy" else "variable copycmd string cp" if $(is_os(^Windows)) then "shell copy ${input_dir}\table_CG_CG_CG.txt ." else "shell cp ${input_dir}/table_CG_CG_CG.txt ."
shell ${copycmd} ${input_dir}/table_CG_CG_CG.txt .
post_commands: ! "" post_commands: ! ""
input_file: in.metal input_file: in.metal
pair_style: hybrid/overlay table linear 1200 sw/angle/table pair_style: hybrid/overlay table linear 1200 sw/angle/table

View File

@ -10,9 +10,8 @@ pre_commands: ! |
variable units index real variable units index real
variable newton_pair delete variable newton_pair delete
variable newton_pair index on variable newton_pair index on
if $(is_os(^Windows)) then "variable copycmd string copy" else "variable copycmd string cp" if $(is_os(^Windows)) then "shell copy ${input_dir}\1-1-1.table ." else "shell cp ${input_dir}/1-1-1.table ."
shell ${copycmd} ${input_dir}/1-1-1.table . if $(is_os(^Windows)) then "shell copy ${input_dir}\1-1-2.table ." else "shell cp ${input_dir}/1-1-2.table ."
shell ${copycmd} ${input_dir}/1-1-2.table .
post_commands: ! "" post_commands: ! ""
input_file: in.metal input_file: in.metal
pair_style: hybrid/overlay table linear 1200 threebody/table pair_style: hybrid/overlay table linear 1200 threebody/table