diff options
Diffstat (limited to 'libnm-util')
45 files changed, 440 insertions, 177 deletions
diff --git a/libnm-util/NetworkManager.h b/libnm-util/NetworkManager.h index 5e1c3f9f..2aa2e357 100644 --- a/libnm-util/NetworkManager.h +++ b/libnm-util/NetworkManager.h @@ -66,7 +66,6 @@ #define NM_DBUS_INTERFACE_DEVICE_VXLAN NM_DBUS_INTERFACE_DEVICE ".Vxlan" #define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre" - #define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManager.Settings" #define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManager/Settings" @@ -196,7 +195,6 @@ typedef enum { /*< flags >*/ NM_DEVICE_CAP_IS_SOFTWARE = 0x00000004, } NMDeviceCapabilities; - /** * NMDeviceWifiCapabilities: * @NM_WIFI_DEVICE_CAP_NONE: device has no encryption/authentication capabilities @@ -229,7 +227,6 @@ typedef enum { /*< flags >*/ NM_WIFI_DEVICE_CAP_FREQ_5GHZ = 0x00000400, } NMDeviceWifiCapabilities; - /** * NM80211ApFlags: * @NM_802_11_AP_FLAGS_NONE: access point has no special capabilities @@ -343,7 +340,6 @@ typedef enum { /*< flags >*/ NM_DEVICE_MODEM_CAPABILITY_LTE = 0x00000008, } NMDeviceModemCapabilities; - /** * NMDeviceState: * @NM_DEVICE_STATE_UNKNOWN: the device's state is unknown @@ -398,7 +394,6 @@ typedef enum { NM_DEVICE_STATE_FAILED = 120, } NMDeviceState; - /** * NMDeviceStateReason: * @NM_DEVICE_STATE_REASON_NONE: No reason given @@ -535,7 +530,6 @@ typedef enum { NM_DEVICE_STATE_REASON_LAST = 0xFFFF, } NMDeviceStateReason; - /** * NMActiveConnectionState: * @NM_ACTIVE_CONNECTION_STATE_UNKNOWN: the state of the connection is unknown diff --git a/libnm-util/NetworkManagerVPN.h b/libnm-util/NetworkManagerVPN.h index 75661986..39a5d961 100644 --- a/libnm-util/NetworkManagerVPN.h +++ b/libnm-util/NetworkManagerVPN.h @@ -54,7 +54,6 @@ #define NM_DBUS_VPN_BAD_ARGUMENTS "BadArguments" #define NM_DBUS_VPN_INTERACTIVE_NOT_SUPPORTED "InteractiveNotSupported" - /* * VPN daemon signals */ @@ -89,7 +88,6 @@ typedef enum NMVPNServiceState { NM_VPN_SERVICE_STATE_STOPPED } NMVPNServiceState; - /** * NMVPNConnectionState: * @NM_VPN_CONNECTION_STATE_UNKNOWN: The state of the VPN connection is @@ -177,7 +175,6 @@ typedef enum { NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG } NMVPNPluginFailure; - /*** Generic config ***/ /* string: VPN interface name (tun0, tap0, etc) */ @@ -203,7 +200,6 @@ typedef enum { */ #define NM_VPN_PLUGIN_CAN_PERSIST "can-persist" - /*** Ip4Config ***/ /* uint32: IP address of the internal gateway of the subnet the VPN interface is @@ -257,7 +253,6 @@ typedef enum { #define NM_VPN_PLUGIN_IP4_CONFIG_MTU NM_VPN_PLUGIN_CONFIG_MTU #define NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV NM_VPN_PLUGIN_CONFIG_TUNDEV - /*** Ip6Config ***/ /* array of uint8: IP address of the internal gateway of the subnet the VPN interface is diff --git a/libnm-util/crypto.c b/libnm-util/crypto.c index 9778edeb..5d1a37ff 100644 --- a/libnm-util/crypto.c +++ b/libnm-util/crypto.c @@ -40,7 +40,6 @@ _nm_crypto_error_quark (void) return quark; } - #define PEM_RSA_KEY_BEGIN "-----BEGIN RSA PRIVATE KEY-----" #define PEM_RSA_KEY_END "-----END RSA PRIVATE KEY-----" diff --git a/libnm-util/crypto_gnutls.c b/libnm-util/crypto_gnutls.c index 8604c5c3..47c614b9 100644 --- a/libnm-util/crypto_gnutls.c +++ b/libnm-util/crypto_gnutls.c @@ -242,15 +242,12 @@ crypto_encrypt (const char *cipher, gsize padded_buf_len, pad_len, output_len; char *padded_buf = NULL; guint32 i; - gsize salt_len; - if (!strcmp (cipher, CIPHER_DES_EDE3_CBC)) { + if (!strcmp (cipher, CIPHER_DES_EDE3_CBC)) cipher_mech = GNUTLS_CIPHER_3DES_CBC; - salt_len = SALT_LEN; - } else if (!strcmp (cipher, CIPHER_AES_CBC)) { + else if (!strcmp (cipher, CIPHER_AES_CBC)) cipher_mech = GNUTLS_CIPHER_AES_128_CBC; - salt_len = iv_len; - } else { + else { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERR_UNKNOWN_CIPHER, _("Private key cipher '%s' was unknown."), diff --git a/libnm-util/meson.build b/libnm-util/meson.build new file mode 100644 index 00000000..55df5501 --- /dev/null +++ b/libnm-util/meson.build @@ -0,0 +1,195 @@ +libnm_util_inc = include_directories('.') + +enums_headers = [version_header] + files( + 'nm-connection.h', + 'nm-setting-8021x.h', + 'nm-setting-adsl.h', + 'nm-setting-bluetooth.h', + 'nm-setting-bond.h', + 'nm-setting-bridge.h', + 'nm-setting-bridge-port.h', + 'nm-setting-cdma.h', + 'nm-setting-connection.h', + 'nm-setting-dcb.h', + 'nm-setting-generic.h', + 'nm-setting-gsm.h', + 'nm-setting.h', + 'nm-setting-infiniband.h', + 'nm-setting-ip4-config.h', + 'nm-setting-ip6-config.h', + 'nm-setting-olpc-mesh.h', + 'nm-setting-ppp.h', + 'nm-setting-pppoe.h', + 'nm-setting-serial.h', + 'nm-setting-team.h', + 'nm-setting-team-port.h', + 'nm-setting-vlan.h', + 'nm-setting-vpn.h', + 'nm-setting-wimax.h', + 'nm-setting-wired.h', + 'nm-setting-wireless.h', + 'nm-setting-wireless-security.h', + 'nm-utils.h', + 'nm-version.h' +) + +headers = enums_headers + files( + 'NetworkManager.h', + 'NetworkManagerVPN.h' +) + +install_headers( + headers, + subdir: nm_name +) + +enum_types = 'nm-utils-enum-types' + +libnm_utils_enum = gnome.mkenums( + enum_types, + sources: enums_headers, + identifier_prefix: nm_id_prefix, + c_template: enum_types + '.c.template', + h_template: enum_types + '.h.template', + install_header: true, + install_dir: nm_pkgincludedir +) + +sources = files( + 'crypto.c', + 'crypto_' + crypto + '.c', + 'nm-connection.c', + 'nm-param-spec-specialized.c', + 'nm-setting-8021x.c', + 'nm-setting-adsl.c', + 'nm-setting-bluetooth.c', + 'nm-setting-bridge.c', + 'nm-setting-bridge-port.c', + 'nm-setting-bond.c', + 'nm-setting.c', + 'nm-setting-cdma.c', + 'nm-setting-connection.c', + 'nm-setting-dcb.c', + 'nm-setting-generic.c', + 'nm-setting-gsm.c', + 'nm-setting-infiniband.c', + 'nm-setting-ip4-config.c', + 'nm-setting-ip6-config.c', + 'nm-setting-olpc-mesh.c', + 'nm-setting-ppp.c', + 'nm-setting-pppoe.c', + 'nm-setting-serial.c', + 'nm-setting-team.c', + 'nm-setting-team-port.c', + 'nm-setting-wimax.c', + 'nm-setting-wired.c', + 'nm-setting-wireless.c', + 'nm-setting-wireless-security.c', + 'nm-setting-vlan.c', + 'nm-setting-vpn.c', + 'nm-utils.c', + 'nm-value-transforms.c' +) +sources += shared_files_libnm_util + +deps = [ + crypto_dep, + dbus_dep, + dbus_glib_dep, + shared_dep, + uuid_dep +] + +common_cflags = [ + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL', + '-DNMLOCALEDIR="@0@"'.format(nm_localedir), +] + +cflags = common_cflags + [ + '-DG_LOG_DOMAIN="@0@"'.format(libnm_util_name) +] + +linker_script = join_paths(meson.current_source_dir(), 'libnm-util.ver') + +libnm_util = shared_library( + 'nm-util', + sources: sources + libnm_utils_enum, + version: libnm_util_version, + dependencies: deps, + c_args: cflags, + link_args: [ + '-Wl,--version-script,@0@'.format(linker_script), + ], + link_depends: linker_script, + install: true +) + +libnm_util_dep = declare_dependency( + sources: libnm_utils_enum[1], + include_directories: libnm_util_inc, + link_with: libnm_util +) + +pkg.generate( + libraries: libnm_util, + version: nm_version, + name: libnm_util_name, + description: 'Convenience library for clients of NetworkManager', + filebase: libnm_util_name, + subdirs: nm_name, + requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1', + variables: 'exec_prefix=${prefix}' +) + +if enable_introspection + gir_sources = sources + headers + libnm_utils_enum + + gir_includes = [ + 'DBusGLib-1.0', + 'GObject-2.0' + ] + + libnm_util_gir = gnome.generate_gir( + libnm_util, + sources: gir_sources, + nsversion: nm_gir_version, + namespace: nm_name, + identifier_prefix: nm_id_prefix, + symbol_prefix: nm_id_prefix.to_lower(), + export_packages: libnm_util_name, + includes: gir_includes, + install: true + ) + + libnm_util_gir_dep = declare_dependency( + sources: libnm_util_gir, + link_with: libnm_util + ) +endif + +run_target( + 'check-local-exports-' + libnm_util_name, + command: [check_exports, libnm_util.full_path(), linker_script], + depends: libnm_util +) + +sources = files( + 'crypto.c', + 'crypto_' + crypto + '.c' +) + +deps = [ + crypto_dep, + shared_dep +] + +libtest_crypto = static_library( + 'test-crypto', + sources: sources, + dependencies: deps, + c_args: cflags +) + +if enable_tests + subdir('tests') +endif diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index b929fdcd..3ddea2d7 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -120,10 +120,8 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; - static NMSettingVerifyResult _nm_connection_verify (NMConnection *connection, GError **error); - /*****************************************************************************/ /** @@ -493,7 +491,6 @@ nm_connection_compare (NMConnection *a, return TRUE; } - static void diff_one_connection (NMConnection *a, NMConnection *b, @@ -1023,7 +1020,7 @@ nm_connection_update_secrets (NMConnection *connection, g_signal_handlers_block_by_func (setting, (GCallback) setting_changed_cb, connection); success_detail = _nm_setting_update_secrets (setting, - setting_hash ? setting_hash : secrets, + setting_hash ?: secrets, error); g_signal_handlers_unblock_by_func (setting, (GCallback) setting_changed_cb, connection); diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c index a4e01d8f..fc8d0318 100644 --- a/libnm-util/nm-param-spec-specialized.c +++ b/libnm-util/nm-param-spec-specialized.c @@ -956,8 +956,6 @@ main (int argc, char *argv[]) { DBusGConnection *bus; - nm_g_type_init (); - bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); compare_ints (); diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c index 5cb19818..ae7a47e6 100644 --- a/libnm-util/nm-setting-8021x.c +++ b/libnm-util/nm-setting-8021x.c @@ -1342,7 +1342,6 @@ nm_setting_802_1x_remove_phase2_altsubject_match (NMSetting8021x *setting, guint g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES); } - /** * nm_setting_802_1x_remove_phase2_altsubject_match_by_value: * @setting: the #NMSetting8021x @@ -2535,7 +2534,6 @@ static void need_secrets_phase2 (NMSetting8021x *self, GPtrArray *secrets, gboolean phase2); - typedef void (*EAPMethodNeedSecretsFunc) (NMSetting8021x *self, GPtrArray *secrets, gboolean phase2); @@ -2601,7 +2599,6 @@ need_secrets_phase2 (NMSetting8021x *self, } } - static GPtrArray * need_secrets (NMSetting *setting) { diff --git a/libnm-util/nm-setting-8021x.h b/libnm-util/nm-setting-8021x.h index 3de8f4c3..b3e1e540 100644 --- a/libnm-util/nm-setting-8021x.h +++ b/libnm-util/nm-setting-8021x.h @@ -65,7 +65,6 @@ typedef enum { /*< underscore_name=nm_setting_802_1x_ck_scheme >*/ NM_SETTING_802_1X_CK_SCHEME_PATH } NMSetting8021xCKScheme; - #define NM_TYPE_SETTING_802_1X (nm_setting_802_1x_get_type ()) #define NM_SETTING_802_1X(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_802_1X, NMSetting8021x)) #define NM_SETTING_802_1X_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_802_1X, NMSetting8021xClass)) @@ -91,7 +90,6 @@ typedef enum { /*< underscore_name=nm_setting_802_1x_error >*/ #define NM_SETTING_802_1X_ERROR nm_setting_802_1x_error_quark () GQuark nm_setting_802_1x_error_quark (void); - #define NM_SETTING_802_1X_EAP "eap" #define NM_SETTING_802_1X_IDENTITY "identity" #define NM_SETTING_802_1X_ANONYMOUS_IDENTITY "anonymous-identity" @@ -291,7 +289,6 @@ NMSettingSecretFlags nm_setting_802_1x_get_phase2_private_key_password_flags ( NMSetting8021xCKFormat nm_setting_802_1x_get_phase2_private_key_format (NMSetting8021x *setting); - G_END_DECLS #endif /* NM_SETTING_8021X_H */ diff --git a/libnm-util/nm-setting-adsl.c b/libnm-util/nm-setting-adsl.c index 5c177570..f2305b38 100644 --- a/libnm-util/nm-setting-adsl.c +++ b/libnm-util/nm-setting-adsl.c @@ -226,7 +226,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) NM_SETTING_ADSL_ERROR, NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, _("'%s' is not a valid value for the property"), - priv->protocol ? priv->protocol : "(null)"); + priv->protocol ?: "(null)"); g_prefix_error (error, "%s.%s: ", NM_SETTING_ADSL_SETTING_NAME, NM_SETTING_ADSL_PROTOCOL); return FALSE; } diff --git a/libnm-util/nm-setting-bluetooth.c b/libnm-util/nm-setting-bluetooth.c index db0b3e92..d26a5b8f 100644 --- a/libnm-util/nm-setting-bluetooth.c +++ b/libnm-util/nm-setting-bluetooth.c @@ -60,7 +60,6 @@ nm_setting_bluetooth_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingBluetooth, nm_setting_bluetooth, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_BLUETOOTH_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c index f56cb428..5a9b9634 100644 --- a/libnm-util/nm-setting-bond.c +++ b/libnm-util/nm-setting-bond.c @@ -61,7 +61,6 @@ nm_setting_bond_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingBond, nm_setting_bond, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_BOND_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-bridge.c b/libnm-util/nm-setting-bridge.c index 833728b9..cc189c57 100644 --- a/libnm-util/nm-setting-bridge.c +++ b/libnm-util/nm-setting-bridge.c @@ -64,7 +64,6 @@ nm_setting_bridge_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingBridge, nm_setting_bridge, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_BRIDGE_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-cdma.c b/libnm-util/nm-setting-cdma.c index 794945f1..fc76be60 100644 --- a/libnm-util/nm-setting-cdma.c +++ b/libnm-util/nm-setting-cdma.c @@ -54,7 +54,6 @@ nm_setting_cdma_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingCdma, nm_setting_cdma, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_CDMA_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c index 28d5fca7..e51d2c91 100644 --- a/libnm-util/nm-setting-connection.c +++ b/libnm-util/nm-setting-connection.c @@ -58,7 +58,6 @@ nm_setting_connection_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingConnection, nm_setting_connection, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_CONNECTION_SETTING_NAME, g_define_type_id, @@ -273,7 +272,6 @@ nm_setting_connection_get_connection_type (NMSettingConnection *setting) return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->type; } - /** * nm_setting_connection_get_num_permissions: * @setting: the #NMSettingConnection @@ -753,7 +751,6 @@ nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting) return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->gateway_ping_timeout; } - static gboolean verify (NMSetting *setting, GSList *all_settings, GError **error) { diff --git a/libnm-util/nm-setting-dcb.c b/libnm-util/nm-setting-dcb.c index eaed4ff5..2cd0bdaf 100644 --- a/libnm-util/nm-setting-dcb.c +++ b/libnm-util/nm-setting-dcb.c @@ -64,7 +64,6 @@ nm_setting_dcb_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingDcb, nm_setting_dcb, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_DCB_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-dcb.h b/libnm-util/nm-setting-dcb.h index 626f815d..2757200e 100644 --- a/libnm-util/nm-setting-dcb.h +++ b/libnm-util/nm-setting-dcb.h @@ -88,7 +88,6 @@ typedef enum { */ #define NM_SETTING_DCB_FCOE_MODE_VN2VN "vn2vn" - /* Properties */ #define NM_SETTING_DCB_APP_FCOE_FLAGS "app-fcoe-flags" #define NM_SETTING_DCB_APP_FCOE_PRIORITY "app-fcoe-priority" @@ -110,7 +109,6 @@ typedef enum { #define NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH "priority-strict-bandwidth" #define NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS "priority-traffic-class" - typedef struct { NMSetting parent; } NMSettingDcb; diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c index fd11ce67..82ebde33 100644 --- a/libnm-util/nm-setting-gsm.c +++ b/libnm-util/nm-setting-gsm.c @@ -55,7 +55,6 @@ nm_setting_gsm_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingGsm, nm_setting_gsm, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_GSM_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c index 74f4d312..6a01fca9 100644 --- a/libnm-util/nm-setting-ip4-config.c +++ b/libnm-util/nm-setting-ip4-config.c @@ -990,13 +990,11 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return TRUE; } - static void nm_setting_ip4_config_init (NMSettingIP4Config *setting) { NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - priv->dns = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); } @@ -1396,7 +1394,6 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) G_PARAM_STATIC_STRINGS)); } - struct NMIP4Address { guint32 refcount; guint32 address; /* network byte order */ @@ -1607,7 +1604,6 @@ nm_ip4_address_set_gateway (NMIP4Address *address, guint32 gateway) address->gateway = gateway; } - struct NMIP4Route { guint32 refcount; diff --git a/libnm-util/nm-setting-ip4-config.h b/libnm-util/nm-setting-ip4-config.h index 1365de29..4d50547d 100644 --- a/libnm-util/nm-setting-ip4-config.h +++ b/libnm-util/nm-setting-ip4-config.h @@ -164,7 +164,6 @@ guint32 nm_ip4_route_get_metric (NMIP4Route *route); void nm_ip4_route_set_metric (NMIP4Route *route, guint32 metric); - typedef struct { NMSetting parent; } NMSettingIP4Config; diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c index 1566fe99..6beeb7da 100644 --- a/libnm-util/nm-setting-ip6-config.c +++ b/libnm-util/nm-setting-ip6-config.c @@ -83,7 +83,6 @@ typedef struct { NMSettingIP6ConfigPrivacy ip6_privacy; } NMSettingIP6ConfigPrivate; - enum { PROP_0, PROP_METHOD, @@ -174,7 +173,6 @@ nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i) { NMSettingIP6ConfigPrivate *priv; - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); @@ -946,7 +944,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return TRUE; } - static void nm_setting_ip6_config_init (NMSettingIP6Config *setting) { diff --git a/libnm-util/nm-setting-ip6-config.h b/libnm-util/nm-setting-ip6-config.h index 0a2f00dd..2a32a920 100644 --- a/libnm-util/nm-setting-ip6-config.h +++ b/libnm-util/nm-setting-ip6-config.h @@ -69,7 +69,6 @@ GQuark nm_setting_ip6_config_error_quark (void); #define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy" #define NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME "dhcp-hostname" - /** * NM_SETTING_IP6_CONFIG_METHOD_IGNORE: * @@ -143,7 +142,6 @@ typedef enum { NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR = 2 } NMSettingIP6ConfigPrivacy; - typedef struct NMIP6Address NMIP6Address; GType nm_ip6_address_get_type (void); diff --git a/libnm-util/nm-setting-ppp.c b/libnm-util/nm-setting-ppp.c index 54b070be..3437d1a1 100644 --- a/libnm-util/nm-setting-ppp.c +++ b/libnm-util/nm-setting-ppp.c @@ -53,7 +53,6 @@ nm_setting_ppp_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingPPP, nm_setting_ppp, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_PPP_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-pppoe.c b/libnm-util/nm-setting-pppoe.c index 5b729c85..e66165fd 100644 --- a/libnm-util/nm-setting-pppoe.c +++ b/libnm-util/nm-setting-pppoe.c @@ -55,7 +55,6 @@ nm_setting_pppoe_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingPPPOE, nm_setting_pppoe, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_PPPOE_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h index ba15a238..e2e02398 100644 --- a/libnm-util/nm-setting-private.h +++ b/libnm-util/nm-setting-private.h @@ -80,7 +80,6 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting, NMSettingClearSecretsWithFlagsFn func, gpointer user_data); - /* NM_SETTING_COMPARE_FLAG_INFERRABLE: check whether a device-generated * connection can be replaced by a already-defined connection. This flag only * takes into account properties marked with the %NM_SETTING_PARAM_INFERRABLE @@ -105,7 +104,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting, /* Ensure the setting's GType is registered at library load time */ #define NM_SETTING_REGISTER_TYPE(x) \ static void __attribute__((constructor)) register_setting (void) \ -{ nm_g_type_init (); g_type_ensure (x); } +{ g_type_ensure (x); } NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name); diff --git a/libnm-util/nm-setting-serial.c b/libnm-util/nm-setting-serial.c index 8a4b079d..369c4b10 100644 --- a/libnm-util/nm-setting-serial.c +++ b/libnm-util/nm-setting-serial.c @@ -55,7 +55,6 @@ nm_setting_serial_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingSerial, nm_setting_serial, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_SERIAL_SETTING_NAME, g_define_type_id, @@ -73,7 +72,6 @@ typedef struct { guint64 send_delay; } NMSettingSerialPrivate; - enum { PROP_0, PROP_BAUD, diff --git a/libnm-util/nm-setting-team.c b/libnm-util/nm-setting-team.c index f5dcdc94..0ec40320 100644 --- a/libnm-util/nm-setting-team.c +++ b/libnm-util/nm-setting-team.c @@ -61,7 +61,6 @@ nm_setting_team_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingTeam, nm_setting_team, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_TEAM_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c index e47fe394..1fed9eca 100644 --- a/libnm-util/nm-setting-vpn.c +++ b/libnm-util/nm-setting-vpn.c @@ -63,7 +63,6 @@ nm_setting_vpn_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingVPN, nm_setting_vpn, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_VPN_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-wimax.c b/libnm-util/nm-setting-wimax.c index 60beb912..102fbb5c 100644 --- a/libnm-util/nm-setting-wimax.c +++ b/libnm-util/nm-setting-wimax.c @@ -62,7 +62,6 @@ nm_setting_wimax_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingWimax, nm_setting_wimax, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_WIMAX_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-wired.c b/libnm-util/nm-setting-wired.c index 85ba0f5e..8b297ee6 100644 --- a/libnm-util/nm-setting-wired.c +++ b/libnm-util/nm-setting-wired.c @@ -60,7 +60,6 @@ nm_setting_wired_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingWired, nm_setting_wired, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_WIRED_SETTING_NAME, g_define_type_id, @@ -947,7 +946,7 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS)); - + /** * NMSettingWired:mac-address-blacklist: * diff --git a/libnm-util/nm-setting-wireless-security.c b/libnm-util/nm-setting-wireless-security.c index 22808fea..00d35a2f 100644 --- a/libnm-util/nm-setting-wireless-security.c +++ b/libnm-util/nm-setting-wireless-security.c @@ -73,7 +73,6 @@ nm_setting_wireless_security_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingWirelessSecurity, nm_setting_wireless_security, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting-wireless.c b/libnm-util/nm-setting-wireless.c index 3341fc8b..d3040811 100644 --- a/libnm-util/nm-setting-wireless.c +++ b/libnm-util/nm-setting-wireless.c @@ -61,7 +61,6 @@ nm_setting_wireless_error_quark (void) return quark; } - G_DEFINE_TYPE_WITH_CODE (NMSettingWireless, nm_setting_wireless, NM_TYPE_SETTING, _nm_register_setting (NM_SETTING_WIRELESS_SETTING_NAME, g_define_type_id, diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 3bcefbc5..c74d2d71 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -102,7 +102,6 @@ static void _ensure_registered (void) { if (G_UNLIKELY (registered_settings == NULL)) { - nm_g_type_init (); _nm_value_transforms_register (); registered_settings = g_hash_table_new (g_str_hash, g_str_equal); registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal); @@ -1330,7 +1329,6 @@ nm_setting_get_virtual_iface_name (NMSetting *setting) return NULL; } - NMSettingVerifyResult _nm_setting_verify_deprecated_virtual_iface_name (const char *interface_name, gboolean allow_missing, diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h index ce5cf3f5..1470a69b 100644 --- a/libnm-util/nm-setting.h +++ b/libnm-util/nm-setting.h @@ -62,7 +62,6 @@ typedef enum #define NM_SETTING_ERROR nm_setting_error_quark () GQuark nm_setting_error_quark (void); - /* DEPRECATED AND UNUSED */ #define NM_SETTING_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT)) @@ -79,7 +78,6 @@ GQuark nm_setting_error_quark (void); /* Note: all non-glib GParamFlags bits are reserved by NetworkManager */ - #define NM_SETTING_NAME "name" /** @@ -156,7 +154,6 @@ typedef enum { /* 0x80000000 is used for a private flag */ } NMSettingCompareFlags; - /** * NMSetting: * @@ -167,7 +164,6 @@ typedef struct { GObject parent; } NMSetting; - /** * NMSettingClearSecretsWithFlagsFn: * @setting: The setting for which secrets are being iterated @@ -241,7 +237,6 @@ typedef void (*NMSettingValueIterFn) (NMSetting *setting, GParamFlags flags, gpointer user_data); - GType nm_setting_get_type (void); /** diff --git a/libnm-util/nm-utils-enum-types.c.template b/libnm-util/nm-utils-enum-types.c.template new file mode 100644 index 00000000..e6505d34 --- /dev/null +++ b/libnm-util/nm-utils-enum-types.c.template @@ -0,0 +1,65 @@ +/*** BEGIN file-header ***/ +#include "config.h" + +#include "nm-utils-enum-types.h" + +#include "nm-version-macros.h" +#include "nm-connection.h" +#include "nm-setting.h" +#include "nm-setting-8021x.h" +#include "nm-setting-adsl.h" +#include "nm-setting-bluetooth.h" +#include "nm-setting-bond.h" +#include "nm-setting-team.h" +#include "nm-setting-team-port.h" +#include "nm-setting-bridge.h" +#include "nm-setting-bridge-port.h" +#include "nm-setting-connection.h" +#include "nm-setting-dcb.h" +#include "nm-setting-infiniband.h" +#include "nm-setting-ip4-config.h" +#include "nm-setting-vlan.h" +#include "nm-setting-ip6-config.h" +#include "nm-setting-ppp.h" +#include "nm-setting-pppoe.h" +#include "nm-setting-serial.h" +#include "nm-setting-generic.h" +#include "nm-setting-gsm.h" +#include "nm-setting-cdma.h" +#include "nm-setting-olpc-mesh.h" +#include "nm-setting-wimax.h" +#include "nm-setting-wired.h" +#include "nm-setting-wireless.h" +#include "nm-setting-wireless-security.h" +#include "nm-setting-vpn.h" +#include "nm-utils.h" +#include "nm-version.h" +/*** END file-header ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ diff --git a/libnm-util/nm-utils-enum-types.h.template b/libnm-util/nm-utils-enum-types.h.template new file mode 100644 index 00000000..ac0cc3c8 --- /dev/null +++ b/libnm-util/nm-utils-enum-types.h.template @@ -0,0 +1,21 @@ +/*** BEGIN file-header ***/ +#ifndef __NM_UTILS_ENUM_TYPES_H__ +#define __NM_UTILS_ENUM_TYPES_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN enumeration-production ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __NM_UTILS_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 9330aaaa..2af9432f 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -55,7 +55,7 @@ struct EncodingTriplet struct IsoLangToEncodings { - const char * lang; + const char *lang; struct EncodingTriplet encodings; }; @@ -63,13 +63,13 @@ struct IsoLangToEncodings static const struct IsoLangToEncodings isoLangEntries5[] = { /* Simplified Chinese */ - { "zh_cn", {"euc-cn", "gb2312", "gb18030"} }, /* PRC */ - { "zh_sg", {"euc-cn", "gb2312", "gb18030"} }, /* Singapore */ + { "zh_cn", {"euc-cn", "gb2312", "gb18030"} }, /* PRC */ + { "zh_sg", {"euc-cn", "gb2312", "gb18030"} }, /* Singapore */ /* Traditional Chinese */ - { "zh_tw", {"big5", "euc-tw", NULL} }, /* Taiwan */ - { "zh_hk", {"big5", "euc-tw", "big5-hkcs"} },/* Hong Kong */ - { "zh_mo", {"big5", "euc-tw", NULL} }, /* Macau */ + { "zh_tw", {"big5", "euc-tw", NULL} }, /* Taiwan */ + { "zh_hk", {"big5", "euc-tw", "big5-hkcs"} },/* Hong Kong */ + { "zh_mo", {"big5", "euc-tw", NULL} }, /* Macau */ /* Table end */ { NULL, {NULL, NULL, NULL} } @@ -79,55 +79,54 @@ static const struct IsoLangToEncodings isoLangEntries5[] = static const struct IsoLangToEncodings isoLangEntries2[] = { /* Japanese */ - { "ja", {"euc-jp", "shift_jis", "iso-2022-jp"} }, + { "ja", {"euc-jp", "shift_jis", "iso-2022-jp"} }, /* Korean */ - { "ko", {"euc-kr", "iso-2022-kr", "johab"} }, + { "ko", {"euc-kr", "iso-2022-kr", "johab"} }, /* Thai */ - { "th", {"iso-8859-11","windows-874", NULL} }, + { "th", {"iso-8859-11","windows-874", NULL} }, /* Central European */ - { "hu", {"iso-8859-2", "windows-1250", NULL} }, /* Hungarian */ - { "cs", {"iso-8859-2", "windows-1250", NULL} }, /* Czech */ - { "hr", {"iso-8859-2", "windows-1250", NULL} }, /* Croatian */ - { "pl", {"iso-8859-2", "windows-1250", NULL} }, /* Polish */ - { "ro", {"iso-8859-2", "windows-1250", NULL} }, /* Romanian */ - { "sk", {"iso-8859-2", "windows-1250", NULL} }, /* Slovakian */ - { "sl", {"iso-8859-2", "windows-1250", NULL} }, /* Slovenian */ - { "sh", {"iso-8859-2", "windows-1250", NULL} }, /* Serbo-Croatian */ + { "hu", {"iso-8859-2", "windows-1250", NULL} }, /* Hungarian */ + { "cs", {"iso-8859-2", "windows-1250", NULL} }, /* Czech */ + { "hr", {"iso-8859-2", "windows-1250", NULL} }, /* Croatian */ + { "pl", {"iso-8859-2", "windows-1250", NULL} }, /* Polish */ + { "ro", {"iso-8859-2", "windows-1250", NULL} }, /* Romanian */ + { "sk", {"iso-8859-2", "windows-1250", NULL} }, /* Slovakian */ + { "sl", {"iso-8859-2", "windows-1250", NULL} }, /* Slovenian */ + { "sh", {"iso-8859-2", "windows-1250", NULL} }, /* Serbo-Croatian */ /* Cyrillic */ - { "ru", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Russian */ - { "be", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Belorussian */ - { "bg", {"windows-1251","koi8-r", "iso-8859-5"} }, /* Bulgarian */ - { "mk", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Macedonian */ - { "sr", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Serbian */ - { "uk", {"koi8-u", "koi8-r", "windows-1251"} }, /* Ukranian */ + { "ru", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Russian */ + { "be", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Belorussian */ + { "bg", {"windows-1251","koi8-r", "iso-8859-5"} }, /* Bulgarian */ + { "mk", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Macedonian */ + { "sr", {"koi8-r", "windows-1251", "iso-8859-5"} }, /* Serbian */ + { "uk", {"koi8-u", "koi8-r", "windows-1251"} }, /* Ukranian */ /* Arabic */ - { "ar", {"iso-8859-6", "windows-1256", NULL} }, + { "ar", {"iso-8859-6", "windows-1256", NULL} }, /* Baltic */ - { "et", {"iso-8859-4", "windows-1257", NULL} }, /* Estonian */ - { "lt", {"iso-8859-4", "windows-1257", NULL} }, /* Lithuanian */ - { "lv", {"iso-8859-4", "windows-1257", NULL} }, /* Latvian */ + { "et", {"iso-8859-4", "windows-1257", NULL} }, /* Estonian */ + { "lt", {"iso-8859-4", "windows-1257", NULL} }, /* Lithuanian */ + { "lv", {"iso-8859-4", "windows-1257", NULL} }, /* Latvian */ /* Greek */ - { "el", {"iso-8859-7", "windows-1253", NULL} }, + { "el", {"iso-8859-7", "windows-1253", NULL} }, /* Hebrew */ - { "he", {"iso-8859-8", "windows-1255", NULL} }, - { "iw", {"iso-8859-8", "windows-1255", NULL} }, + { "he", {"iso-8859-8", "windows-1255", NULL} }, + { "iw", {"iso-8859-8", "windows-1255", NULL} }, /* Turkish */ - { "tr", {"iso-8859-9", "windows-1254", NULL} }, + { "tr", {"iso-8859-9", "windows-1254", NULL} }, /* Table end */ { NULL, {NULL, NULL, NULL} } }; - static GHashTable * langToEncodings5 = NULL; static GHashTable * langToEncodings2 = NULL; @@ -159,16 +158,15 @@ init_lang_to_encodings_hash (void) } } - static gboolean get_encodings_for_lang (const char *lang, char **encoding1, char **encoding2, char **encoding3) { - struct EncodingTriplet * encodings; - gboolean success = FALSE; - char * tmp_lang; + struct EncodingTriplet *encodings; + gboolean success = FALSE; + char *tmp_lang; g_return_val_if_fail (lang != NULL, FALSE); g_return_val_if_fail (encoding1 != NULL, FALSE); @@ -234,7 +232,7 @@ nm_utils_init (GError **error) if (!initialized) { initialized = TRUE; - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); if (!crypto_init (error)) @@ -1105,7 +1103,6 @@ nm_utils_ip4_prefix_to_netmask (guint32 prefix) return _nm_utils_ip4_prefix_to_netmask (prefix); } - /** * nm_utils_ip4_get_default_prefix: * @ip: an IPv4 address (in network byte order) @@ -1674,7 +1671,6 @@ nm_utils_rsa_key_encrypt (const GByteArray *data, GError **error) { - return nm_utils_rsa_key_encrypt_helper (CIPHER_DES_EDE3_CBC, data, in_password, @@ -2478,7 +2474,7 @@ static char _nm_utils_inet_ntop_buffer[NM_UTILS_INET_ADDRSTRLEN]; const char * nm_utils_inet4_ntop (in_addr_t inaddr, char *dst) { - return inet_ntop (AF_INET, &inaddr, dst ? dst : _nm_utils_inet_ntop_buffer, + return inet_ntop (AF_INET, &inaddr, dst ?: _nm_utils_inet_ntop_buffer, INET_ADDRSTRLEN); } @@ -2506,7 +2502,7 @@ const char * nm_utils_inet6_ntop (const struct in6_addr *in6addr, char *dst) { g_return_val_if_fail (in6addr, NULL); - return inet_ntop (AF_INET6, in6addr, dst ? dst : _nm_utils_inet_ntop_buffer, + return inet_ntop (AF_INET6, in6addr, dst ?: _nm_utils_inet_ntop_buffer, INET6_ADDRSTRLEN); } @@ -2578,7 +2574,6 @@ nm_utils_check_virtual_device_compatibility (GType virtual_type, GType other_typ gconstpointer nm_utils_get_private (void); gconstpointer nm_util_get_private (void); - /** * nm_utils_get_private: * diff --git a/libnm-util/nm-value-transforms.c b/libnm-util/nm-value-transforms.c index 2d31f129..13f9eb43 100644 --- a/libnm-util/nm-value-transforms.c +++ b/libnm-util/nm-value-transforms.c @@ -104,7 +104,7 @@ _nm_utils_convert_string_list_to_string (const GValue *src_value, GValue *dest_v for (iter = strings; iter; iter = iter->next) { if (iter != strings) g_string_append_c (printable, ','); - g_string_append (printable, iter->data ? iter->data : "(null)"); + g_string_append (printable, iter->data ?: "(null)"); } g_value_take_string (dest_value, g_string_free (printable, FALSE)); diff --git a/libnm-util/nm-version.h b/libnm-util/nm-version.h index 7173bc6b..f56c3944 100644 --- a/libnm-util/nm-version.h +++ b/libnm-util/nm-version.h @@ -29,17 +29,17 @@ #if !defined (NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) # undef NM_VERSION_MIN_REQUIRED -# define NM_VERSION_MIN_REQUIRED (NM_VERSION_CUR_STABLE) +# define NM_VERSION_MIN_REQUIRED (NM_API_VERSION) #endif #if !defined (NM_VERSION_MAX_ALLOWED) || (NM_VERSION_MAX_ALLOWED == 0) # undef NM_VERSION_MAX_ALLOWED -# define NM_VERSION_MAX_ALLOWED (NM_VERSION_CUR_STABLE) +# define NM_VERSION_MAX_ALLOWED (NM_API_VERSION) #endif /* sanity checks */ -#if NM_VERSION_MIN_REQUIRED > NM_VERSION_NEXT_STABLE -#error "NM_VERSION_MIN_REQUIRED must be <= NM_VERSION_NEXT_STABLE" +#if NM_VERSION_MIN_REQUIRED > NM_API_VERSION +#error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION" #endif #if NM_VERSION_MAX_ALLOWED < NM_VERSION_MIN_REQUIRED #error "NM_VERSION_MAX_ALLOWED must be >= NM_VERSION_MIN_REQUIRED" diff --git a/libnm-util/tests/meson.build b/libnm-util/tests/meson.build new file mode 100644 index 00000000..cf46ad14 --- /dev/null +++ b/libnm-util/tests/meson.build @@ -0,0 +1,45 @@ +deps = [ + dbus_dep, + dbus_glib_dep, + libnm_util_dep, + shared_dep +] + +cflags = common_cflags + [ + '-DNETWORKMANAGER_COMPILATION_TEST', +] + nm_build_cflags + +test = 'test-libnm-linking' + +test_libnm_linking = executable( + test, + test + '.c', + dependencies: deps + [libnm_dep], + c_args: cflags +) + +test_units = [ + ['test-crypto', [libtest_crypto], []], + ['test-general', [], [test_libnm_linking]], + ['test-secrets', [], []], + ['test-setting-8021x', [], []], + ['test-setting-dcb', [], []], + ['test-settings-defaults', [], []] +] + +foreach test_unit: test_units + exe = executable( + 'libnm-util-' + test_unit[0], + test_unit[0] + '.c', + dependencies: deps, + c_args: cflags, + link_with: test_unit[1], + link_depends: test_unit[2] + ) + + test( + 'libnm-util/' + test_unit[0], + test_script, + args: test_args + [exe.full_path()] + ) +endforeach diff --git a/libnm-util/tests/test-crypto.c b/libnm-util/tests/test-crypto.c index 83a183dd..61bd9774 100644 --- a/libnm-util/tests/test-crypto.c +++ b/libnm-util/tests/test-crypto.c @@ -33,6 +33,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" + #if 0 static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----"; static const char *pem_rsa_key_end = "-----END RSA PRIVATE KEY-----"; diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index daa94894..304797a9 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -114,54 +114,54 @@ test_setting_vpn_items (void) nm_setting_vpn_remove_secret (s_vpn, "foobar4"); /* Try to add some blank values and make sure they are rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (key != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (key != NULL)); nm_setting_vpn_add_data_item (s_vpn, NULL, NULL); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strlen (key) > 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strlen (key) > 0)); nm_setting_vpn_add_data_item (s_vpn, "", ""); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (item != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (item != NULL)); nm_setting_vpn_add_data_item (s_vpn, "foobar1", NULL); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strlen (item) > 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strlen (item) > 0)); nm_setting_vpn_add_data_item (s_vpn, "foobar1", ""); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (key != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (key != NULL)); nm_setting_vpn_add_data_item (s_vpn, NULL, "blahblah1"); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strlen (key) > 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strlen (key) > 0)); nm_setting_vpn_add_data_item (s_vpn, "", "blahblah1"); g_test_assert_expected_messages (); nm_setting_vpn_foreach_data_item (s_vpn, vpn_check_empty_func, NULL); /* Try to add some blank secrets and make sure they are rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (key != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (key != NULL)); nm_setting_vpn_add_secret (s_vpn, NULL, NULL); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strlen (key) > 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strlen (key) > 0)); nm_setting_vpn_add_secret (s_vpn, "", ""); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (secret != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (secret != NULL)); nm_setting_vpn_add_secret (s_vpn, "foobar1", NULL); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strlen (secret) > 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strlen (secret) > 0)); nm_setting_vpn_add_secret (s_vpn, "foobar1", ""); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (key != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (key != NULL)); nm_setting_vpn_add_secret (s_vpn, NULL, "blahblah1"); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strlen (key) > 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strlen (key) > 0)); nm_setting_vpn_add_secret (s_vpn, "", "blahblah1"); g_test_assert_expected_messages (); @@ -864,47 +864,47 @@ test_setting_connection_permissions_helpers (void) s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); /* Ensure a bad [type] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strcmp (ptype, "user") == 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strcmp (ptype, "user") == 0)); success = nm_setting_connection_add_permission (s_con, "foobar", "blah", NULL); g_test_assert_expected_messages (); g_assert (!success); /* Ensure a bad [type] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (ptype)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (ptype)); success = nm_setting_connection_add_permission (s_con, NULL, "blah", NULL); g_test_assert_expected_messages (); g_assert (!success); /* Ensure a bad [item] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (uname)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (p != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (uname)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (p != NULL)); success = nm_setting_connection_add_permission (s_con, "user", NULL, NULL); g_test_assert_expected_messages (); g_assert (!success); /* Ensure a bad [item] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (uname[0] != '\0')); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (p != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (uname[0] != '\0')); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (p != NULL)); success = nm_setting_connection_add_permission (s_con, "user", "", NULL); g_test_assert_expected_messages (); g_assert (!success); /* Ensure an [item] with ':' is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strchr (uname, ':') == NULL)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (p != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strchr (uname, ':') == NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (p != NULL)); success = nm_setting_connection_add_permission (s_con, "user", "ad:asdf", NULL); g_test_assert_expected_messages (); g_assert (!success); /* Ensure a non-UTF-8 [item] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (g_utf8_validate (uname, -1, NULL) == TRUE)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (p != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (g_utf8_validate (uname, -1, NULL) == TRUE)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (p != NULL)); success = nm_setting_connection_add_permission (s_con, "user", buf, NULL); g_test_assert_expected_messages (); g_assert (!success); /* Ensure a non-NULL [detail] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (detail == NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (detail == NULL)); success = nm_setting_connection_add_permission (s_con, "user", "dafasdf", "asdf"); g_test_assert_expected_messages (); g_assert (!success); @@ -975,55 +975,56 @@ test_setting_connection_permissions_property (void) s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); /* Ensure a bad [type] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strncmp (str, PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strncmp (str, PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0)); add_permission_property (s_con, "foobar", "blah", -1, NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure a bad [type] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (strncmp (str, PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (strncmp (str, PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0)); add_permission_property (s_con, NULL, "blah", -1, NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure a bad [item] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (last_colon > str)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (last_colon > str)); add_permission_property (s_con, "user", NULL, -1, NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure a bad [item] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (last_colon > str)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (last_colon > str)); add_permission_property (s_con, "user", "", -1, NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure an [item] with ':' in the middle is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (str[i] != ':')); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (str[i] != ':')); add_permission_property (s_con, "user", "ad:asdf", -1, NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure an [item] with ':' at the end is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (str[i] != ':')); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (str[i] != ':')); add_permission_property (s_con, "user", "adasdfaf:", -1, NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure a non-UTF-8 [item] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (g_utf8_validate (str, -1, NULL) == TRUE)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (g_utf8_validate (str, -1, NULL) == TRUE)); add_permission_property (s_con, "user", buf, (int) sizeof (buf), NULL); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure a non-NULL [detail] is rejected */ - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (*(last_colon + 1) == '\0')); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (*(last_colon + 1) == '\0')); add_permission_property (s_con, "user", "dafasdf", -1, "asdf"); g_test_assert_expected_messages (); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 0); /* Ensure a valid call results in success */ success = nm_setting_connection_add_permission (s_con, "user", TEST_UNAME, NULL); + g_assert (success); g_assert_cmpint (nm_setting_connection_get_num_permissions (s_con), ==, 1); check_permission (s_con, 0, TEST_UNAME); @@ -1866,7 +1867,7 @@ test_setting_connection_changed_signal (void) ASSERT_CHANGED (nm_setting_connection_add_permission (s_con, "user", "billsmith", NULL)); ASSERT_CHANGED (nm_setting_connection_remove_permission (s_con, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (iter != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (iter != NULL)); ASSERT_UNCHANGED (nm_setting_connection_remove_permission (s_con, 1)); g_test_assert_expected_messages (); @@ -1874,7 +1875,7 @@ test_setting_connection_changed_signal (void) ASSERT_CHANGED (nm_setting_connection_add_secondary (s_con, uuid)); ASSERT_CHANGED (nm_setting_connection_remove_secondary (s_con, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_connection_remove_secondary (s_con, 1)); g_test_assert_expected_messages (); @@ -1925,7 +1926,7 @@ test_setting_ip4_changed_signal (void) ASSERT_CHANGED (nm_setting_ip4_config_add_dns (s_ip4, 0x1122)); ASSERT_CHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (i <= priv->dns->len)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (i <= priv->dns->len)); ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 1)); g_test_assert_expected_messages (); @@ -1935,7 +1936,7 @@ test_setting_ip4_changed_signal (void) ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com")); ASSERT_CHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 1)); g_test_assert_expected_messages (); @@ -1948,7 +1949,7 @@ test_setting_ip4_changed_signal (void) ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr)); ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1)); g_test_assert_expected_messages (); @@ -1962,7 +1963,7 @@ test_setting_ip4_changed_signal (void) ASSERT_CHANGED (nm_setting_ip4_config_add_route (s_ip4, route)); ASSERT_CHANGED (nm_setting_ip4_config_remove_route (s_ip4, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip4_config_remove_route (s_ip4, 1)); g_test_assert_expected_messages (); @@ -1996,7 +1997,7 @@ test_setting_ip6_changed_signal (void) ASSERT_CHANGED (nm_setting_ip6_config_add_dns (s_ip6, &t)); ASSERT_CHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 1)); g_test_assert_expected_messages (); @@ -2006,7 +2007,7 @@ test_setting_ip6_changed_signal (void) ASSERT_CHANGED (nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com")); ASSERT_CHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 1)); g_test_assert_expected_messages (); @@ -2020,7 +2021,7 @@ test_setting_ip6_changed_signal (void) ASSERT_CHANGED (nm_setting_ip6_config_add_address (s_ip6, addr)); ASSERT_CHANGED (nm_setting_ip6_config_remove_address (s_ip6, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip6_config_remove_address (s_ip6, 1)); g_test_assert_expected_messages (); @@ -2034,7 +2035,7 @@ test_setting_ip6_changed_signal (void) ASSERT_CHANGED (nm_setting_ip6_config_add_route (s_ip6, route)); ASSERT_CHANGED (nm_setting_ip6_config_remove_route (s_ip6, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_ip6_config_remove_route (s_ip6, 1)); g_test_assert_expected_messages (); @@ -2064,7 +2065,7 @@ test_setting_vlan_changed_signal (void) ASSERT_CHANGED (nm_setting_vlan_add_priority (s_vlan, NM_VLAN_INGRESS_MAP, 1, 3)); ASSERT_CHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_INGRESS_MAP, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (idx < g_slist_length (list))); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (idx < g_slist_length (list))); ASSERT_UNCHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_INGRESS_MAP, 1)); g_test_assert_expected_messages (); ASSERT_CHANGED (nm_setting_vlan_add_priority_str (s_vlan, NM_VLAN_INGRESS_MAP, "1:3")); @@ -2072,7 +2073,7 @@ test_setting_vlan_changed_signal (void) ASSERT_CHANGED (nm_setting_vlan_add_priority (s_vlan, NM_VLAN_EGRESS_MAP, 1, 3)); ASSERT_CHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_EGRESS_MAP, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (idx < g_slist_length (list))); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (idx < g_slist_length (list))); ASSERT_UNCHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_EGRESS_MAP, 1)); g_test_assert_expected_messages (); ASSERT_CHANGED (nm_setting_vlan_add_priority_str (s_vlan, NM_VLAN_EGRESS_MAP, "1:3")); @@ -2171,7 +2172,7 @@ test_setting_wireless_security_changed_signal (void) /* Protos */ ASSERT_CHANGED (nm_setting_wireless_security_add_proto (s_wsec, "wpa")); ASSERT_CHANGED (nm_setting_wireless_security_remove_proto (s_wsec, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_wireless_security_remove_proto (s_wsec, 1)); g_test_assert_expected_messages (); @@ -2181,7 +2182,7 @@ test_setting_wireless_security_changed_signal (void) /* Pairwise ciphers */ ASSERT_CHANGED (nm_setting_wireless_security_add_pairwise (s_wsec, "tkip")); ASSERT_CHANGED (nm_setting_wireless_security_remove_pairwise (s_wsec, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_wireless_security_remove_pairwise (s_wsec, 1)); g_test_assert_expected_messages (); @@ -2191,7 +2192,7 @@ test_setting_wireless_security_changed_signal (void) /* Group ciphers */ ASSERT_CHANGED (nm_setting_wireless_security_add_group (s_wsec, "ccmp")); ASSERT_CHANGED (nm_setting_wireless_security_remove_group (s_wsec, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_wireless_security_remove_group (s_wsec, 1)); g_test_assert_expected_messages (); @@ -2226,7 +2227,7 @@ test_setting_802_1x_changed_signal (void) /* EAP methods */ ASSERT_CHANGED (nm_setting_802_1x_add_eap_method (s_8021x, "tls")); ASSERT_CHANGED (nm_setting_802_1x_remove_eap_method (s_8021x, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_802_1x_remove_eap_method (s_8021x, 1)); g_test_assert_expected_messages (); @@ -2236,7 +2237,7 @@ test_setting_802_1x_changed_signal (void) /* alternate subject matches */ ASSERT_CHANGED (nm_setting_802_1x_add_altsubject_match (s_8021x, "EMAIL:server@example.com")); ASSERT_CHANGED (nm_setting_802_1x_remove_altsubject_match (s_8021x, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_802_1x_remove_altsubject_match (s_8021x, 1)); g_test_assert_expected_messages (); @@ -2246,7 +2247,7 @@ test_setting_802_1x_changed_signal (void) /* phase2 alternate subject matches */ ASSERT_CHANGED (nm_setting_802_1x_add_phase2_altsubject_match (s_8021x, "EMAIL:server@example.com")); ASSERT_CHANGED (nm_setting_802_1x_remove_phase2_altsubject_match (s_8021x, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (elt != NULL)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (elt != NULL)); ASSERT_UNCHANGED (nm_setting_802_1x_remove_phase2_altsubject_match (s_8021x, 1)); g_test_assert_expected_messages (); @@ -2427,7 +2428,8 @@ test_libnm_linking (void) int status; GError *error = NULL; - g_spawn_sync (BUILD_DIR, argv, NULL, 0 /*G_SPAWN_DEFAULT*/, + g_spawn_sync (NM_BUILD_BUILDDIR"/libnm-util/tests", + argv, NULL, 0 /*G_SPAWN_DEFAULT*/, _test_libnm_linking_setup_child_process, NULL, &out, &err, &status, &error); g_assert_no_error (error); @@ -2469,12 +2471,12 @@ test_nm_utils_uuid_generate_from_string (void) _test_uuid ("098f6bcd-4621-d373-cade-4e832627b4f6", "test"); _test_uuid ("59c0547b-7fe2-1c15-2cce-e328e8bf6742", "/etc/NetworkManager/system-connections/em1"); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (s && *s)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (s && *s)); uuid_test = nm_utils_uuid_generate_from_string (""); g_assert (uuid_test == NULL); g_test_assert_expected_messages (); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, NMTST_G_RETURN_MSG (s && *s)); + NMTST_EXPECT_LIBNM_U_CRITICAL (NMTST_G_RETURN_MSG (s && *s)); uuid_test = nm_utils_uuid_generate_from_string (NULL); g_assert (uuid_test == NULL); g_test_assert_expected_messages (); diff --git a/libnm-util/tests/test-secrets.c b/libnm-util/tests/test-secrets.c index 2631509c..43c206ff 100644 --- a/libnm-util/tests/test-secrets.c +++ b/libnm-util/tests/test-secrets.c @@ -39,7 +39,8 @@ #include "nm-utils/nm-test-utils.h" -#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" +#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" #define TEST_NEED_SECRETS_EAP_TLS_PRIVATE_KEY TEST_CERT_DIR "/test_key_and_cert.pem" diff --git a/libnm-util/tests/test-setting-8021x.c b/libnm-util/tests/test-setting-8021x.c index a0219639..373b2a75 100644 --- a/libnm-util/tests/test-setting-8021x.c +++ b/libnm-util/tests/test-setting-8021x.c @@ -29,6 +29,8 @@ #include "nm-utils/nm-test-utils.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs" + static void compare_blob_data (const char *test, const char *key_path, diff --git a/libnm-util/tests/test-setting-dcb.c b/libnm-util/tests/test-setting-dcb.c index ee0c997f..eb7113c3 100644 --- a/libnm-util/tests/test-setting-dcb.c +++ b/libnm-util/tests/test-setting-dcb.c @@ -96,23 +96,23 @@ test_dcb_flags_invalid (void) s_dcb = (NMSettingDcb *) nm_setting_dcb_new (); g_assert (s_dcb); - g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); + NMTST_EXPECT ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); TEST_FLAG (NM_SETTING_DCB_APP_FCOE_FLAGS, nm_setting_dcb_get_app_fcoe_flags, 0x332523); g_test_assert_expected_messages (); - g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); + NMTST_EXPECT ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); TEST_FLAG (NM_SETTING_DCB_APP_ISCSI_FLAGS, nm_setting_dcb_get_app_iscsi_flags, 0xFF); g_test_assert_expected_messages (); - g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); + NMTST_EXPECT ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); TEST_FLAG (NM_SETTING_DCB_APP_FIP_FLAGS, nm_setting_dcb_get_app_fip_flags, 0x1111); g_test_assert_expected_messages (); - g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); + NMTST_EXPECT ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); TEST_FLAG (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, nm_setting_dcb_get_priority_flow_control_flags, G_MAXUINT32); g_test_assert_expected_messages (); - g_test_expect_message ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); + NMTST_EXPECT ("GLib-GObject", G_LOG_LEVEL_WARNING, "*invalid or out of range*"); TEST_FLAG (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, nm_setting_dcb_get_priority_group_flags, (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_ADVERTISE | NM_SETTING_DCB_FLAG_WILLING) + 1); g_test_assert_expected_messages (); |