settings/ifupdown: don't use global variables for /e/n/i parser

This commit is contained in:
Thomas Haller 2018-08-25 13:26:46 +02:00
parent 6f14228cb3
commit 70350bb621
4 changed files with 162 additions and 184 deletions

View file

@ -32,33 +32,41 @@
#include "nm-utils.h"
if_block* first;
if_block* last;
if_data* last_data;
struct _if_parser {
if_block* first;
if_block* last;
if_data* last_data;
};
/*****************************************************************************/
static void _ifparser_source (if_parser *parser, const char *path, const char *en_dir, int quiet, int dir);
/*****************************************************************************/
static void
add_block (const char *type, const char* name)
add_block (if_parser *parser, const char *type, const char* name)
{
if_block *ret = g_slice_new0 (struct _if_block);
ret->name = g_strdup (name);
ret->type = g_strdup (type);
if (first == NULL)
first = last = ret;
if (parser->first == NULL)
parser->first = parser->last = ret;
else {
last->next = ret;
last = ret;
parser->last->next = ret;
parser->last = ret;
}
last_data = NULL;
parser->last_data = NULL;
}
static void
add_data (const char *key, const char *data)
add_data (if_parser *parser, const char *key, const char *data)
{
if_data *ret;
char *idx;
/* Check if there is a block where we can attach our data */
if (first == NULL)
if (parser->first == NULL)
return;
ret = g_slice_new0 (struct _if_data);
@ -71,12 +79,12 @@ add_data (const char *key, const char *data)
}
ret->data = g_strdup (data);
if (last->info == NULL) {
last->info = ret;
last_data = ret;
if (parser->last->info == NULL) {
parser->last->info = ret;
parser->last_data = ret;
} else {
last_data->next = ret;
last_data = last_data->next;
parser->last_data->next = ret;
parser->last_data = parser->last_data->next;
}
}
@ -98,10 +106,8 @@ join_values_with_spaces (char *dst, char **src)
return (dst);
}
static void _ifparser_source (const char *path, const char *en_dir, int quiet, int dir);
static void
_recursive_ifparser (const char *eni_file, int quiet)
_recursive_ifparser (if_parser *parser, const char *eni_file, int quiet)
{
FILE *inp;
char line[255];
@ -198,9 +204,9 @@ _recursive_ifparser (const char *eni_file, int quiet)
}
continue;
}
add_block (token[0], token[1]);
add_block (parser, token[0], token[1]);
skip_to_block = 0;
add_data (token[2], join_values_with_spaces (value, token + 3));
add_data (parser, token[2], join_values_with_spaces (value, token + 3));
}
/* auto and allow-auto stanzas are equivalent,
* both can take multiple interfaces as parameters: add one block for each */
@ -208,18 +214,18 @@ _recursive_ifparser (const char *eni_file, int quiet)
int i;
for (i = 1; i < toknum; i++)
add_block ("auto", token[i]);
add_block (parser, "auto", token[i]);
skip_to_block = 0;
}
else if (nm_streq (token[0], "mapping")) {
add_block (token[0], join_values_with_spaces (value, token + 1));
add_block (parser, token[0], join_values_with_spaces (value, token + 1));
skip_to_block = 0;
}
/* allow-* can take multiple interfaces as parameters: add one block for each */
else if (g_str_has_prefix (token[0], "allow-")) {
int i;
for (i = 1; i < toknum; i++)
add_block (token[0], token[i]);
add_block (parser, token[0], token[i]);
skip_to_block = 0;
}
/* source and source-directory stanzas take one or more paths as parameters */
@ -231,9 +237,9 @@ _recursive_ifparser (const char *eni_file, int quiet)
en_dir = g_path_get_dirname (eni_file);
for (i = 1; i < toknum; ++i) {
if (nm_streq (token[0], "source-directory"))
_ifparser_source (token[i], en_dir, quiet, TRUE);
_ifparser_source (parser, token[i], en_dir, quiet, TRUE);
else
_ifparser_source (token[i], en_dir, quiet, FALSE);
_ifparser_source (parser, token[i], en_dir, quiet, FALSE);
}
g_free (en_dir);
}
@ -244,7 +250,7 @@ _recursive_ifparser (const char *eni_file, int quiet)
join_values_with_spaces (value, token));
}
} else
add_data (token[0], join_values_with_spaces (value, token + 1));
add_data (parser, token[0], join_values_with_spaces (value, token + 1));
}
}
fclose (inp);
@ -254,7 +260,7 @@ _recursive_ifparser (const char *eni_file, int quiet)
}
static void
_ifparser_source (const char *path, const char *en_dir, int quiet, int dir)
_ifparser_source (if_parser *parser, const char *path, const char *en_dir, int quiet, int dir)
{
char *abs_path;
const char *item;
@ -287,22 +293,25 @@ _ifparser_source (const char *path, const char *en_dir, int quiet, int dir)
g_clear_error (&error);
} else {
while ((item = g_dir_read_name (source_dir)))
_ifparser_source (item, we.we_wordv[i], quiet, FALSE);
_ifparser_source (parser, item, we.we_wordv[i], quiet, FALSE);
g_dir_close (source_dir);
}
} else
_recursive_ifparser (we.we_wordv[i], quiet);
_recursive_ifparser (parser, we.we_wordv[i], quiet);
}
wordfree (&we);
}
g_free (abs_path);
}
void
ifparser_init (const char *eni_file, int quiet)
if_parser *
ifparser_parse (const char *eni_file, int quiet)
{
first = last = NULL;
_recursive_ifparser (eni_file, quiet);
if_parser *parser;
parser = g_slice_new0 (if_parser);
_recursive_ifparser (parser, eni_file, quiet);
return parser;
}
static void
@ -331,21 +340,21 @@ _destroy_block (if_block* ifb)
}
void
ifparser_destroy (void)
ifparser_destroy (if_parser *parser)
{
_destroy_block (first);
first = last = NULL;
_destroy_block (parser->first);
g_slice_free (if_parser, parser);
}
if_block *ifparser_getfirst (void)
if_block *ifparser_getfirst (if_parser *parser)
{
return first;
return parser->first;
}
int ifparser_get_num_blocks (void)
int ifparser_get_num_blocks (if_parser *parser)
{
int i = 0;
if_block *iter = first;
if_block *iter = parser->first;
while (iter) {
i++;
@ -355,9 +364,9 @@ int ifparser_get_num_blocks (void)
}
if_block *
ifparser_getif (const char* iface)
ifparser_getif (if_parser *parser, const char* iface)
{
if_block *curr = first;
if_block *curr = parser->first;
while (curr != NULL) {
if ( nm_streq (curr->type, "iface")
&& nm_streq (curr->name, iface))

View file

@ -36,14 +36,19 @@ typedef struct _if_block {
struct _if_block *next;
} if_block;
void ifparser_init (const char *eni_file, int quiet);
void ifparser_destroy (void);
typedef struct _if_parser if_parser;
if_block *ifparser_getif (const char* iface);
if_block *ifparser_getfirst (void);
if_parser *ifparser_parse (const char *eni_file, int quiet);
void ifparser_destroy (if_parser *parser);
NM_AUTO_DEFINE_FCN0 (if_parser *, _nm_auto_ifparser, ifparser_destroy);
#define nm_auto_ifparser nm_auto(_nm_auto_ifparser)
if_block *ifparser_getif (if_parser *parser, const char* iface);
if_block *ifparser_getfirst (if_parser *parser);
const char *ifparser_getkey (if_block* iface, const char *key);
gboolean ifparser_haskey (if_block* iface, const char *key);
int ifparser_get_num_blocks (void);
int ifparser_get_num_blocks (if_parser *parser);
int ifparser_get_num_info (if_block* iface);
#endif

View file

@ -152,14 +152,15 @@ initialize (NMSettingsPlugin *plugin)
SettingsPluginIfupdown *self = SETTINGS_PLUGIN_IFUPDOWN (plugin);
SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self);
gs_unref_hashtable GHashTable *auto_ifaces = NULL;
if_block *block = NULL;
nm_auto_ifparser if_parser *parser = NULL;
if_block *block;
GHashTableIter con_iter;
const char *block_name;
NMIfupdownConnection *conn;
/* Read in all the interfaces */
ifparser_init (ENI_INTERFACES_FILE, 0);
for (block = ifparser_getfirst (); block; block = block->next) {
parser = ifparser_parse (ENI_INTERFACES_FILE, 0);
for (block = ifparser_getfirst (parser); block; block = block->next) {
if (NM_IN_STRSET (block->type, "auto", "allow-hotplug")) {
if (!auto_ifaces)

View file

@ -130,14 +130,14 @@ expected_free (Expected *e)
}
static void
compare_expected_to_ifparser (Expected *e)
compare_expected_to_ifparser (if_parser *parser, Expected *e)
{
if_block *n;
GSList *biter, *kiter;
g_assert_cmpint (g_slist_length (e->blocks), ==, ifparser_get_num_blocks ());
g_assert_cmpint (g_slist_length (e->blocks), ==, ifparser_get_num_blocks (parser));
for (n = ifparser_getfirst (), biter = e->blocks;
for (n = ifparser_getfirst (parser), biter = e->blocks;
n && biter;
n = n->next, biter = g_slist_next (biter)) {
if_data *m;
@ -164,12 +164,12 @@ compare_expected_to_ifparser (Expected *e)
}
static void
dump_blocks (void)
dump_blocks (if_parser *parser)
{
if_block *n;
g_message ("\n***************************************************");
for (n = ifparser_getfirst (); n != NULL; n = n->next) {
for (n = ifparser_getfirst (parser); n != NULL; n = n->next) {
if_data *m;
// each block start with its type & name
@ -187,21 +187,24 @@ dump_blocks (void)
g_message ("##################################################\n");
}
static void
init_ifparser_with_file (const char *path, const char *file)
static if_parser *
init_ifparser_with_file (const char *file)
{
char *tmp;
if_parser *parser;
gs_free char *tmp = NULL;
tmp = g_strdup_printf ("%s/%s", path, file);
ifparser_init (tmp, 1);
g_free (tmp);
tmp = g_strdup_printf ("%s/%s", TEST_DIR, file);
parser = ifparser_parse (tmp, 1);
g_assert (parser);
return parser;
}
static void
test1_ignore_line_before_first_block (const char *path)
test1_ignore_line_before_first_block (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test1");
e = expected_new ();
b = expected_block_new ("auto", "eth0");
@ -210,35 +213,33 @@ test1_ignore_line_before_first_block (const char *path)
expected_add_block (e, b);
expected_block_add_key (b, expected_key_new ("inet", "dhcp"));
init_ifparser_with_file (path, "test1");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test2_wrapped_line (const char *path)
test2_wrapped_line (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test2");
e = expected_new ();
b = expected_block_new ("auto", "lo");
expected_add_block (e, b);
init_ifparser_with_file (path, "test2");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test3_wrapped_multiline_multiarg (const char *path)
test3_wrapped_multiline_multiarg (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test3");
e = expected_new ();
b = expected_block_new ("allow-hotplug", "eth0");
@ -248,35 +249,33 @@ test3_wrapped_multiline_multiarg (const char *path)
b = expected_block_new ("allow-hotplug", "bnep0");
expected_add_block (e, b);
init_ifparser_with_file (path, "test3");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test4_allow_auto_is_auto (const char *path)
test4_allow_auto_is_auto (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test4");
e = expected_new ();
b = expected_block_new ("auto", "eth0");
expected_add_block (e, b);
init_ifparser_with_file (path, "test4");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test5_allow_auto_multiarg (const char *path)
test5_allow_auto_multiarg (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test5");
e = expected_new ();
b = expected_block_new ("allow-hotplug", "eth0");
@ -284,52 +283,50 @@ test5_allow_auto_multiarg (const char *path)
b = expected_block_new ("allow-hotplug", "wlan0");
expected_add_block (e, b);
init_ifparser_with_file (path, "test5");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test6_mixed_whitespace (const char *path)
test6_mixed_whitespace (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test6");
e = expected_new ();
b = expected_block_new ("iface", "lo");
expected_block_add_key (b, expected_key_new ("inet", "loopback"));
expected_add_block (e, b);
init_ifparser_with_file (path, "test6");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test7_long_line (const char *path)
test7_long_line (void)
{
init_ifparser_with_file (path, "test7");
g_assert_cmpint (ifparser_get_num_blocks (), ==, 0);
ifparser_destroy ();
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test7");
g_assert_cmpint (ifparser_get_num_blocks (parser), ==, 0);
}
static void
test8_long_line_wrapped (const char *path)
test8_long_line_wrapped (void)
{
init_ifparser_with_file (path, "test8");
g_assert_cmpint (ifparser_get_num_blocks (), ==, 0);
ifparser_destroy ();
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test8");
g_assert_cmpint (ifparser_get_num_blocks (parser), ==, 0);
}
static void
test9_wrapped_lines_in_block (const char *path)
test9_wrapped_lines_in_block (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test9");
e = expected_new ();
b = expected_block_new ("iface", "eth0");
@ -340,18 +337,17 @@ test9_wrapped_lines_in_block (const char *path)
expected_block_add_key (b, expected_key_new ("broadcast", "10.250.2.63"));
expected_block_add_key (b, expected_key_new ("gateway", "10.250.2.50"));
init_ifparser_with_file (path, "test9");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test11_complex_wrap (const char *path)
test11_complex_wrap (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test11");
e = expected_new ();
b = expected_block_new ("iface", "pppoe");
@ -359,18 +355,17 @@ test11_complex_wrap (const char *path)
expected_block_add_key (b, expected_key_new ("inet", "manual"));
expected_block_add_key (b, expected_key_new ("pre-up", "/sbin/ifconfig eth0 up"));
init_ifparser_with_file (path, "test11");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test12_complex_wrap_split_word (const char *path)
test12_complex_wrap_split_word (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test12");
e = expected_new ();
b = expected_block_new ("iface", "pppoe");
@ -378,36 +373,34 @@ test12_complex_wrap_split_word (const char *path)
expected_block_add_key (b, expected_key_new ("inet", "manual"));
expected_block_add_key (b, expected_key_new ("up", "ifup ppp0=dsl"));
init_ifparser_with_file (path, "test12");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test13_more_mixed_whitespace (const char *path)
test13_more_mixed_whitespace (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test13");
e = expected_new ();
b = expected_block_new ("iface", "dsl");
expected_block_add_key (b, expected_key_new ("inet", "ppp"));
expected_add_block (e, b);
init_ifparser_with_file (path, "test13");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test14_mixed_whitespace_block_start (const char *path)
test14_mixed_whitespace_block_start (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test14");
e = expected_new ();
b = expected_block_new ("iface", "wlan0");
@ -420,47 +413,43 @@ test14_mixed_whitespace_block_start (const char *path)
expected_block_add_key (b, expected_key_new ("inet", "dhcp"));
expected_add_block (e, b);
init_ifparser_with_file (path, "test14");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test15_trailing_space (const char *path)
test15_trailing_space (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test15");
e = expected_new ();
b = expected_block_new ("iface", "bnep0");
expected_block_add_key (b, expected_key_new ("inet", "static"));
expected_add_block (e, b);
init_ifparser_with_file (path, "test15");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test16_missing_newline (const char *path)
test16_missing_newline (void)
{
Expected *e;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test16");
e = expected_new ();
expected_add_block (e, expected_block_new ("mapping", "eth0"));
init_ifparser_with_file (path, "test16");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test17_read_static_ipv4 (const char *path)
test17_read_static_ipv4 (void)
{
NMConnection *connection;
NMSettingConnection *s_con;
@ -470,9 +459,9 @@ test17_read_static_ipv4 (const char *path)
gboolean success;
NMIPAddress *ip4_addr;
if_block *block = NULL;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test17-wired-static-verify-ip4");
init_ifparser_with_file (path, "test17-wired-static-verify-ip4");
block = ifparser_getfirst ();
block = ifparser_getfirst (parser);
connection = nm_simple_connection_new();
g_assert (connection);
@ -511,12 +500,11 @@ test17_read_static_ipv4 (const char *path)
g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip4, 0), ==, "example.com");
g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip4, 1), ==, "foo.example.com");
ifparser_destroy ();
g_object_unref (connection);
}
static void
test18_read_static_ipv6 (const char *path)
test18_read_static_ipv6 (void)
{
NMConnection *connection;
NMSettingConnection *s_con;
@ -526,9 +514,9 @@ test18_read_static_ipv6 (const char *path)
gboolean success;
NMIPAddress *ip6_addr;
if_block *block = NULL;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test18-wired-static-verify-ip6");
init_ifparser_with_file (path, "test18-wired-static-verify-ip6");
block = ifparser_getfirst ();
block = ifparser_getfirst (parser);
connection = nm_simple_connection_new();
g_assert (connection);
ifupdown_update_connection_from_if_block(connection, block, &error);
@ -566,12 +554,11 @@ test18_read_static_ipv6 (const char *path)
g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 0), ==, "example.com");
g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 1), ==, "foo.example.com");
ifparser_destroy ();
g_object_unref (connection);
}
static void
test19_read_static_ipv4_plen (const char *path)
test19_read_static_ipv4_plen (void)
{
NMConnection *connection;
NMSettingIPConfig *s_ip4;
@ -579,9 +566,9 @@ test19_read_static_ipv4_plen (const char *path)
NMIPAddress *ip4_addr;
if_block *block = NULL;
gboolean success;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test19-wired-static-verify-ip4-plen");
init_ifparser_with_file (path, "test19-wired-static-verify-ip4-plen");
block = ifparser_getfirst ();
block = ifparser_getfirst (parser);
connection = nm_simple_connection_new();
g_assert (connection);
ifupdown_update_connection_from_if_block(connection, block, &error);
@ -601,15 +588,15 @@ test19_read_static_ipv4_plen (const char *path)
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
ifparser_destroy ();
g_object_unref (connection);
}
static void
test20_source_stanza (const char *path)
test20_source_stanza (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test20-source-stanza");
e = expected_new ();
@ -625,18 +612,17 @@ test20_source_stanza (const char *path)
expected_add_block (e, b);
expected_block_add_key (b, expected_key_new ("inet", "dhcp"));
init_ifparser_with_file (path, "test20-source-stanza");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
static void
test21_source_dir_stanza (const char *path)
test21_source_dir_stanza (void)
{
Expected *e;
ExpectedBlock *b;
nm_auto_ifparser if_parser *parser = init_ifparser_with_file ("test21-source-dir-stanza");
e = expected_new ();
@ -646,10 +632,8 @@ test21_source_dir_stanza (const char *path)
expected_add_block (e, b);
expected_block_add_key (b, expected_key_new ("inet", "dhcp"));
init_ifparser_with_file (path, "test21-source-dir-stanza");
compare_expected_to_ifparser (e);
compare_expected_to_ifparser (parser, e);
ifparser_destroy ();
expected_free (e);
}
@ -660,49 +644,28 @@ main (int argc, char **argv)
{
nmtst_init_assert_logging (&argc, &argv, "WARN", "DEFAULT");
if (0)
dump_blocks ();
(void) dump_blocks;
g_test_add_data_func ("/ifupdate/ignore_line_before_first_block", TEST_DIR,
(GTestDataFunc) test1_ignore_line_before_first_block);
g_test_add_data_func ("/ifupdate/wrapped_line", TEST_DIR,
(GTestDataFunc) test2_wrapped_line);
g_test_add_data_func ("/ifupdate/wrapped_multiline_multiarg", TEST_DIR,
(GTestDataFunc) test3_wrapped_multiline_multiarg);
g_test_add_data_func ("/ifupdate/allow_auto_is_auto", TEST_DIR,
(GTestDataFunc) test4_allow_auto_is_auto);
g_test_add_data_func ("/ifupdate/allow_auto_multiarg", TEST_DIR,
(GTestDataFunc) test5_allow_auto_multiarg);
g_test_add_data_func ("/ifupdate/mixed_whitespace", TEST_DIR,
(GTestDataFunc) test6_mixed_whitespace);
g_test_add_data_func ("/ifupdate/long_line", TEST_DIR,
(GTestDataFunc) test7_long_line);
g_test_add_data_func ("/ifupdate/long_line_wrapped", TEST_DIR,
(GTestDataFunc) test8_long_line_wrapped);
g_test_add_data_func ("/ifupdate/wrapped_lines_in_block", TEST_DIR,
(GTestDataFunc) test9_wrapped_lines_in_block);
g_test_add_data_func ("/ifupdate/complex_wrap", TEST_DIR,
(GTestDataFunc) test11_complex_wrap);
g_test_add_data_func ("/ifupdate/complex_wrap_split_word", TEST_DIR,
(GTestDataFunc) test12_complex_wrap_split_word);
g_test_add_data_func ("/ifupdate/more_mixed_whitespace", TEST_DIR,
(GTestDataFunc) test13_more_mixed_whitespace);
g_test_add_data_func ("/ifupdate/mixed_whitespace_block_start", TEST_DIR,
(GTestDataFunc) test14_mixed_whitespace_block_start);
g_test_add_data_func ("/ifupdate/trailing_space", TEST_DIR,
(GTestDataFunc) test15_trailing_space);
g_test_add_data_func ("/ifupdate/missing_newline", TEST_DIR,
(GTestDataFunc) test16_missing_newline);
g_test_add_data_func ("/ifupdate/read_static_ipv4", TEST_DIR,
(GTestDataFunc) test17_read_static_ipv4);
g_test_add_data_func ("/ifupdate/read_static_ipv6", TEST_DIR,
(GTestDataFunc) test18_read_static_ipv6);
g_test_add_data_func ("/ifupdate/read_static_ipv4_plen", TEST_DIR,
(GTestDataFunc) test19_read_static_ipv4_plen);
g_test_add_data_func ("/ifupdate/source_stanza", TEST_DIR,
(GTestDataFunc) test20_source_stanza);
g_test_add_data_func ("/ifupdate/source_dir_stanza", TEST_DIR,
(GTestDataFunc) test21_source_dir_stanza);
g_test_add_func ("/ifupdate/ignore_line_before_first_block", test1_ignore_line_before_first_block);
g_test_add_func ("/ifupdate/wrapped_line", test2_wrapped_line);
g_test_add_func ("/ifupdate/wrapped_multiline_multiarg", test3_wrapped_multiline_multiarg);
g_test_add_func ("/ifupdate/allow_auto_is_auto", test4_allow_auto_is_auto);
g_test_add_func ("/ifupdate/allow_auto_multiarg", test5_allow_auto_multiarg);
g_test_add_func ("/ifupdate/mixed_whitespace", test6_mixed_whitespace);
g_test_add_func ("/ifupdate/long_line", test7_long_line);
g_test_add_func ("/ifupdate/long_line_wrapped", test8_long_line_wrapped);
g_test_add_func ("/ifupdate/wrapped_lines_in_block", test9_wrapped_lines_in_block);
g_test_add_func ("/ifupdate/complex_wrap", test11_complex_wrap);
g_test_add_func ("/ifupdate/complex_wrap_split_word", test12_complex_wrap_split_word);
g_test_add_func ("/ifupdate/more_mixed_whitespace", test13_more_mixed_whitespace);
g_test_add_func ("/ifupdate/mixed_whitespace_block_start", test14_mixed_whitespace_block_start);
g_test_add_func ("/ifupdate/trailing_space", test15_trailing_space);
g_test_add_func ("/ifupdate/missing_newline", test16_missing_newline);
g_test_add_func ("/ifupdate/read_static_ipv4", test17_read_static_ipv4);
g_test_add_func ("/ifupdate/read_static_ipv6", test18_read_static_ipv6);
g_test_add_func ("/ifupdate/read_static_ipv4_plen", test19_read_static_ipv4_plen);
g_test_add_func ("/ifupdate/source_stanza", test20_source_stanza);
g_test_add_func ("/ifupdate/source_dir_stanza", test21_source_dir_stanza);
return g_test_run ();
}