Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests/unit/test-qmp-event: Drop superfluous mutex
Mutex @test_event_lock is held from fixture setup to teardown,
protecting global variable @test_event_data.  But tests always run one
after the other, so this is superfluous.  It also confuses Coverity.
Drop the mutex.

Fixes: CID 1527425
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20231122072456.2518816-2-armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
Markus Armbruster authored and huth committed Dec 20, 2023
1 parent 71dc6ca commit c363764
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions tests/unit/test-qmp-event.c
Expand Up @@ -30,7 +30,6 @@ typedef struct TestEventData {
} TestEventData;

TestEventData *test_event_data;
static GMutex test_event_lock;

void test_qapi_event_emit(test_QAPIEvent event, QDict *d)
{
Expand Down Expand Up @@ -59,17 +58,13 @@ void test_qapi_event_emit(test_QAPIEvent event, QDict *d)
static void event_prepare(TestEventData *data,
const void *unused)
{
/* Global variable test_event_data was used to pass the expectation, so
test cases can't be executed at same time. */
g_mutex_lock(&test_event_lock);
test_event_data = data;
}

static void event_teardown(TestEventData *data,
const void *unused)
{
test_event_data = NULL;
g_mutex_unlock(&test_event_lock);
}

static void event_test_add(const char *testpath,
Expand Down

0 comments on commit c363764

Please sign in to comment.