[tracker/sam/tests-less-verbose] tests: Hide INFO and DEBUG messages by default
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/tests-less-verbose] tests: Hide INFO and DEBUG messages by default
- Date: Thu, 23 Jan 2020 22:40:25 +0000 (UTC)
commit 2c4b1ff5ad1359302e09d2e4abc866cf09067560
Author: Sam Thursfield <sam afuera me uk>
Date: Thu Jan 23 23:36:17 2020 +0100
tests: Hide INFO and DEBUG messages by default
Tracker's DEBUG and INFO messages are very verbose -- thousands of lines
each time you open a TrackerSparqlConnection, which some tests do many
times. Let's hide the output by default, guarded behind the
TRACKER_TESTS_VERBOSE environment variable which the functional-tests
are already using.
The size of the meson-logs.txt file reduces from 27MB to about 100KB
with this change.
Any really useful debug messages which are being lost after this change
could be promoted to g_message() to ensure they are always logged.
tests/functional-tests/ipc/test-bus-query-cancellation.c | 8 ++++++++
tests/libtracker-data/tracker-ontology-change-test.c | 9 +++++++++
tests/libtracker-data/tracker-ontology-test.c | 8 ++++++++
tests/libtracker-data/tracker-sparql-blank-test.c | 9 +++++++++
tests/libtracker-fts/tracker-fts-test.c | 8 ++++++++
tests/libtracker-sparql/tracker-sparql-test.c | 8 ++++++++
tests/tracker-steroids/tracker-test.c | 8 ++++++++
7 files changed, 58 insertions(+)
---
diff --git a/tests/functional-tests/ipc/test-bus-query-cancellation.c
b/tests/functional-tests/ipc/test-bus-query-cancellation.c
index e53ea7134..916b37481 100644
--- a/tests/functional-tests/ipc/test-bus-query-cancellation.c
+++ b/tests/functional-tests/ipc/test-bus-query-cancellation.c
@@ -112,6 +112,14 @@ main (gint argc, gchar **argv)
g_test_init (&argc, &argv, NULL);
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
g_test_add_func ("/libtracker-sparql/tracker/gb737023",
test_tracker_sparql_gb737023);
diff --git a/tests/libtracker-data/tracker-ontology-change-test.c
b/tests/libtracker-data/tracker-ontology-change-test.c
index 85dc75063..50e502aec 100644
--- a/tests/libtracker-data/tracker-ontology-change-test.c
+++ b/tests/libtracker-data/tracker-ontology-change-test.c
@@ -293,6 +293,15 @@ main (int argc, char **argv)
gint result;
g_test_init (&argc, &argv, NULL);
+
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
g_test_add_func ("/libtracker-data/ontology-change", test_ontology_change);
result = g_test_run ();
diff --git a/tests/libtracker-data/tracker-ontology-test.c b/tests/libtracker-data/tracker-ontology-test.c
index 11a0e5eaa..9c44b8885 100644
--- a/tests/libtracker-data/tracker-ontology-test.c
+++ b/tests/libtracker-data/tracker-ontology-test.c
@@ -310,6 +310,14 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
/* add test cases */
g_test_add ("/libtracker-data/ontology-init", TestInfo, &all_other_tests[0], setup,
test_ontology_init, teardown);
diff --git a/tests/libtracker-data/tracker-sparql-blank-test.c
b/tests/libtracker-data/tracker-sparql-blank-test.c
index 96f798b8c..2736fa134 100644
--- a/tests/libtracker-data/tracker-sparql-blank-test.c
+++ b/tests/libtracker-data/tracker-sparql-blank-test.c
@@ -161,6 +161,15 @@ main (int argc, char **argv)
g_mkdtemp (tests_data_dir);
g_test_init (&argc, &argv, NULL);
+
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
g_test_add ("/libtracker-data/sparql-blank", TestInfo, NULL, setup, test_blank, teardown);
/* run tests */
diff --git a/tests/libtracker-fts/tracker-fts-test.c b/tests/libtracker-fts/tracker-fts-test.c
index b389c281b..9f238bc6e 100644
--- a/tests/libtracker-fts/tracker-fts-test.c
+++ b/tests/libtracker-fts/tracker-fts-test.c
@@ -188,6 +188,14 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
current_dir = g_get_current_dir ();
g_setenv ("TRACKER_LANGUAGE_STOP_WORDS_DIR", current_dir, TRUE);
g_free (current_dir);
diff --git a/tests/libtracker-sparql/tracker-sparql-test.c b/tests/libtracker-sparql/tracker-sparql-test.c
index 201b01881..a1f910071 100644
--- a/tests/libtracker-sparql/tracker-sparql-test.c
+++ b/tests/libtracker-sparql/tracker-sparql-test.c
@@ -375,6 +375,14 @@ main (gint argc, gchar **argv)
g_test_init (&argc, &argv, NULL);
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
/* NOTE: this first test must come BEFORE any others because
* connections are cached by libtracker-sparql.
*/
diff --git a/tests/tracker-steroids/tracker-test.c b/tests/tracker-steroids/tracker-test.c
index a0afb201a..9053254ef 100644
--- a/tests/tracker-steroids/tracker-test.c
+++ b/tests/tracker-steroids/tracker-test.c
@@ -717,6 +717,14 @@ main (gint argc, gchar **argv)
{
g_test_init (&argc, &argv, NULL);
+ /* g_test_init() enables verbose logging by default, but Tracker is too
+ * verbose. To make the logs managable, we hide DEBUG and INFO messages
+ * unless TRACKER_TESTS_VERBOSE is set.
+ */
+ if (! g_getenv ("TRACKER_TESTS_VERBOSE")) {
+ g_log_set_handler ("Tracker", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, g_log_default_handler,
NULL);
+ }
+
/* test D-Bus backend */
g_setenv ("TRACKER_SPARQL_BACKEND", "bus", TRUE);
g_setenv ("TRACKER_TEST_DOMAIN_ONTOLOGY_RULE", TEST_DOMAIN_ONTOLOGY_RULE, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]