test/rpc_client_test: remove g_rpc_server_th_done sem_t
The pthread_join() is sufficient. The server thread really shouldn't take 1 second to run, but when running in a VM it's possible things are getting scheduled such that the timer expires. This should not be a concern of this test though - it should just test that the rpc server/client functionality is working as intended. So remove the sem_t that was timing out. Note: I kept the other sem_t's in here for now. Maybe they should be removed too, but for now my main intention was to fix this annoying intermittent failure. While here, fix some typos and cases where we should be printing "server" instead of "client". I think this fixes issue #839. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I647d0b9c5faa9ccac53e6f6387757bb5a7649b5c Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473490 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
8088176127
commit
acea7bbce4
@ -341,7 +341,6 @@ _sem_timedwait(sem_t *sem, __time_t sec)
|
||||
|
||||
volatile int g_rpc_server_th_stop;
|
||||
static sem_t g_rpc_server_th_listening;
|
||||
static sem_t g_rpc_server_th_done;
|
||||
|
||||
static void *
|
||||
rpc_server_th(void *arg)
|
||||
@ -363,8 +362,6 @@ rpc_server_th(void *arg)
|
||||
|
||||
spdk_rpc_close();
|
||||
out:
|
||||
sem_post(&g_rpc_server_th_done);
|
||||
|
||||
return (void *)(intptr_t)rc;
|
||||
}
|
||||
|
||||
@ -428,7 +425,6 @@ int main(int argc, char **argv)
|
||||
int rc = 0, err_cnt = 0;
|
||||
|
||||
sem_init(&g_rpc_server_th_listening, 0, 0);
|
||||
sem_init(&g_rpc_server_th_done, 0, 0);
|
||||
sem_init(&g_rpc_client_th_done, 0, 0);
|
||||
|
||||
srv_tid_valid = pthread_create(&srv_tid, NULL, rpc_server_th, NULL);
|
||||
@ -453,10 +449,10 @@ out:
|
||||
|
||||
rc = pthread_join(client_tid, (void **)&th_rc);
|
||||
if (rc) {
|
||||
fprintf(stderr, "pthread_join() on cliennt thread failed (rc: %d)\n", rc);
|
||||
fprintf(stderr, "pthread_join() on client thread failed (rc: %d)\n", rc);
|
||||
err_cnt++;
|
||||
} else if (th_rc) {
|
||||
fprintf(stderr, "cliennt thread failed reported failure(thread rc: %d)\n", (int)th_rc);
|
||||
fprintf(stderr, "client thread failed reported failure(thread rc: %d)\n", (int)th_rc);
|
||||
err_cnt++;
|
||||
}
|
||||
}
|
||||
@ -464,18 +460,12 @@ out:
|
||||
g_rpc_server_th_stop = 1;
|
||||
|
||||
if (srv_tid_valid == 0) {
|
||||
rc = _sem_timedwait(&g_rpc_server_th_done, JOIN_TIMEOUT_S);
|
||||
if (rc) {
|
||||
fprintf(stderr, "server thread failed to exit in %d sec: (rc: %d)\n", JOIN_TIMEOUT_S, rc);
|
||||
err_cnt++;
|
||||
}
|
||||
|
||||
rc = pthread_join(srv_tid, (void **)&th_rc);
|
||||
if (rc) {
|
||||
fprintf(stderr, "pthread_join() on cliennt thread failed (rc: %d)\n", rc);
|
||||
fprintf(stderr, "pthread_join() on server thread failed (rc: %d)\n", rc);
|
||||
err_cnt++;
|
||||
} else if (th_rc) {
|
||||
fprintf(stderr, "cliennt thread failed reported failure(thread rc: %d)\n", (int)th_rc);
|
||||
fprintf(stderr, "server thread failed reported failure(thread rc: %d)\n", (int)th_rc);
|
||||
err_cnt++;
|
||||
}
|
||||
}
|
||||
@ -486,7 +476,6 @@ out:
|
||||
}
|
||||
|
||||
sem_destroy(&g_rpc_server_th_listening);
|
||||
sem_destroy(&g_rpc_server_th_done);
|
||||
sem_destroy(&g_rpc_client_th_done);
|
||||
|
||||
fprintf(stderr, "%s\n", err_cnt == 0 ? "OK" : "FAILED");
|
||||
|
Loading…
Reference in New Issue
Block a user