Skip to content

Commit

Permalink
Make testing against reference results easy.
Browse files Browse the repository at this point in the history
Move common macros to root CMakeLists.txt.
  • Loading branch information
jedbrown committed Apr 24, 2009
1 parent ee3bf53 commit a1782ce
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ mark_as_advanced (ARCHIVE_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTP
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Convenience for testing
macro (dohp_link_executable name source)
add_executable (${name} ${source})
target_link_libraries (${name} dohp)
endmacro ()
macro (dohp_add_test name np)
add_test ("${name}" "${Dohp_TestWithReference}" "${PETSC_MPIEXEC}" 2 "${CMAKE_CURRENT_SOURCE_DIR}/${name}.out" ${ARGN})
endmacro()
set (Dohp_TestWithReference "${Dohp_SOURCE_DIR}/TestWithReference.sh")

add_subdirectory (include)
add_subdirectory (src)

Expand Down
17 changes: 17 additions & 0 deletions TestWithReference.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

echo "$*"

mpiexec="$1"
mpi_np="$2"
refout="$3"
name="$4"
shift 4

tmpout="${name}.tmp"
echo PWD: $PWD
echo TMPOUT: $tmpout
echo REFOUT: $refout
"${mpiexec}" -n ${mpi_np} "./${name}" "$@" > "${tmpout}" || exit 1
diff -u ${refout} ${tmpout} || exit 1
rm "${tmpout}"
9 changes: 0 additions & 9 deletions src/fs/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
macro (dohp_link_executable name source)
add_executable (${name} ${source})
target_link_libraries (${name} dohp)
endmacro ()

dohp_link_executable (fs-ex1 ex1.c)
dohp_link_executable (ellip ellip.c)
dohp_link_executable (cellip cellip.c)
# add_executable (ex2 ex2.c)
# target_link_libraries(ex2 ${Dohp_LIBRARIES})
# add_executable (ex3 ex3.c)
#target_link_libraries(ex3 ${Dohp_LIBRARIES})

add_test (fs-mf-projection fs-ex1 -snes_mf -ksp_type minres -const_BDeg 6 -snes_monitor -ksp_converged_reason)
add_test (fs-mf-op-proj-0 fs-ex1 -snes_mf_operator -ksp_type minres -pc_type jacobi -const_BDeg 10 -snes_monitor -ksp_converged_reason
Expand Down
4 changes: 1 addition & 3 deletions src/jacobi/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
add_executable (jacobi-ex1 ex1.c)
target_link_libraries(jacobi-ex1 ${Dohp_LIBRARIES})

dohp_link_executable(jacobi-ex1 ex1.c)
add_test (jacobi1 jacobi-ex1 -min_rdeg 11 -max_rdeg 12 -max_bdeg 11)

0 comments on commit a1782ce

Please sign in to comment.