Commit e8700178 authored by Brad King's avatar Brad King

ENH: Added test for make install.

parent f187f827
.git* export-ignore
*.sh.in crlf=input
newalpha crlf=input
newversion crlf=input
......@@ -53,3 +53,12 @@ IF(PYTHON_EXECUTABLE)
vtkWinCE.h
)
ENDIF(PYTHON_EXECUTABLE)
IF(UNIX)
IF("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${VTK_BINARY_DIR}/TestInstall$")
CONFIGURE_FILE(${VTK_SOURCE_DIR}/Common/Testing/Install/test.sh.in
${VTK_BINARY_DIR}/Common/Testing/Install/test.sh @ONLY
IMMEDIATE)
ADD_TEST(Install /bin/sh ${VTK_BINARY_DIR}/Common/Testing/Install/test.sh)
ENDIF("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${VTK_BINARY_DIR}/TestInstall$")
ENDIF(UNIX)
PROJECT(VIT)
INCLUDE(${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF(VTK_FOUND)
INCLUDE("${VTK_USE_FILE}")
ADD_EXECUTABLE(vit vit.cxx)
TARGET_LINK_LIBRARIES(vit vtkCommon)
ELSE(VTK_FOUND)
MESSAGE(SEND_ERROR "VTK not found!")
ENDIF(VTK_FOUND)
#!/bin/sh
CMAKE_COMMAND="@CMAKE_COMMAND@"
VTK_SOURCE_DIR="@VTK_SOURCE_DIR@"
VTK_BINARY_DIR="@VTK_BINARY_DIR@"
CMAKE_INSTALL_PREFIX="@CMAKE_INSTALL_PREFIX@"
CMAKE_MAKE_PROGRAM="@CMAKE_MAKE_PROGRAM@"
VTK_EXE_DIR="@EXECUTABLE_OUTPUT_PATH@"
SOURCE_DIR="${VTK_SOURCE_DIR}/Common/Testing/Install"
BINARY_DIR="${VTK_BINARY_DIR}/Common/Testing/Install"
trap cleanup 1 2 3 6
cleanup()
{
if [ -d "${VTK_EXE_DIR}-InstallTestTemp" ]; then
mv "${VTK_EXE_DIR}-InstallTestTemp" "${VTK_EXE_DIR}"
fi
exit 1
}
install()
{
echo "Erasing ${CMAKE_INSTALL_PREFIX}" &&
([ ! -d "${CMAKE_INSTALL_PREFIX}"] || rm -rf "${CMAKE_INSTALL_PREFIX}") &&
mkdir -p "${CMAKE_INSTALL_PREFIX}" &&
echo "Running make install" &&
(
cd "${VTK_BINARY_DIR}" &&
"${CMAKE_MAKE_PROGRAM}" install
)
}
setup()
{
echo "Entering ${BINARY_DIR}" &&
cd "${BINARY_DIR}"
}
write_cache()
{
install || return 1
setup || return 1
echo "Writing CMakeCache.txt"
(
cat > CMakeCache.txt <<EOF
VTK_DIR:FILEPATH=${CMAKE_INSTALL_PREFIX}/lib/vtk
EOF
)
}
run_cmake()
{
write_cache || return 1
echo "Running CMake"
"${CMAKE_COMMAND}" "${SOURCE_DIR}"
}
run_make()
{
run_cmake || return 1
echo "Running ${CMAKE_MAKE_PROGRAM}"
"${CMAKE_MAKE_PROGRAM}"
}
run_test()
{
mv "${VTK_EXE_DIR}" "${VTK_EXE_DIR}-InstallTestTemp"
echo "Running ${BINARY_DIR}/vit"
(
"${BINARY_DIR}/vit"
)
result="$?"
mv "${VTK_EXE_DIR}-InstallTestTemp" "${VTK_EXE_DIR}/bin"
return $result
}
run_make && run_test
#include "vtkObject.h"
int main()
{
vtkObject::New()->Delete();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment