tests: get rid of FAIL macro

This commit is contained in:
Dan Williams
2016-02-11 09:49:01 -06:00
parent 007aeba021
commit 80d9a43a25
4 changed files with 13 additions and 13 deletions

View File

@@ -439,12 +439,14 @@ int
main (int argc, char **argv)
{
GError *error = NULL;
gboolean success;
int ret;
nmtst_init (&argc, &argv, TRUE);
if (!crypto_init (&error))
FAIL ("crypto-init", "failed to initialize crypto: %s", error->message);
success = crypto_init (&error);
g_assert_no_error (error);
g_assert (success);
g_test_add_data_func ("/libnm/crypto/cert/pem",
"test_ca_cert.pem",

View File

@@ -414,11 +414,13 @@ int
main (int argc, char **argv)
{
GError *error = NULL;
gboolean success;
nmtst_init (&argc, &argv, TRUE);
if (!crypto_init (&error))
FAIL ("crypto-init", "failed to initialize crypto: %s", error->message);
success = crypto_init (&error);
g_assert_no_error (error);
g_assert (success);
g_test_add_data_func ("/libnm/crypto/cert/pem",
"test_ca_cert.pem",

View File

@@ -739,11 +739,13 @@ NMTST_DEFINE ();
int main (int argc, char **argv)
{
GError *error = NULL;
gboolean success;
nmtst_init (&argc, &argv, TRUE);
if (!nm_utils_init (&error))
FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message);
success = nm_utils_init (&error);
g_assert_no_error (error);
g_assert (success);
/* The tests */
g_test_add_func ("/libnm/need_tls_secrets_path", test_need_tls_secrets_path);

View File

@@ -1038,17 +1038,11 @@ _nmtst_assert_ip6_address (const char *file, int line, const struct in6_addr *ad
}
#define nmtst_assert_ip6_address(addr, str_expected) _nmtst_assert_ip6_address (__FILE__, __LINE__, addr, str_expected)
/* Deprecated: don't use this overly verbose macro. */
#define FAIL(test_name, fmt, ...) \
G_STMT_START { \
g_error ("%s:%d: FAIL[%s]: " fmt, __FILE__, __LINE__, test_name, ## __VA_ARGS__); \
} G_STMT_END
/* Deprecated: don't use this overly verbose macro. */
#define ASSERT(x, test_name, fmt, ...) \
G_STMT_START { \
if (!(x)) { \
FAIL (test_name, fmt, ## __VA_ARGS__); \
g_error ("%s:%d: FAIL[%s]: " fmt, __FILE__, __LINE__, test_name, ## __VA_ARGS__); \
} \
} G_STMT_END