aboutsummaryrefslogtreecommitdiff
path: root/tests/tpm-crb-test.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2018-09-07 11:47:06 -0400
committerStefan Berger <stefanb@linux.vnet.ibm.com>2018-09-07 16:37:47 -0400
commit2271b75fa9019a9ba10d38ea2cf53a2032b1d8fd (patch)
treea8fd73afcb4cafbc7223803408a571737648b930 /tests/tpm-crb-test.c
parent19b599f7664b2ebfd0f405fb79c14dd241557452 (diff)
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 <stefanb@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'tests/tpm-crb-test.c')
-rw-r--r--tests/tpm-crb-test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/tpm-crb-test.c b/tests/tpm-crb-test.c
index d8f9569203..6fde579bab 100644
--- a/tests/tpm-crb-test.c
+++ b/tests/tpm-crb-test.c
@@ -151,6 +151,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);