diff options
author | 2023-05-16 23:27:42 +0000 | |
---|---|---|
committer | 2023-05-16 23:28:44 +0000 | |
commit | 9f250b0ca6fd99bd5943955de3211e05eaa59dbc (patch) | |
tree | f72ca8e4a2d3a44acd47bd499dd7304a45909354 | |
parent | 71ea90d35134e972978f92add142857a10104552 (diff) |
binderRpcTest: host requires vsock loopback
Upgrade your kernels, folks!
Bug: 187754872
Test: binderRpcTest with and without vsock_loopback enabled
Change-Id: I72e1cc949533342ac819e1cbf3ff977380a33f33
-rw-r--r-- | libs/binder/tests/binderRpcTest.cpp | 10 | ||||
-rw-r--r-- | libs/binder/tests/binderRpcTestService.cpp | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp index 287e077d40..d6aa6c636f 100644 --- a/libs/binder/tests/binderRpcTest.cpp +++ b/libs/binder/tests/binderRpcTest.cpp @@ -1120,7 +1120,7 @@ INSTANTIATE_TEST_CASE_P(Trusty, BinderRpc, ::testing::Values(true), ::testing::Values(true)), BinderRpc::PrintParamInfo); #else // BINDER_RPC_TO_TRUSTY_TEST -static bool testSupportVsockLoopback() { +bool testSupportVsockLoopback() { // We don't need to enable TLS to know if vsock is supported. unsigned int vsockPort = allocateVsockPort(); @@ -1220,7 +1220,15 @@ static std::vector<SocketType> testSocketTypes(bool hasPreconnected = true) { if (hasPreconnected) ret.push_back(SocketType::PRECONNECTED); +#ifdef __BIONIC__ + // Devices may not have vsock support. AVF tests will verify whether they do, but + // we can't require it due to old kernels for the time being. static bool hasVsockLoopback = testSupportVsockLoopback(); +#else + // On host machines, we always assume we have vsock loopback. If we don't, the + // subsequent failures will be more clear than showing one now. + static bool hasVsockLoopback = true; +#endif if (hasVsockLoopback) { ret.push_back(SocketType::VSOCK); diff --git a/libs/binder/tests/binderRpcTestService.cpp b/libs/binder/tests/binderRpcTestService.cpp index a9736d5ecd..66221c59bd 100644 --- a/libs/binder/tests/binderRpcTestService.cpp +++ b/libs/binder/tests/binderRpcTestService.cpp @@ -139,7 +139,8 @@ int main(int argc, char* argv[]) { CHECK_EQ(OK, server->setupRawSocketServer(std::move(socketFd))); break; case SocketType::VSOCK: - CHECK_EQ(OK, server->setupVsockServer(VMADDR_CID_LOCAL, serverConfig.vsockPort)); + CHECK_EQ(OK, server->setupVsockServer(VMADDR_CID_LOCAL, serverConfig.vsockPort)) + << "Need `sudo modprobe vsock_loopback`?"; break; case SocketType::INET: { CHECK_EQ(OK, server->setupInetServer(kLocalInetAddress, 0, &outPort)); |