From 8f97cfe507e457465657e647277bf9b87b17fd3b Mon Sep 17 00:00:00 2001 From: preeja33 Date: Wed, 20 Aug 2025 13:23:00 +0530 Subject: [PATCH 1/6] Update test_MiracastService.cpp --- Tests/L1Tests/tests/test_MiracastService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/L1Tests/tests/test_MiracastService.cpp b/Tests/L1Tests/tests/test_MiracastService.cpp index 322559e3..c3906a19 100755 --- a/Tests/L1Tests/tests/test_MiracastService.cpp +++ b/Tests/L1Tests/tests/test_MiracastService.cpp @@ -50,7 +50,7 @@ namespace if (std::remove(fileName) != 0) { printf("File %s failed to remove\n", fileName); - perror("Error deleting file"); + perror("Error deleting file preeja"); } else { From d47c75dbd88889846f9c647685eabe837c1892e9 Mon Sep 17 00:00:00 2001 From: preeja33 Date: Wed, 20 Aug 2025 14:50:52 +0530 Subject: [PATCH 2/6] adding sleep --- Tests/L1Tests/tests/test_MiracastService.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/L1Tests/tests/test_MiracastService.cpp b/Tests/L1Tests/tests/test_MiracastService.cpp index c3906a19..cfb7d148 100755 --- a/Tests/L1Tests/tests/test_MiracastService.cpp +++ b/Tests/L1Tests/tests/test_MiracastService.cpp @@ -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 "); } }; From 84f4e8e1e9bf4319a0ec09a0428630762eda241d Mon Sep 17 00:00:00 2001 From: preeja33 Date: Wed, 20 Aug 2025 15:05:12 +0530 Subject: [PATCH 3/6] add debuglogs --- Tests/L1Tests/tests/test_MiracastService.cpp | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Tests/L1Tests/tests/test_MiracastService.cpp b/Tests/L1Tests/tests/test_MiracastService.cpp index cfb7d148..9b119030 100755 --- a/Tests/L1Tests/tests/test_MiracastService.cpp +++ b/Tests/L1Tests/tests/test_MiracastService.cpp @@ -927,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::_)) @@ -938,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; @@ -947,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; })) @@ -1007,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; })) @@ -1023,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); @@ -1037,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"); } @@ -1048,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)); From 9ab8144850c39490603491c011bd17fecb7087fd Mon Sep 17 00:00:00 2001 From: preeja33 Date: Wed, 20 Aug 2025 15:13:41 +0530 Subject: [PATCH 4/6] Update L1-tests.yml --- .github/workflows/L1-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index de9bec4d..9e931504 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: feature/RDKEMW-5823 - name: Checkout googletest if: steps.cache.outputs.cache-hit != 'true' From 40ecb2c7a59670c0b9d231a3df5b5d213ee91974 Mon Sep 17 00:00:00 2001 From: preeja33 Date: Wed, 20 Aug 2025 16:52:32 +0530 Subject: [PATCH 5/6] correct branch name --- .github/workflows/L1-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index 9e931504..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: feature/RDKEMW-5823 + ref: RDKEMW-5823 - name: Checkout googletest if: steps.cache.outputs.cache-hit != 'true' From 692d02e5e611c93dc16d3e48b23618d3d58975a6 Mon Sep 17 00:00:00 2001 From: preeja33 Date: Wed, 20 Aug 2025 17:30:21 +0530 Subject: [PATCH 6/6] uncomment testcases --- Tests/L1Tests/tests/test_MiracastService.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/L1Tests/tests/test_MiracastService.cpp b/Tests/L1Tests/tests/test_MiracastService.cpp index 9b119030..dfa9e475 100755 --- a/Tests/L1Tests/tests/test_MiracastService.cpp +++ b/Tests/L1Tests/tests/test_MiracastService.cpp @@ -44,7 +44,7 @@ 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) @@ -100,7 +100,7 @@ namespace fileContentStream << "\n"; fileContentStream.close(); } - #endif + void current_time(char *time_str) { struct timeval tv; @@ -263,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"); @@ -2055,4 +2055,4 @@ TEST_F(MiracastServiceEventTest, powerStateChange) removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); removeFile("/var/run/wpa_supplicant/p2p0"); } -#endif +