diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index de9bec4d..f35761b9 100755 --- a/.github/workflows/L1-tests.yml +++ b/.github/workflows/L1-tests.yml @@ -138,7 +138,7 @@ jobs: with: repository: rdkcentral/entservices-casting path: entservices-casting - ref: develop + ref: RDKEMW-5823 - name: Checkout googletest if: steps.cache.outputs.cache-hit != 'true' diff --git a/Tests/L1Tests/tests/test_MiracastService.cpp b/Tests/L1Tests/tests/test_MiracastService.cpp index 322559e3..dfa9e475 100755 --- a/Tests/L1Tests/tests/test_MiracastService.cpp +++ b/Tests/L1Tests/tests/test_MiracastService.cpp @@ -44,13 +44,13 @@ namespace #define TEST_LOG(FMT, ...) log(__func__, __FILE__, __LINE__, syscall(__NR_gettid),FMT,##__VA_ARGS__) //Commented out the functions below because some test cases that use them have also been commented out. Since those test cases are disabled, these functions are now unused. - #if 0 + static void removeFile(const char* fileName) { if (std::remove(fileName) != 0) { printf("File %s failed to remove\n", fileName); - perror("Error deleting file"); + perror("Error deleting file preeja"); } else { @@ -100,7 +100,7 @@ namespace fileContentStream << "\n"; fileContentStream.close(); } - #endif + void current_time(char *time_str) { struct timeval tv; @@ -252,6 +252,10 @@ class MiracastServiceEventTest : public MiracastServiceTest { dispatcher->Release(); PluginHost::IFactories::Assign(nullptr); + TEST_LOG("Before destructor sleep "); + //Wait for all the previous destructor process to complete + std::this_thread::sleep_for(std::chrono::milliseconds(3000)); + TEST_LOG("After destructor sleep "); } }; @@ -259,7 +263,7 @@ TEST_F(MiracastServiceTest, GetInformation) { EXPECT_EQ("This MiracastService Plugin Facilitates Peer-to-Peer Control and WFD Source Device Discovery", plugin->Information()); } -#if 0 + TEST_F(MiracastServiceTest, P2PCtrlInterfaceNameNotFound) { removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); @@ -923,8 +927,9 @@ TEST_F(MiracastServiceEventTest, P2P_GO_FORMATION_FAIL_onClientConnectionError) { createFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); createFile("/var/run/wpa_supplicant/p2p0","p2p0"); - + EXPECT_EQ(string(""), plugin->Initialize(&service)); + TEST_LOG("PREDEBUG initialization done"); EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setEnable"), _T("{\"enabled\": true}"), response)); EXPECT_CALL(*p_wrapsImplMock, wpa_ctrl_request(::testing::_, ::testing::_, ::testing::_,::testing::_, ::testing::_, ::testing::_)) @@ -934,6 +939,7 @@ TEST_F(MiracastServiceEventTest, P2P_GO_FORMATION_FAIL_onClientConnectionError) { if ( 0 == strncmp(cmd,"P2P_CONNECT",strlen("P2P_CONNECT"))) { + TEST_LOG("PREDEBUG p2p connect sent"); strncpy(reply,"OK",*reply_len); } return false; @@ -943,42 +949,49 @@ TEST_F(MiracastServiceEventTest, P2P_GO_FORMATION_FAIL_onClientConnectionError) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-DEVICE-FOUND 2c:33:58:9c:73:2d p2p_dev_addr=2c:33:58:9c:73:2d pri_dev_type=1-0050F200-0 name='Sample-Test-Android-1' config_methods=0x11e8 dev_capab=0x25 group_capab=0x82 wfd_dev_info=0x01101c440006 new=0", *reply_len); - return false; + TEST_LOG("PREDEBUG P2P-DEVICE-FOUND sent"); + return false; })) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-DEVICE-FOUND 96:52:44:b6:7d:14 p2p_dev_addr=96:52:44:b6:7d:14 pri_dev_type=10-0050F204-5 name='Sample-Test-Android-2' config_methods=0x188 dev_capab=0x25 group_capab=0x0 wfd_dev_info=0x01101c440032 vendor_elems=1 new=1", *reply_len); - return false; + TEST_LOG("PREDEBUG P2P-DEVICE-FOUND2 sent"); + return false; })) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-PROV-DISC-PBC-REQ 96:52:44:b6:7d:14 p2p_dev_addr=96:52:44:b6:7d:14 pri_dev_type=10-0050F204-5 name='Sample-Test-Android-2' config_methods=0x188 dev_capab=0x25 group_capab=0x0", *reply_len); - return false; + TEST_LOG("PREDEBUG P2P-PROV-DISC-PBC-REQ sent"); + return false; })) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-PROV-DISC-PBC-REQ 96:52:44:b6:7d:14 p2p_dev_addr=96:52:44:b6:7d:14 pri_dev_type=10-0050F204-5 name='Sample-Test-Android-2' config_methods=0x188 dev_capab=0x25 group_capab=0x0", *reply_len); - return false; + TEST_LOG("PREDEBUG P2P-PROV-DISC-PBC-REQ2 sent"); + return false; })) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-GO-NEG-REQUEST 96:52:44:b6:7d:14 dev_passwd_id=4 go_intent=13", *reply_len); + TEST_LOG("PREDEBUG P2P-GO-NEG-REQUEST sent"); return false; })) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-GO-NEG-SUCCESS role=client freq=2437 ht40=0 x=96:52:44:b6:7d:14 peer_iface=96:52:44:b6:fd:14 wps_method=PBC", *reply_len); - return false; + TEST_LOG("PREDEBUG P2P-GO-NEG-REQUEST2 sent"); + return false; })) .WillOnce(::testing::Invoke( [&](struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) { strncpy(reply, "P2P-GROUP-FORMATION-FAILURE", *reply_len); + TEST_LOG("PREDEBUG P2P-GROUP-FORMATION-FAILURE sent"); return false; })) @@ -1003,6 +1016,7 @@ TEST_F(MiracastServiceEventTest, P2P_GO_FORMATION_FAIL_onClientConnectionError) "\"name\":\"Sample-Test-Android-2\"" "}" "}"))); + TEST_LOG("PREDEBUG onClientConnectionRequest notification received"); connectRequest.SetEvent(); return Core::ERROR_NONE; })) @@ -1019,10 +1033,11 @@ TEST_F(MiracastServiceEventTest, P2P_GO_FORMATION_FAIL_onClientConnectionError) "\"reason\":\"P2P_GROUP_FORMATION_FAILURE\"" "}" "}"))); + TEST_LOG("PREDEBUG onClientConnectionError notification received"); P2PGoFail.SetEvent(); return Core::ERROR_NONE; })); - +TEST_LOG("PREDEBUG subscribe for events"); EVENT_SUBSCRIBE(0, _T("onClientConnectionRequest"), _T("client.events"), message); EVENT_SUBSCRIBE(0, _T("onClientConnectionError"), _T("client.events"), message); @@ -1033,9 +1048,9 @@ TEST_F(MiracastServiceEventTest, P2P_GO_FORMATION_FAIL_onClientConnectionError) EVENT_UNSUBSCRIBE(0, _T("onClientConnectionRequest"), _T("client.events"), message); EVENT_UNSUBSCRIBE(0, _T("onClientConnectionError"), _T("client.events"), message); - + TEST_LOG("PREDEBUG deinit"); plugin->Deinitialize(nullptr); - +TEST_LOG("PREDEBUG deinit done"); removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); removeFile("/var/run/wpa_supplicant/p2p0"); } @@ -1044,7 +1059,7 @@ TEST_F(MiracastServiceEventTest, P2P_ClientMode_onClientConnectionAndLaunchReque { createFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); createFile("/var/run/wpa_supplicant/p2p0","p2p0"); - +TEST_LOG("PREDEBUG P2P_ClientMode_onClientConnectionAndLaunchRequest started"); EXPECT_EQ(string(""), plugin->Initialize(&service)); EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setEnable"), _T("{\"enabled\": true}"), response)); @@ -2040,4 +2055,4 @@ TEST_F(MiracastServiceEventTest, powerStateChange) removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); removeFile("/var/run/wpa_supplicant/p2p0"); } -#endif +