Skip to content

Commit

Permalink
test: use plain asserts for coverity
Browse files Browse the repository at this point in the history
It seems like coverity cannot deal with g_assert_cmpint and thus
gives us false positives assuming fd could be -1. Use plain
asserts for now. I tried to add a modeling file but that didnt
work int their web interface.
  • Loading branch information
gicmo committed Jun 15, 2020
1 parent 8b4fee4 commit 0216d63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/bolt-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <glib-unix.h>

#include <assert.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
Expand Down Expand Up @@ -117,7 +118,7 @@ notify_socket_new (void)
g_assert_nonnull (ns->tmpdir);

fd = socket (AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
g_assert_cmpint (fd, >, -1);
assert (fd > -1); /* plain assert for coverity */

ns->socket_path = g_build_filename (ns->tmpdir, "notify_socket", NULL);

Expand Down
3 changes: 2 additions & 1 deletion tests/test-guard.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <glib/gprintf.h>
#include <glib/gstdio.h>

#include <assert.h>
#include <locale.h>
#include <stdlib.h>
#include <sys/wait.h>
Expand Down Expand Up @@ -277,7 +278,7 @@ test_guard_recover_dead (TestGuard *tt, gconstpointer user)

fd = bolt_guard_monitor (guard, &err);
g_assert_no_error (err);
g_assert_cmpint (fd, >, -1);
assert (fd > -1); /* plain assert for coverity */
g_object_unref (guard); /* monitor adds a references */

/* memorize the fifo so we can check it exists
Expand Down

0 comments on commit 0216d63

Please sign in to comment.