Fixed test for rmi
authorAndriy Gudz <a.gudz@samsung.com>
Thu, 18 May 2017 10:28:27 +0000 (13:28 +0300)
committerAndriy Gudz <a.gudz@samsung.com>
Thu, 18 May 2017 10:29:01 +0000 (13:29 +0300)
device_core/scripts/build.sh
device_core/scripts/gbs.conf
device_core/utest/test_rmi.cpp

index 9d64e16..34b4fb4 100755 (executable)
@@ -28,7 +28,7 @@ NC='\033[0m'
 
 declare -a DEVICE_ARRAY=(
 "TM2 mobile"
-"TM1 mobile"
+"TM1 mobile / RaspberryPi3"
 "Kant TV"
 )
 
index 006a7bf..dc1197b 100644 (file)
@@ -1,6 +1,5 @@
 [general]
-#profile = profile.Main2017_KantM
-profile = profile.tizen_phone_arm64_3_0
+profile = repo.tzmb_3.0_TM1_base
 
 [obs.tizen_org]
 url = https://api.tizen.org
@@ -31,12 +30,10 @@ buildroot = ~/GBS_ROOT_3.0
 ############################################# Profile [profile.tzmb_3.0_TM2]
 
 [repo.tzmb_3.0_TM2_base]
-#url = http://download.tizen.org/snapshots/tizen/base/tizen-base_20170421.1/repos/arm64/packages/
 url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm64/packages/
 [repo.tzmb_3.0_TM2_srk]
 url = http://106.125.46.44/repo/tm2/packages/
 [repo.tzmb_4.0_unified]
-#url = http://download.tizen.org/snapshots/tizen/unified/tizen-unified_20170421.1/repos/standard/packages/
 url = http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/
 
 [profile.tzmb_3.0_TM2]
index 2bca73a..430c385 100644 (file)
@@ -41,6 +41,16 @@ public:
         return "FAIL";
     }
 
+    pid_t getPeerPid()
+    {
+        return service->getPeerPid();
+    }
+
+    pid_t getChildPid()
+    {
+        return getpid();
+    }
+
     static AgentInterface& instance()
     {
         static AgentInterface _instance_;
@@ -52,6 +62,8 @@ private:
     {
         service.reset(new rmi::Service(RMI_SERVICE_ADDRESS));
         service->registerParametricMethod(this, (string)(AgentInterface::handshake)(string));
+        service->registerNonparametricMethod(this, (pid_t)(AgentInterface::getPeerPid)());
+        service->registerNonparametricMethod(this, (pid_t)(AgentInterface::getChildPid)());
     }
 
     ~AgentInterface()
@@ -69,7 +81,9 @@ private:
  * 2. Connect client to service from parent process
  * 3. Check correct handshake call
  * 4. Check incorrect handshake call
- * 5. Disconnect client
+ * 5. Check client pid and service pid
+ * 6. Disconnect client
+ * 7. Kill service process
  */
 TEST(test_rmi, handshakeCorrect)
 {
@@ -91,10 +105,18 @@ TEST(test_rmi, handshakeCorrect)
         ASSERT_NO_THROW(client.connect());
         ASSERT_EQ("SYN-ACC", client.methodCall<string>("AgentInterface::handshake", string("SYN")));
         ASSERT_EQ("FAIL", client.methodCall<string>("AgentInterface::handshake", string("NOTSYN")));
+        pid_t peerPid = client.methodCall<pid_t>("AgentInterface::getPeerPid");
+        pid_t childPid = client.methodCall<pid_t>("AgentInterface::getChildPid");
         ASSERT_NO_THROW(client.disconnect());
+
+        // kill child process
+        ASSERT_EQ(peerPid, getpid());
+        ASSERT_TRUE(childPid > 0);
+        ASSERT_TRUE(childPid < 65000);
+        kill(childPid, SIGKILL);
     }
     else
     {
         FAIL();
-    }
+    }    
 }