test/rpc_client: remove sem_timedwait calls.
We have been experiencing some latent failures on the test pool relative to these calls timing out. While they are perfectly reasonable timeouts, we believe that the scheduling oftest VMs can sometimes cause the calls to take much longer. We don't want these test failures to confuse people trying to contribute to SPDK. fixes issue #1070 Change-Id: Ie0a96a15c593cacf7511028156790e5c285f0e48 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475166 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
a95aefc38a
commit
e5d2fdf14a
@ -327,18 +327,6 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Helper function */
|
||||
static int
|
||||
_sem_timedwait(sem_t *sem, __time_t sec)
|
||||
{
|
||||
struct timespec timeout;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
timeout.tv_sec += sec;
|
||||
|
||||
return sem_timedwait(sem, &timeout);
|
||||
}
|
||||
|
||||
volatile int g_rpc_server_th_stop;
|
||||
static sem_t g_rpc_server_th_listening;
|
||||
|
||||
@ -365,8 +353,6 @@ out:
|
||||
return (void *)(intptr_t)rc;
|
||||
}
|
||||
|
||||
static sem_t g_rpc_client_th_done;
|
||||
|
||||
static void *
|
||||
rpc_client_th(void *arg)
|
||||
{
|
||||
@ -375,7 +361,7 @@ rpc_client_th(void *arg)
|
||||
int rc;
|
||||
|
||||
|
||||
rc = _sem_timedwait(&g_rpc_server_th_listening, 2);
|
||||
rc = sem_wait(&g_rpc_server_th_listening);
|
||||
if (rc == -1) {
|
||||
fprintf(stderr, "Timeout waiting for server thread to start listening: rc=%d errno=%d\n", rc,
|
||||
errno);
|
||||
@ -412,7 +398,6 @@ out:
|
||||
spdk_jsonrpc_client_close(client);
|
||||
}
|
||||
|
||||
sem_post(&g_rpc_client_th_done);
|
||||
return (void *)(intptr_t)rc;
|
||||
}
|
||||
|
||||
@ -425,7 +410,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_client_th_done, 0, 0);
|
||||
|
||||
srv_tid_valid = pthread_create(&srv_tid, NULL, rpc_server_th, NULL);
|
||||
if (srv_tid_valid != 0) {
|
||||
@ -441,12 +425,6 @@ int main(int argc, char **argv)
|
||||
|
||||
out:
|
||||
if (client_tid_valid == 0) {
|
||||
rc = _sem_timedwait(&g_rpc_client_th_done, JOIN_TIMEOUT_S);
|
||||
if (rc) {
|
||||
fprintf(stderr, "failed to join client thread (rc: %d)\n", rc);
|
||||
err_cnt++;
|
||||
}
|
||||
|
||||
rc = pthread_join(client_tid, (void **)&th_rc);
|
||||
if (rc) {
|
||||
fprintf(stderr, "pthread_join() on client thread failed (rc: %d)\n", rc);
|
||||
@ -476,7 +454,6 @@ out:
|
||||
}
|
||||
|
||||
sem_destroy(&g_rpc_server_th_listening);
|
||||
sem_destroy(&g_rpc_client_th_done);
|
||||
|
||||
fprintf(stderr, "%s\n", err_cnt == 0 ? "OK" : "FAILED");
|
||||
return err_cnt ? EXIT_FAILURE : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user