Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up valgrind errors in unit tests #29

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions alfred.c
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,6 @@ test_rate_limit ()
char *test_str = NULL;
lua_Integer test_count;

apteryx_init (false);
/* Create library file + XML */
library = fopen ("alfred_test.lua", "w");
g_assert (library != NULL);
Expand Down Expand Up @@ -2205,7 +2204,6 @@ test_after_quiet ()
FILE *library = NULL;
FILE *data = NULL;

apteryx_init (false);
/* Create library file + XML */
library = fopen ("alfred_test.lua", "w");
g_assert (library != NULL);
Expand Down Expand Up @@ -2338,7 +2336,6 @@ test_intermodule_interaction ()
FILE *data = NULL;
char *test_str = NULL;

apteryx_init (false);
/* Create library file + XML */
library = fopen ("alfred_test.lua", "w");
g_assert (library != NULL);
Expand Down Expand Up @@ -2541,11 +2538,7 @@ main (int argc, char *argv[])

if (unit_test)
{
pthread_t main_thread;
pthread_attr_t attr;

pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
GThread *main_thread;

g_test_init (&argc, &argv, NULL);
g_test_add_func ("/test_simple_watch", test_simple_watch);
Expand All @@ -2566,13 +2559,10 @@ main (int argc, char *argv[])
g_test_add_func ("/test_intermodule_interaction", test_intermodule_interaction);

loop = g_main_loop_new (NULL, true);
g_unix_signal_add (SIGINT, termination_handler, loop);
g_unix_signal_add (SIGTERM, termination_handler, loop);
pthread_create (&main_thread, &attr, (void *) g_main_loop_run, loop);
pthread_join(main_thread, NULL);
main_thread = g_thread_new ("main_loop", (GThreadFunc) g_main_loop_run, loop);
g_test_run();
pthread_cancel(main_thread);
pthread_attr_destroy(&attr);
g_main_loop_quit (loop);
g_thread_join (main_thread);
goto exit;
}
else
Expand Down
Loading