From 2271b75fa9019a9ba10d38ea2cf53a2032b1d8fd Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 7 Sep 2018 11:47:06 -0400 Subject: tests: Fix signalling race condition in TPM tests This patch fixes a race condition and test failure where the main process waits for the signal of a thread but the thread already sent that signal via a condition. Since these signals are non-sticky, we need to introduce a separate variable to make this signal sticky. Signed-off-by: Stefan Berger Reviewed-by: Marc-André Lureau --- tests/tpm-tis-test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/tpm-tis-test.c') diff --git a/tests/tpm-tis-test.c b/tests/tpm-tis-test.c index 14754d9706..c8ec14888f 100644 --- a/tests/tpm-tis-test.c +++ b/tests/tpm-tis-test.c @@ -446,6 +446,7 @@ int main(int argc, char **argv) test.addr->u.q_unix.path = g_build_filename(tmp_path, "sock", NULL); g_mutex_init(&test.data_mutex); g_cond_init(&test.data_cond); + test.data_cond_signal = false; thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test); tpm_emu_test_wait_cond(&test); -- cgit v1.2.3-55-g7522