mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-30 02:20:26 +01:00
test: Replace _dbus_assert_not_reached()
Assertions can be disabled; but in test code the assertions are the entire point, so we don't want to disable them. Use _dbus_test_fatal() instead. test-service is actually a test helper rather than a test, so use its pre-existing die() function instead. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
c383f151be
commit
e559663e03
5 changed files with 11 additions and 10 deletions
|
|
@ -92,7 +92,7 @@ add_helper_executable(test-sleep-forever ${test-sleep-forever_SOURCES} ${DBUS_IN
|
|||
add_helper_executable(manual-tcp ${manual-tcp_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
|
||||
add_helper_executable(manual-backtrace manual-backtrace.c dbus-1)
|
||||
if(WIN32)
|
||||
add_helper_executable(manual-paths ${manual-paths_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
|
||||
add_helper_executable(manual-paths ${manual-paths_SOURCES} dbus-testutils)
|
||||
endif()
|
||||
|
||||
if(DBUS_ENABLE_EMBEDDED_TESTS)
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ manual_dir_iter_SOURCES = manual-dir-iter.c
|
|||
manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la
|
||||
|
||||
manual_paths_SOURCES = manual-paths.c
|
||||
manual_paths_LDADD = $(top_builddir)/dbus/libdbus-internal.la
|
||||
manual_paths_LDADD = libdbus-testutils.la
|
||||
|
||||
manual_tcp_SOURCES = manual-tcp.c
|
||||
manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ _dbus_server_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
|
|||
{
|
||||
_dbus_warn ("server listen error: %s: %s", error.name, error.message);
|
||||
dbus_error_free (&error);
|
||||
_dbus_assert_not_reached ("Failed to listen for valid address.");
|
||||
_dbus_test_fatal ("Failed to listen for valid address.");
|
||||
}
|
||||
|
||||
id = dbus_server_get_id (server);
|
||||
|
|
@ -710,7 +710,7 @@ _dbus_server_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
|
|||
{
|
||||
_dbus_warn ("server id '%s' is not in the server address '%s'",
|
||||
id, address);
|
||||
_dbus_assert_not_reached ("bad server id or address");
|
||||
_dbus_test_fatal ("bad server id or address");
|
||||
}
|
||||
|
||||
dbus_free (id);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "dbus/dbus-list.h"
|
||||
#include "dbus/dbus-internals.h"
|
||||
#include "dbus/dbus-sysdeps.h"
|
||||
#include "test-utils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -19,13 +20,13 @@ print_install_root (void)
|
|||
|
||||
if (!_dbus_string_init (&runtime_prefix))
|
||||
{
|
||||
_dbus_assert_not_reached ("out of memory");
|
||||
_dbus_test_fatal ("out of memory");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_dbus_get_install_root (&runtime_prefix))
|
||||
{
|
||||
_dbus_assert_not_reached ("out of memory");
|
||||
_dbus_test_fatal ("out of memory");
|
||||
_dbus_string_free (&runtime_prefix);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -51,7 +52,7 @@ print_service_dirs (void)
|
|||
dirs = NULL;
|
||||
|
||||
if (!_dbus_get_standard_session_servicedirs (&dirs))
|
||||
_dbus_assert_not_reached ("couldn't get standard dirs");
|
||||
_dbus_test_fatal ("couldn't get standard dirs");
|
||||
|
||||
while ((link = _dbus_list_pop_first_link (&dirs)))
|
||||
{
|
||||
|
|
@ -69,14 +70,14 @@ static dbus_bool_t print_replace_install_prefix(const char *s)
|
|||
|
||||
if (!_dbus_string_init (&str))
|
||||
{
|
||||
_dbus_assert_not_reached ("out of memory");
|
||||
_dbus_test_fatal ("out of memory");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_dbus_string_append (&str, s) ||
|
||||
!_dbus_replace_install_prefix (&str))
|
||||
{
|
||||
_dbus_assert_not_reached ("out of memory");
|
||||
_dbus_test_fatal ("out of memory");
|
||||
_dbus_string_free (&str);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ check_hello_from_self_reply (DBusPendingCall *pcall,
|
|||
dbus_error_free (&error);
|
||||
}
|
||||
else
|
||||
_dbus_assert_not_reached ("Unexpected message received");
|
||||
die ("Unexpected message received");
|
||||
|
||||
hello_from_self_reply_received = TRUE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue