run_testsuite Subroutine

public subroutine run_testsuite(collect, unit, stat, parallel)

Driver for testsuite

Arguments

Type IntentOptional Attributes Name
procedure(collect_interface) :: collect

Collect tests

integer, intent(in) :: unit

Unit for IO

integer, intent(inout) :: stat

Number of failed tests

logical, intent(in), optional :: parallel

Run tests in parallel


Source Code

subroutine run_testsuite(collect, unit, stat, parallel)

   !> Collect tests
   procedure(collect_interface) :: collect

   !> Unit for IO
   integer, intent(in) :: unit

   !> Number of failed tests
   integer, intent(inout) :: stat

   !> Run tests in parallel
   logical, intent(in), optional :: parallel

   type(unittest_type), allocatable :: testsuite(:)
   logical :: parallelize
   integer :: ii

   parallelize = .false.
   if (present(parallel)) parallelize = parallel

   call collect(testsuite)

   !$omp parallel do shared(testsuite, unit) reduction(+:stat) if(parallelize)
   do ii = 1, size(testsuite)
      !$omp critical(mctc_env_testsuite)
      write(unit, '(1x, 3(1x, a), 1x, "(", i0, "/", i0, ")")') &
         & "Starting", testsuite(ii)%name, "...", ii, size(testsuite)
      !$omp end critical(mctc_env_testsuite)
      call run_unittest(testsuite(ii), unit, stat)
   end do

end subroutine run_testsuite