summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GoogleTest/GoogleTestXML-special-result-check.cmake
blob: fea0a6bc09dce766b4b70157b3f6f1026adcd5d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
set(RESULT_FILES
  "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/cases.case/0.xml"
  "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/cases.case/1.xml"
  "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/cases.case/2.xml"
)

# Check result files exist
foreach(file ${RESULT_FILES})
  if(NOT EXISTS ${file})
    if(NOT ${RunCMake_TEST_FAILED} STREQUAL "")
      set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n")
    endif()
    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}Result XML file ${file} was not created")
  endif()
endforeach()

# and no other xml files are created
file(GLOB_RECURSE file_list "${RunCMake_TEST_BINARY_DIR}/GoogleTestXMLSpecial/*/*.xml" LIST_DIRECTORIES false)

foreach(file ${file_list})
  list(FIND RESULT_FILES "${file}" idx)
  if(-1 EQUAL ${idx})
    if(NOT ${RunCMake_TEST_FAILED} STREQUAL "")
      set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n")
    endif()
    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}Invalid file ${file} was created")
  endif()
endforeach()