1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-05-28 17:41:28 +03:00

tests/pkd: relax pthread_kill assert in pkd_stop

Relax the `pthread_kill` result assertion in `pkd_stop` to tolerate
`ESRCH`, and guard against only `EINVAL` and `ENOTSUP`.

On macOS what can happen is that the `pthread_kill` returns `ESRCH` due
to the accept thread being already terminated.  For that case, the
teardown path should proceed to `pthread_join`.

Testing notes:
 - On my macOS setup I consistently encountered `ESRCH` in this
   codepath, causing pkd tests to fail unnecessarily.  With the
   change, I observe the tests passing.

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit aa206cbfe5c8775667f74a6244728d7d5b9a37c9)
This commit is contained in:
Jon Simons 2022-11-12 15:36:41 -05:00 committed by Jakub Jelen
parent 105835d542
commit ed8b7ea7a7

View File

@ -589,7 +589,8 @@ void pkd_stop(struct pkd_result *out) {
close(pkd_state.server_fd);
rc = pthread_kill(ctx.tid, SIGUSR1);
assert_int_equal(rc, 0);
assert_int_not_equal(rc, EINVAL);
assert_int_not_equal(rc, ENOTSUP);
rc = pthread_join(ctx.tid, NULL);
assert_int_equal(rc, 0);