Commit 58bce8f5 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files

CMake no longer copies xmls during build time, now symlinks during test time

parent 9a2c5bf7
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -82,13 +82,6 @@ function(make_obj_unit_test moduleName testFile truthFile reqLibs pluginLibs)
  # Generate a name for the executable
  set(executableName "${moduleName}_unit_test_${filename}")

  # check for the existance of a unitTest.xml as they need
  # to be copies over to somehwere the unitTest can access.
  set(test_xml "${folder}/unitTest.xml")
  if(EXISTS "${test_xml}")
    configure_file("${test_xml}" "${CMAKE_BINARY_DIR}/unitTest/${executableName}.xml" COPYONLY)
  endif()

  # Create the executable and link it to the module library
  add_executable( ${executableName} ${testFile})
  set(depLibs "${reqLibs};${matchedLibs}")
+11 −9
Original line number Diff line number Diff line
@@ -24,16 +24,18 @@ get_filename_component(truthFolder ${TRUTH_FILE} DIRECTORY)
get_filename_component(binFolder ${TEST_PROG} DIRECTORY)
get_filename_component(binName   ${TEST_PROG} NAME)

set(tempDir  ${binFolder}/${binName}_temp)
set(tempLink ${tempDir}/unitTest)
execute_process(COMMAND rm -rf ${tempDir})
execute_process(COMMAND mkdir -p ${tempDir})
execute_process(COMMAND ln -s ${TEST_PROG} ${tempLink})
execute_process(COMMAND ln -s ${truthFolder}/unitTest.xml ${tempDir}/unitTest.xml)
execute_process(COMMAND ln -s ${truthFolder}/unitTest.xml ${truthFolder}/${binName}.xml)

message("TEMP DIR: ${tempDir}")
message("Bin Name: ${binName}")
message("Bin Folder: ${binFolder}")
message("TEST_PROG: ${TEST_PROG}")
message("tempLink: " ${tempLink})
message("truthFolder" ${truthFolder})

# Run the unit test executable and pipe the output to a text file.
#execute_process(COMMAND ${TEST_PROG}
execute_process(COMMAND ${tempLink}
execute_process(COMMAND ${TEST_PROG}
                WORKING_DIRECTORY ${truthFolder}
                OUTPUT_FILE ${outputFile}
                ERROR_FILE ${outputFile}
@@ -69,8 +71,8 @@ if(DIFFERENT)
    message(FATAL_ERROR "Test failed - files differ")
    # On error the result file is left around to aid in debugging.
else()
  file(REMOVE ${outputFile}) # On success, clean out the result file.
  # file(REMOVE ${outputFile}) # On success, clean out the result file.
endif()

# Clean up our temporary folder
execute_process(COMMAND rm -f ${tempDir})
execute_process(COMMAND rm -f ${truthFolder}/${binName}.xml)