Clatd-related commands porting
Test: built, flashed, booted
system/netd/tests/runtests.sh passes
Change-Id: Ia05bc3c9e7c9a2c5b3d59789aa829552f6961a2a
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index a5d8ee3..c67f863 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -1100,4 +1100,24 @@
EXPECT_EQ(EINVAL, status.serviceSpecificErrorCode());
}
-} // namespace
\ No newline at end of file
+} // namespace
+
+static bool processExists(const std::string& processName) {
+ std::string cmd = StringPrintf("ps -A | grep '%s'", processName.c_str());
+ return (runCommand(cmd.c_str()).size()) ? true : false;
+}
+
+TEST_F(BinderTest, TestClatdStartStop) {
+ binder::Status status;
+ // use dummy0 for test since it is set ready
+ static const char testIf[] = "dummy0";
+ const std::string clatdName = StringPrintf("clatd-%s", testIf);
+
+ status = mNetd->clatdStart(testIf);
+ EXPECT_TRUE(status.isOk()) << status.exceptionMessage();
+ EXPECT_TRUE(processExists(clatdName));
+
+ mNetd->clatdStop(testIf);
+ EXPECT_TRUE(status.isOk()) << status.exceptionMessage();
+ EXPECT_FALSE(processExists(clatdName));
+}