From ac3c3ff37af5714645ff3bc8fa3dc7db7a7f8df6 Mon Sep 17 00:00:00 2001 From: Haley Cao Date: Tue, 21 Jan 2020 05:02:26 +0000 Subject: [PATCH] Added Test Implementation for the Getters of OMRAddrInfoNode Added test implementations for per_thread_buffer_functionality test - Added implementations to first create a hints structure, which relies on the per thread buffer structure and functions. - Added values to hints, which is stored by per thread buffer and the element getters retrieves the values and compare them to values inserted. Issue: #4745 Depends on PR:#4555 Signed-off-by: Haley Cao --- fvtest/porttest/omrsockTest.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/fvtest/porttest/omrsockTest.cpp b/fvtest/porttest/omrsockTest.cpp index 10e48afd299..c109e31540f 100644 --- a/fvtest/porttest/omrsockTest.cpp +++ b/fvtest/porttest/omrsockTest.cpp @@ -104,14 +104,33 @@ TEST(PortSockTest, per_thread_buffer_functionality) OMRPORT_ACCESS_FROM_OMRPORT(portTestEnv->getPortLibrary()); omrsock_addrinfo_t hints = NULL; + uint32_t length = 0; int32_t family = 0; - int32_t sockType = 1; - int32_t protocol = 1; - int32_t flags = 0; + int32_t sockType = 0; + int32_t protocol = 0; - OMRPORTLIB->sock_getaddrinfo_create_hints(OMRPORTLIB, &hints, family, sockType, protocol, flags); + int32_t hintsFamily = 0; + int32_t hintsSockType = 1; + int32_t hintsProtocol = 1; + int32_t hintsFlags = 0; + + OMRPORTLIB->sock_getaddrinfo_create_hints(OMRPORTLIB, &hints, hintsFamily, hintsSockType, hintsProtocol, hintsFlags); ASSERT_NE(hints, (void *)NULL); + + /* Get and verify elements of the newly created hints. */ + OMRPORTLIB->sock_getaddrinfo_length(OMRPORTLIB, hints, &length); + EXPECT_EQ(length, 0); + + OMRPORTLIB->sock_getaddrinfo_family(OMRPORTLIB, hints, &family, 0); + EXPECT_EQ(family, hintsFamily); + + OMRPORTLIB->sock_getaddrinfo_socktype(OMRPORTLIB, hints, &sockType, 0); + EXPECT_EQ(sockType, hintsSockType); + + OMRPORTLIB->sock_getaddrinfo_protocol(OMRPORTLIB, hints, &protocol, 0); + EXPECT_EQ(protocol, hintsProtocol); + } /**