nmtst: combine files nm-test-helpers.h and nm-test-utils.h

Move the content of nm-test-helpers.h to nm-test-utils.h
which completly replaces the older file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-04-22 16:55:28 +02:00
parent 0e9cd4f6fc
commit 8af001eae4
15 changed files with 44 additions and 64 deletions

View file

@ -4,7 +4,6 @@ EXTRA_DIST = \
nm-dbus-glib-types.h \
nm-glib-compat.h \
nm-gvaluearray-compat.h \
nm-test-helpers.h \
nm-test-utils.h \
nm-version.h.in \
nm-settings-flags.h

View file

@ -1,49 +0,0 @@
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2008 Red Hat, Inc.
*/
#ifndef NM_TEST_HELPERS_H
#define NM_TEST_HELPERS_H
#include <stdio.h>
#include <unistd.h>
#include <glib.h>
static void
FAIL(const char *test_name, const char *fmt, ...)
{
va_list args;
char buf[500];
g_snprintf (buf, 500, "FAIL: (%s) %s\n", test_name, fmt);
va_start (args, fmt);
vfprintf (stderr, buf, args);
va_end (args);
_exit (1);
}
#define ASSERT(x, test_name, fmt, ...) \
if (!(x)) { \
FAIL (test_name, fmt, ## __VA_ARGS__); \
}
#endif /* NM_TEST_HELPERS_H */

View file

@ -24,6 +24,8 @@
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <string.h>
@ -302,6 +304,27 @@ nmtst_inet6_from_string (const char *str)
return &addr;
}
inline static void
FAIL(const char *test_name, const char *fmt, ...)
{
va_list args;
char buf[500];
g_snprintf (buf, 500, "FAIL: (%s) %s\n", test_name, fmt);
va_start (args, fmt);
vfprintf (stderr, buf, args);
va_end (args);
_exit (1);
}
#define ASSERT(x, test_name, fmt, ...) \
if (!(x)) { \
FAIL (test_name, fmt, ## __VA_ARGS__); \
}
/*******************************************************************************/
#ifdef NM_PLATFORM_H
inline static NMPlatformIP6Address *

View file

@ -28,10 +28,11 @@
#include <stdio.h>
#include <string.h>
#include "nm-test-helpers.h"
#include "crypto.h"
#include "nm-utils.h"
#include "nm-test-utils.h"
#if 0
static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
static const char *pem_rsa_key_end = "-----END RSA PRIVATE KEY-----";

View file

@ -25,7 +25,6 @@
#include <netinet/ether.h>
#include <linux/if_infiniband.h>
#include "nm-test-helpers.h"
#include <nm-utils.h>
#include "nm-setting-private.h"
@ -46,6 +45,8 @@
#include "nm-dbus-glib-types.h"
#include "nm-glib-compat.h"
#include "nm-test-utils.h"
static void
vpn_check_func (const char *key, const char *value, gpointer user_data)
{

View file

@ -22,7 +22,6 @@
#include <glib.h>
#include <string.h>
#include "nm-test-helpers.h"
#include <nm-utils.h>
#include "nm-setting-connection.h"
@ -37,6 +36,7 @@
#include "nm-setting-pppoe.h"
#include "nm-setting-vpn.h"
#include "nm-test-utils.h"
#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem"
#define TEST_NEED_SECRETS_EAP_TLS_CLIENT_CERT TEST_CERT_DIR "/test_key_and_cert.pem"

View file

@ -22,12 +22,13 @@
#include <glib.h>
#include <string.h>
#include "nm-test-helpers.h"
#include <nm-utils.h>
#include "nm-setting-connection.h"
#include "nm-setting-8021x.h"
#include "nm-test-utils.h"
static void
compare_blob_data (const char *test,
const char *key_path,

View file

@ -22,7 +22,6 @@
#include <glib.h>
#include <string.h>
#include "nm-test-helpers.h"
#include <nm-utils.h>
#include "nm-setting-8021x.h"
@ -39,6 +38,7 @@
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
#include "nm-test-utils.h"
static void
test_defaults (GType type, const char *name)

View file

@ -23,11 +23,10 @@
#include <unistd.h>
#include <string.h>
#include "nm-test-helpers.h"
#include "common.h"
#include "utils.h"
#include "nm-test-utils.h"
static void
test_get_ifcfg_name (const char *desc,

View file

@ -48,7 +48,6 @@
#include <nm-setting-dcb.h>
#include <nm-util-private.h>
#include "nm-test-helpers.h"
#include "NetworkManagerUtils.h"
#include "nm-glib-compat.h"
@ -57,6 +56,8 @@
#include "writer.h"
#include "utils.h"
#include "nm-test-utils.h"
#if 0
static void
connection_diff (NMConnection *a, NMConnection *b)

View file

@ -28,7 +28,6 @@
#include <unistd.h>
#include <nm-utils.h>
#include "nm-test-helpers.h"
#include "nm-linux-platform.h"
#include "nm-logging.h"
@ -38,6 +37,8 @@
#include "connection_parser.h"
#include "nm-config.h"
#include "nm-test-utils.h"
/* Fake NMConfig handling; the values it returns don't matter, so this
* is easier than forcing it to read our own config file, etc.
*/

View file

@ -23,12 +23,12 @@
#include <nm-utils.h>
#include "nm-test-helpers.h"
#include "nm-logging.h"
#include "interface_parser.h"
#include "parser.h"
#include "nm-test-utils.h"
typedef struct {
char *key;
char *data;

View file

@ -41,12 +41,13 @@
#include <nm-setting-8021x.h>
#include <nm-setting-infiniband.h>
#include "nm-test-helpers.h"
#include "nm-glib-compat.h"
#include "reader.h"
#include "writer.h"
#include "nm-test-utils.h"
#define TEST_WIRED_FILE TEST_KEYFILES_DIR"/Test_Wired_Connection"
#define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection"

View file

@ -39,12 +39,13 @@
#include <nm-setting-ip4-config.h>
#include <nm-setting-8021x.h>
#include "nm-test-helpers.h"
#include "nm-glib-compat.h"
#include "nm-supplicant-config.h"
#include "nm-supplicant-settings-verify.h"
#include "nm-test-utils.h"
static gboolean
validate_opt (const char *detail,
GHashTable *hash,

View file

@ -25,12 +25,13 @@
#include <arpa/inet.h>
#include <string.h>
#include "nm-test-helpers.h"
#include <nm-utils.h>
#include "nm-dhcp-manager.h"
#include "nm-logging.h"
#include "nm-test-utils.h"
typedef struct {
const char *name;
const char *value;