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

trace: remove global default trace json #969

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ libre.*dylib
libre.pc
libre.so*
*.gcov
re_trace.json

# Windows build folder
Win32/*
Expand Down
8 changes: 0 additions & 8 deletions src/main/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ int libre_init(void)
return err;
}

#ifdef RE_TRACE_ENABLED
re_trace_init("re_trace.json");
#endif

err = re_thread_init();

return err;
Expand All @@ -183,10 +179,6 @@ int libre_init(void)
*/
void libre_close(void)
{

#ifdef RE_TRACE_ENABLED
re_trace_close();
#endif
(void)fd_setsize(0);
net_sock_close();
re_thread_close();
Expand Down
15 changes: 15 additions & 0 deletions test/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ int test_trace(void)
if (test_mode == TEST_THREAD)
return ESKIPPED;

err = re_trace_init("test_trace.json");
TEST_ERR(err);

RE_TRACE_PROCESS_NAME("retest");
RE_TRACE_THREAD_NAME("test_trace");
RE_TRACE_BEGIN("test", "Test Loop Start");
Expand All @@ -51,6 +54,18 @@ int test_trace(void)

RE_TRACE_END("test", "Test Loop End");

err = re_trace_close();
TEST_ERR(err);

/* Test TRACE after close - should do nothing */
RE_TRACE_BEGIN("test", "test after close");

#ifdef WIN32
(void)_unlink("test_trace.json");
#else
(void)unlink("test_trace.json");
#endif

out:
return err;
}