unittest: pass_gtest: Send start d-bus message before testing restart operation 01/191601/1
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 1 Oct 2018 06:48:45 +0000 (15:48 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 19 Oct 2018 00:03:55 +0000 (09:03 +0900)
The unittest of PASS tests the 'restart' opertion. It assume that PASS is
already started before testing the unittest. In order to clarify the test
condition of 'restart' operation, make the state of PASS always start state.
So, send start d-bus message before testing restart operation.

Change-Id: I38eb1b75074c7b47b65665cb687f6be2e1cfc8ce
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
unittest/pass_gtest.cpp

index 326c12abdb3a6c134fbeb793a4d95481f0f8d3ce..54c83f1b4d3af8a6518e91e7f04fb172329958f3 100644 (file)
@@ -153,6 +153,12 @@ TEST_F(PowerMgntTest, PmqosSendDbus_RestartsPmqos)
 {
        gint32 ret;
 
+       ret = pass_test_method_call(DBUS_PASS_PATH"/Pmqos",
+                                       DBUS_PASS_BUS_NAME".pmqos",
+                                       "start",
+                                       NULL);
+       ASSERT_EQ(ret, 0) << "PmQosStart Failed";
+
        ret = pass_test_method_call(DBUS_PASS_PATH"/Pmqos",
                                        DBUS_PASS_BUS_NAME".pmqos",
                                        "stop",
@@ -176,6 +182,12 @@ TEST_F(PowerMgntTest, ThermalMonitorSendDbus_RestartsThermalMonitor)
 {
        gint32 ret;
 
+       ret = pass_test_method_call(DBUS_PASS_PATH"/Monitor/Thermal",
+                                       DBUS_PASS_BUS_NAME".monitor.thermal",
+                                       "start",
+                                       NULL);
+       ASSERT_EQ(ret, 0) << "ThermalMonitorStart Failed";
+
        ret = pass_test_method_call(DBUS_PASS_PATH"/Monitor/Thermal",
                                        DBUS_PASS_BUS_NAME".monitor.thermal",
                                        "stop",
@@ -193,6 +205,12 @@ TEST_F(PowerMgntTest, CoreSendDbus_RestartsCore)
 {
        gint32 ret;
 
+       ret = pass_test_method_call(DBUS_PASS_PATH"/Core",
+                                       DBUS_PASS_BUS_NAME".core",
+                                       "start",
+                                       NULL);
+       ASSERT_EQ(ret, 0) << "PassCoreStart Failed";
+
        ret = pass_test_method_call(DBUS_PASS_PATH"/Core",
                                        DBUS_PASS_BUS_NAME".core",
                                        "stop",
@@ -210,6 +228,9 @@ TEST_F(PowerMgntTest, RestartsPowerMgntService)
 {
        gint32 ret;
 
+       ret = system("/bin/systemctl start pass.service");
+       ASSERT_EQ(ret, 0) << "PassServiceStart Failed";
+
        ret = system("/bin/systemctl stop pass.service");
        ASSERT_EQ(ret, 0) << "PassServieStop Failed";