2012-10-05 02:57:32 +04:00
|
|
|
|
|
|
|
set(MODULE_NAME "TestFile")
|
|
|
|
set(MODULE_PREFIX "TEST_FILE")
|
|
|
|
|
|
|
|
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
|
|
|
|
|
|
|
set(${MODULE_PREFIX}_TESTS
|
|
|
|
TestFileCreateFile.c
|
|
|
|
TestFileDeleteFile.c
|
|
|
|
TestFileReadFile.c
|
2012-10-19 00:58:27 +04:00
|
|
|
TestFileWriteFile.c
|
2012-11-03 23:13:13 +04:00
|
|
|
TestFilePatternMatch.c
|
2012-10-19 00:58:27 +04:00
|
|
|
TestFileFindFirstFile.c
|
|
|
|
TestFileFindFirstFileEx.c
|
2015-09-09 17:47:03 +03:00
|
|
|
TestFileFindNextFile.c
|
|
|
|
TestFileGetStdHandle.c
|
|
|
|
)
|
2012-10-05 02:57:32 +04:00
|
|
|
|
|
|
|
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
|
|
|
${${MODULE_PREFIX}_DRIVER}
|
|
|
|
${${MODULE_PREFIX}_TESTS})
|
|
|
|
|
|
|
|
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
target_link_libraries(${MODULE_NAME} winpr)
|
2012-10-05 02:57:32 +04:00
|
|
|
|
2012-10-18 23:37:00 +04:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
|
|
|
|
2012-10-19 05:11:12 +04:00
|
|
|
if(NOT MSVC)
|
|
|
|
set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME}Area")
|
|
|
|
else()
|
|
|
|
set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${MODULE_NAME}Area")
|
|
|
|
endif()
|
2012-10-19 00:58:27 +04:00
|
|
|
|
2012-10-19 05:11:12 +04:00
|
|
|
file(MAKE_DIRECTORY "${TEST_AREA}")
|
2012-10-19 00:58:27 +04:00
|
|
|
file(WRITE "${TEST_AREA}/TestFile1" "TestFile1")
|
|
|
|
file(WRITE "${TEST_AREA}/TestFile2" "TestFile2")
|
|
|
|
file(WRITE "${TEST_AREA}/TestFile3" "TestFile3")
|
|
|
|
file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory1")
|
|
|
|
file(WRITE "${TEST_AREA}/TestDirectory1/TestDirectory1File1" "TestDirectory1File1")
|
|
|
|
file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory2")
|
|
|
|
file(WRITE "${TEST_AREA}/TestDirectory2/TestDirectory2File1" "TestDirectory2File1")
|
|
|
|
file(WRITE "${TEST_AREA}/TestDirectory2/TestDirectory2File2" "TestDirectory2File2")
|
|
|
|
file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory3")
|
|
|
|
file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File1" "TestDirectory3File1")
|
|
|
|
file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File2" "TestDirectory3File2")
|
|
|
|
file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File3" "TestDirectory3File3")
|
|
|
|
|
2012-10-05 02:57:32 +04:00
|
|
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
|
|
|
get_filename_component(TestName ${test} NAME_WE)
|
2012-10-19 00:58:27 +04:00
|
|
|
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName} ${TEST_AREA})
|
2012-10-05 02:57:32 +04:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|