test_handle_PrefetchData Subroutine

public subroutine test_handle_PrefetchData()

Arguments

None

Calls

proc~~test_handle_prefetchdata~~CallsGraph proc~test_handle_prefetchdata test_handle_PrefetchData assertequal assertequal proc~test_handle_prefetchdata->assertequal none~add_message MockSocket%add_message proc~test_handle_prefetchdata->none~add_message none~init~2 ServerThread%init proc~test_handle_prefetchdata->none~init~2 none~run~2 ServerThread%run proc~test_handle_prefetchdata->none~run~2 none~set_rank ServerThread%set_rank proc~test_handle_prefetchdata->none~set_rank none~push_back~56 MessageVector%push_back none~add_message->none~push_back~56 none~set_connection BaseThread%set_connection none~init~2->none~set_connection proc~mapl_return MAPL_Return none~init~2->proc~mapl_return proc~mapl_verify MAPL_Verify none~init~2->proc~mapl_verify none~dispatch AbstractMessage%dispatch none~run~2->none~dispatch none~get_connection BaseThread%get_connection none~run~2->none~get_connection none~start~84 DistributedProfiler%start none~run~2->none~start~84 none~run~2->proc~mapl_return none~run~2->proc~mapl_verify receive receive none~run~2->receive none~dispatch->proc~mapl_return none~dispatch->proc~mapl_verify handle handle none~dispatch->handle none~get_connection->proc~mapl_return interface~mapl_assert MAPL_Assert none~get_connection->interface~mapl_assert none~capacity~331 MessageVector%capacity none~push_back~56->none~capacity~331 none~resize~112 MessageVector%resize none~push_back~56->none~resize~112 none~set_connection->proc~mapl_return none~start_self BaseProfiler%start_self none~start~84->none~start_self at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~resize_32~52 MessageVector%resize_32 none~resize~112->none~resize_32~52 none~start_self->proc~mapl_return none~start_self->interface~mapl_assert none~get_name~5 MeterNode%get_name none~start_self->none~get_name~5 none~start~47 BaseProfiler%start none~start_self->none~start~47

Source Code

   subroutine test_handle_PrefetchData()
      type (ServerThread) :: s
      character(len=:), allocatable :: expected

      type (ArrayReference) :: reference_a, reference_u, reference_v
      type (MockSocketLog), target :: log
      type (MockSocket) :: client_socket
      real(kind=REAL32), target :: a, u(NX,NY), v(NX,NY)
      type (MockServer) :: mock_server
      integer :: i

      reference_a = ArrayReference(a)
      reference_u = ArrayReference(u)
      reference_v = ArrayReference(v)

      client_socket = MockSocket(log)
      call client_socket%add_message(AddExtCollectionMessage('foo'))
      call client_socket%add_message(PrefetchDataMessage(1, 1, 'fake_data.nc4', 'a', reference_a))
      call client_socket%add_message(PrefetchDataMessage(2, 1, 'fake_data.nc4', 'u', reference_u, start=[1,1]))
      call client_socket%add_message(PrefetchDataMessage(3, 1, 'fake_data.nc4', 'v', reference_v, start=[1,1]))
      call client_socket%add_message(PrefetchDoneMessage())
      call client_socket%add_message(TerminateMessage())

      mock_server = MockServer()
      call s%init(client_socket, mock_server)
      call s%set_rank(1)

      do i = 1,6
         call s%run()
      enddo

      expected = ""
      expected = expected // "receive<AddExtCollection('foo')>"
      expected = expected // " :: send<Id(001)>"
      expected = expected // " :: receive<PrefetchData('a')>"
      expected = expected // " :: send<Dummy>"
      expected = expected // " :: receive<PrefetchData('u')>"
      expected = expected // " :: send<Dummy>"
      expected = expected // " :: receive<PrefetchData('v')>"
      expected = expected // " :: send<Dummy>"
      expected = expected // " :: receive<Done_prefetch>"
      expected = expected // " :: put()"
      expected = expected // " :: put()"
      expected = expected // " :: put()"
      expected = expected // " :: wait()"
      expected = expected // " :: wait()"
      expected = expected // " :: wait()"
      expected = expected // " :: receive<Terminate>"

      @assertEqual(expected, log%log)
      @assertEqual(A_EXPECTED, log%values_a)
      @assertEqual(U_EXPECTED, log%values_u)
      @assertEqual(V_EXPECTED, log%values_v)
   end subroutine test_handle_PrefetchData