From c2c4495e3ce9e1f057b140189f45e738e5cba830 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 22 May 2023 17:16:48 -0700 Subject: [PATCH] libsysprof-analyze: add --silent option for test This allows testing loading without the print overhead. --- src/libsysprof-analyze/tests/test-symbolize.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/libsysprof-analyze/tests/test-symbolize.c b/src/libsysprof-analyze/tests/test-symbolize.c index da98674e..fb7cc71b 100644 --- a/src/libsysprof-analyze/tests/test-symbolize.c +++ b/src/libsysprof-analyze/tests/test-symbolize.c @@ -5,6 +5,14 @@ #include "sysprof-document-private.h" static GMainLoop *main_loop; +static gboolean silent; +static gboolean no_bundled; +static const GOptionEntry entries[] = { + { "no-bundled", 'b', 0, G_OPTION_ARG_NONE, &no_bundled, "Ignore symbols bundled in capture file" }, + { "silent", 's', 0, G_OPTION_ARG_NONE, &silent, "Do not print symbol information" }, + { 0 } +}; + static void load_cb (GObject *object, @@ -29,6 +37,12 @@ load_cb (GObject *object, traceables = sysprof_document_list_traceables (document); n_items = g_list_model_get_n_items (traceables); + if (silent) + { + g_main_loop_quit (main_loop); + return; + } + str = g_string_new (""); for (guint i = 0; i < n_items; i++) @@ -96,12 +110,6 @@ load_cb (GObject *object, g_main_loop_quit (main_loop); } -static gboolean no_bundled; -static const GOptionEntry entries[] = { - { "no-bundled", 'b', 0, G_OPTION_ARG_NONE, &no_bundled, "Ignore symbols bundled in capture file" }, - { 0 } -}; - int main (int argc, char *argv[])