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

Commit 06d83ad7 authored by Connor O'Brien's avatar Connor O'Brien Committed by Gerrit Code Review
Browse files

Merge "Enable multiple concurrent binderLibTest instances"

parents a3408388 87c03cf9
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ using namespace android;

static testing::Environment* binder_env;
static char *binderservername;
static char *binderserversuffix;
static char binderserverarg[] = "--binderserver";

static String16 binderLibTestServiceName = String16("test.binderLib");
@@ -70,6 +71,7 @@ pid_t start_server_process(int arg2)
        binderserverarg,
        stri,
        strpipefd1,
        binderserversuffix,
        NULL
    };

@@ -898,6 +900,8 @@ class BinderLibTestService : public BBinder

int run_server(int index, int readypipefd)
{
    binderLibTestServiceName += String16(binderserversuffix);

    status_t ret;
    sp<IServiceManager> sm = defaultServiceManager();
    {
@@ -928,15 +932,19 @@ int run_server(int index, int readypipefd)
int main(int argc, char **argv) {
    int ret;

    if (argc == 3 && !strcmp(argv[1], "--servername")) {
    if (argc == 4 && !strcmp(argv[1], "--servername")) {
        binderservername = argv[2];
    } else {
        binderservername = argv[0];
    }

    if (argc == 4 && !strcmp(argv[1], binderserverarg)) {
    if (argc == 5 && !strcmp(argv[1], binderserverarg)) {
        binderserversuffix = argv[4];
        return run_server(atoi(argv[2]), atoi(argv[3]));
    }
    binderserversuffix = new char[16];
    snprintf(binderserversuffix, 16, "%d", getpid());
    binderLibTestServiceName += String16(binderserversuffix);

    ::testing::InitGoogleTest(&argc, argv);
    binder_env = AddGlobalTestEnvironment(new BinderLibTestEnv());