Commit Graph

18 Commits

Author SHA1 Message Date
Frediano Ziglio
6a64d86d1d test-logging: Do not use G_PASTE to join level
"level" can have value "DEBUG". In some environment "DEBUG" is
used as preprocessor name to enable some debugging code.
Using -DDEBUG option (or similar) cause "DEBUG" to be defined as "1"
so "G_PASTE(G_LOG_LEVEL_, level)" will be expanded to "G_LOG_LEVEL_1"
instead of "G_LOG_LEVEL_DEBUG".
Just concatenate the two literal to avoid "DEBUG" expansion.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-19 14:47:08 +00:00
Frediano Ziglio
e761c2d4de log: Add spice_extra_assert
This macro was suggested to simplify hot path expensive checks
which should be disable in production environments.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 13:24:45 +00:00
Frediano Ziglio
4fc4c2db36 Do not check for HAVE_CONFIG_H
This should always be defined and including config.h is a requirement.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-05-02 09:33:05 +01:00
Christophe Fergeau
5ef652b7e3 build: Add missing G_GNUC_PRINTF annotations
They were suggested by gcc when using -Wsuggest-attribute=format

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-29 16:58:07 +01:00
Frediano Ziglio
3e116a6c71 Obsolete Glib cleanup
We require at least GLib 2.38, remove code and check to
support earlier versions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2019-02-06 14:24:03 +00:00
Frediano Ziglio
e3af47fe9d log: remove deprecated SPICE_DEBUG_LEVEL support
This feature was marked obsolete by efd1d3cb4d more than
three years ago.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-02-06 13:21:00 +00:00
Frediano Ziglio
ea20b8c013 log: remove deprecated SPICE_ABORT_LEVEL support
This feature was marked obsolete by efd1d3cb4d more than
three years ago.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-02-06 13:19:47 +00:00
Christophe Fergeau
31d4622687 log: Remove SPICE_DISABLE_ABORT
spice-gtk was the last user, and stopped using it on Jun 14th 2017
in 040090ccba34 "build-sys: remove -DSPICE_DISABLE_ABORT"

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:05 +01:00
Christophe Fergeau
0fc3d4209f test-logging: Improve debug level tests
These tests were checking that the expected messages were output, but
they were not checking that the messages we don't want are not output.
This commit adds this to make sure our log implementation does not
output unwanted debug messages.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-21 07:03:25 +01:00
Frediano Ziglio
518c57db20 log: Forbid the usage of obsolete SPICE_LOG_DOMAIN
As we decided to not use multiple GLib domains, the SPICE_LOG_DOMAIN
macro is not really useful. This commit removes it.
Will be replaced by some different categorization.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-05 09:53:02 +01:00
Pavel Grunt
63e575d5fc silence -Wunused-parameter 2016-11-01 15:26:43 +01:00
Pavel Grunt
ad862c4d4b test-logging: Include stdlib.h for _Exit()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-05-09 10:20:32 +02:00
Christophe Fergeau
8473d0ae71 log: Use SPICE_CONSTRUCTOR_FUNC
This was done through a GOnce called every time spice_log() is called,
now it will always be called at spice-server startup.

This means the unit test needs to be updated as SPICE_DEBUG/ABORT_LEVEL
must now be set before the process starts up rather than before the
first spice_log call, and the deprecation warning these environment
variables trigger cannot be caught using g_test_expect_message() as
they are output before g_test_init() is called.
2016-04-05 15:38:17 +02:00
Christophe Fergeau
6c7552d543 tests: Fix glib version check
The glib version checks were using #ifdef GLIB_CHECK_VERSION() rather
than  #if GLIB_CHECK_VERSION()
2016-03-31 13:34:43 +02:00
Eduardo Lima (Etrunko)
51df6f775a Fix build in systems with Glib version older than 2.38
Tests now include functions only available in glib 2.38. To avoid
setting the dependency bar too high, we simply put them between #ifdef
guards.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-31 11:25:02 +02:00
Frediano Ziglio
0f45924f4c tests: exit on SIGABRT
Fatal error exit usually with abort() causing SIGABRT to be triggered
which can have problems with core dump generation depending on system
settings. Capturing and exiting on this signal solve the problem.
This is a workaround to some system configurations which could cause
test to fail.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-16 08:14:02 +00:00
Marc-André Lureau
f06f699d78 test-logging: unset G_MESSAGES_DEBUG
This test is sensitive to G_MESSAGES_DEBUG variable. Make it insensitive
by unsetting the environment variable.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-10 14:47:39 +00:00
Christophe Fergeau
df56d585cb log: Add test case for logging code
This gives us a baseline of how the SPICE/glib integration is supposed
to behave.

Everything goes through glib logging facilities, and is impacted by
G_MESSAGES_DEBUG/G_DEBUG=fatal-{warnings,criticals}

Messages in the SPICE_LOG_DOMAIN log domain (output either through
spice_log() or g_log()) will also consider the legacy SPICE_DEBUG_LEVEL
and SPICE_ABORT_LEVEL environment variables. Messages in other domains
will not be impacted by these legacy environment variables.

If spice-common is built without SPICE_DISABLE_ABORT,
spice_return_if_fail()/spice_critical() will abort the program.
g_return_if_fail()/g_critical() will not abort the program.
2016-01-26 15:58:43 +01:00