Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2265ad9d authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Skip Binder IPC tests on NoKernel builds

Bug: 285204695
Test: atest --host binderRpcTestNoKernel
Test: m binderRpcTestNoKernelAtAll
Change-Id: Id8748b58e2355ea8eed7ec16d9b91bc69971e736
parent 9fa9da81
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -460,6 +460,20 @@ cc_test {
    ],
}

cc_test {
    name: "binderRpcTestNoKernelAtAll",
    defaults: [
        "binderRpcTest_defaults",
        "binderRpcTest_static_defaults",
    ],
    static_libs: [
        "libbinder_rpc_no_kernel",
    ],
    cflags: [
        "-DBINDER_NO_KERNEL_IPC_TESTING",
    ],
}

cc_test {
    name: "binderRpcTestSingleThreaded",
    defaults: [
+2 −2
Original line number Diff line number Diff line
@@ -1278,7 +1278,7 @@ static std::vector<BinderRpc::ParamType> getBinderRpcParams() {
                for (const auto& clientVersion : testVersions()) {
                    for (const auto& serverVersion : testVersions()) {
                        for (bool singleThreaded : {false, true}) {
                            for (bool noKernel : {false, true}) {
                            for (bool noKernel : noKernelValues()) {
                                ret.push_back(BinderRpc::ParamType{
                                        .type = type,
                                        .security = security,
@@ -1299,7 +1299,7 @@ static std::vector<BinderRpc::ParamType> getBinderRpcParams() {
                    .clientVersion = RPC_WIRE_PROTOCOL_VERSION,
                    .serverVersion = RPC_WIRE_PROTOCOL_VERSION,
                    .singleThreaded = false,
                    .noKernel = false,
                    .noKernel = !kEnableKernelIpcTesting,
            });
        }
    }
+14 −0
Original line number Diff line number Diff line
@@ -64,6 +64,12 @@

namespace android {

#ifdef BINDER_NO_KERNEL_IPC_TESTING
constexpr bool kEnableKernelIpcTesting = false;
#else
constexpr bool kEnableKernelIpcTesting = true;
#endif

constexpr char kLocalInetAddress[] = "127.0.0.1";

enum class RpcSecurity { RAW, TLS };
@@ -72,6 +78,14 @@ static inline std::vector<RpcSecurity> RpcSecurityValues() {
    return {RpcSecurity::RAW, RpcSecurity::TLS};
}

static inline std::vector<bool> noKernelValues() {
    std::vector<bool> values = {true};
    if (kEnableKernelIpcTesting) {
        values.push_back(false);
    }
    return values;
}

static inline bool hasExperimentalRpc() {
#ifdef BINDER_RPC_TO_TRUSTY_TEST
    // Trusty services do not support the experimental version,