Skip to content

Build testing #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ endif()
include(GNUInstallDirs)

add_subdirectory(lib)
if(NOT BUILD_EXPORTED_TARGETS_ONLY)
include(CTest) # note: this adds a BUILD_TESTING which defaults to ON
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
Expand Down
9 changes: 6 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ You can influence the configuration via CMake-variables, which are listed in
`config.cmake <config.cmake>`_. You can either modify the values directly there
or pass them as command line options at the configuration phase, e.g.::

FC=ifort cmake -B _build -DBUILD_LIBRARY_ONLY=True
FC=ifort cmake -B _build -DBUILD_TESTING=NO .


Testing
-------

A few tests / usage examples can be found in the `test/` subdirectory. The
compiled test programs will be in the `test/` subfolder of your build directory.
A few tests / usage examples can be found in the `test/` subdirectory,
a sub-set of which can be checked with ctest. The compiled test
programs will be in the `test/` subfolder of your build directory.

To disable building tests, include the cmake option -DBUILD_TESTING=OFF


Using the library
Expand Down
18 changes: 9 additions & 9 deletions test/test_allgather.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ program test_allgather
write(formstr, "(A,I0,A)") "A,", size(recv1), "(1X,I0))"
write(*, label // formstr) 2, mycomm%rank, "Recv1 buffer:", recv1(:)
if (sum(recv1) /= mycomm%size * (mycomm%size-1)) then
tPassed = .false.
isPassed = .false.
else
tPassed = .true.
isPassed = .true.
end if
call testReturn(mycomm, tPassed)
call testReturn(mycomm, isPassed)
deallocate(recv1)

! I1 -> I1
Expand All @@ -42,11 +42,11 @@ program test_allgather
write(formstr, "(A,I0,A)") "A,", size(recv1), "(1X,I0))"
write(*, label // formstr) 4, mycomm%rank, "Recv1 buffer:", recv1
if (sum(recv1) /= mycomm%size**2) then
tPassed = .false.
isPassed = .false.
else
tPassed = .true.
isPassed = .true.
end if
call testReturn(mycomm, tPassed)
call testReturn(mycomm, isPassed)

! I1 -> I2
allocate(recv2(size(send1), mycomm%size))
Expand All @@ -58,11 +58,11 @@ program test_allgather
write(formstr, "(A,I0,A)") "A,", size(recv2), "(1X,I0))"
write(*, label // formstr) 6, mycomm%rank, "Recv2 buffer:", recv2
if (sum(recv1) /= mycomm%size**2) then
tPassed = .false.
isPassed = .false.
else
tPassed = .true.
isPassed = .true.
end if
call testReturn(mycomm, tPassed)
call testReturn(mycomm, isPassed)

call mpifx_finalize()

Expand Down