summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-08-12 22:35:13 -0500
committerDan Williams <dcbw@redhat.com>2010-08-12 22:35:13 -0500
commit4397f4463a9316bb6a6dc9c7a8dda9b4ddf64225 (patch)
tree8135771fccaeba84ba4991b92c8d14d99f74de2b
parente3865481320622e0cfdf8cb18ece92a88adcbc81 (diff)
downloadNetworkManager-4397f4463a9316bb6a6dc9c7a8dda9b4ddf64225.tar.gz
ifupdown: add ifparser testcases
ENI snippets from Peter Marschall <peter@adpm.de>
-rw-r--r--configure.ac1
-rw-r--r--system-settings/plugins/ifupdown/Makefile.am1
-rw-r--r--system-settings/plugins/ifupdown/interface_parser.c24
-rw-r--r--system-settings/plugins/ifupdown/interface_parser.h2
-rw-r--r--system-settings/plugins/ifupdown/tests/Makefile.am32
-rw-r--r--system-settings/plugins/ifupdown/tests/test-ifupdown.c496
-rw-r--r--system-settings/plugins/ifupdown/tests/test16
-rw-r--r--system-settings/plugins/ifupdown/tests/test115
-rw-r--r--system-settings/plugins/ifupdown/tests/test125
-rw-r--r--system-settings/plugins/ifupdown/tests/test133
-rw-r--r--system-settings/plugins/ifupdown/tests/test145
-rw-r--r--system-settings/plugins/ifupdown/tests/test153
-rw-r--r--system-settings/plugins/ifupdown/tests/test162
-rw-r--r--system-settings/plugins/ifupdown/tests/test24
-rw-r--r--system-settings/plugins/ifupdown/tests/test35
-rw-r--r--system-settings/plugins/ifupdown/tests/test43
-rw-r--r--system-settings/plugins/ifupdown/tests/test53
-rw-r--r--system-settings/plugins/ifupdown/tests/test63
-rw-r--r--system-settings/plugins/ifupdown/tests/test73
-rw-r--r--system-settings/plugins/ifupdown/tests/test85
-rw-r--r--system-settings/plugins/ifupdown/tests/test910
21 files changed, 621 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index efdef27c9a..aecfa88883 100644
--- a/configure.ac
+++ b/configure.ac
@@ -507,6 +507,7 @@ tools/Makefile
system-settings/Makefile
system-settings/plugins/Makefile
system-settings/plugins/ifupdown/Makefile
+system-settings/plugins/ifupdown/tests/Makefile
system-settings/plugins/ifcfg-rh/Makefile
system-settings/plugins/ifcfg-rh/tests/Makefile
system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile
diff --git a/system-settings/plugins/ifupdown/Makefile.am b/system-settings/plugins/ifupdown/Makefile.am
index f99724d629..652e545fce 100644
--- a/system-settings/plugins/ifupdown/Makefile.am
+++ b/system-settings/plugins/ifupdown/Makefile.am
@@ -1,3 +1,4 @@
+SUBDIRS=. tests
INCLUDES = \
-I$(top_srcdir)/src/system-settings \
diff --git a/system-settings/plugins/ifupdown/interface_parser.c b/system-settings/plugins/ifupdown/interface_parser.c
index 374fafb58e..ec9c4144a8 100644
--- a/system-settings/plugins/ifupdown/interface_parser.c
+++ b/system-settings/plugins/ifupdown/interface_parser.c
@@ -190,6 +190,18 @@ if_block *ifparser_getfirst(void)
return first;
}
+int ifparser_get_num_blocks(void)
+{
+ int i = 0;
+ if_block *iter = first;
+
+ while (iter) {
+ i++;
+ iter = iter->next;
+ }
+ return i;
+}
+
if_block *ifparser_getif(const char* iface)
{
if_block *curr = first;
@@ -213,3 +225,15 @@ const char *ifparser_getkey(if_block* iface, const char *key)
}
return NULL;
}
+
+int ifparser_get_num_info(if_block* iface)
+{
+ int i = 0;
+ if_data *iter = iface->info;
+
+ while (iter) {
+ i++;
+ iter = iter->next;
+ }
+ return i;
+}
diff --git a/system-settings/plugins/ifupdown/interface_parser.h b/system-settings/plugins/ifupdown/interface_parser.h
index 262b2172ab..78799d88ce 100644
--- a/system-settings/plugins/ifupdown/interface_parser.h
+++ b/system-settings/plugins/ifupdown/interface_parser.h
@@ -47,6 +47,8 @@ void ifparser_destroy(void);
if_block *ifparser_getif(const char* iface);
if_block *ifparser_getfirst(void);
const char *ifparser_getkey(if_block* iface, const char *key);
+int ifparser_get_num_blocks(void);
+int ifparser_get_num_info(if_block* iface);
void add_block(const char *type, const char* name);
void add_data(const char *key,const char *data);
diff --git a/system-settings/plugins/ifupdown/tests/Makefile.am b/system-settings/plugins/ifupdown/tests/Makefile.am
new file mode 100644
index 0000000000..b5dbd13d63
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/Makefile.am
@@ -0,0 +1,32 @@
+INCLUDES = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/libnm-util \
+ -I$(top_srcdir)/libnm-glib \
+ -I$(top_srcdir)/system-settings/plugins/ifupdown
+
+noinst_PROGRAMS = test-ifupdown
+
+test_ifupdown_SOURCES = \
+ test-ifupdown.c
+
+test_ifupdown_CPPFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ -DTEST_ENI_DIR=\"$(abs_srcdir)\"
+
+test_ifupdown_LDADD = \
+ $(top_builddir)/libnm-glib/libnm-glib.la \
+ $(top_builddir)/libnm-util/libnm-util.la \
+ $(top_builddir)/system-settings/plugins/ifupdown/libifupdown-io.la \
+ $(DBUS_LIBS)
+
+if WITH_TESTS
+
+check-local: test-ifupdown
+ $(abs_builddir)/test-ifupdown
+
+endif
+
+EXTRA_DIST = \
+ test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \
+ test13 test14 test15 test16
diff --git a/system-settings/plugins/ifupdown/tests/test-ifupdown.c b/system-settings/plugins/ifupdown/tests/test-ifupdown.c
new file mode 100644
index 0000000000..ad04a949fb
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test-ifupdown.c
@@ -0,0 +1,496 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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, 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.
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ */
+
+#include <glib.h>
+#include <string.h>
+
+#include "interface_parser.h"
+#include "parser.h"
+
+typedef struct {
+ char *key;
+ char *data;
+} ExpectedKey;
+
+typedef struct {
+ char *type;
+ char *name;
+ GSList *keys;
+} ExpectedBlock;
+
+typedef struct {
+ GSList *blocks;
+} Expected;
+
+static ExpectedKey *
+expected_key_new (const char *key, const char *data)
+{
+ ExpectedKey *k;
+
+ k = g_malloc0 (sizeof (ExpectedKey));
+ g_assert (k);
+ k->key = g_strdup (key);
+ g_assert (k->key);
+ k->data = g_strdup (data);
+ g_assert (k->data);
+ return k;
+}
+
+static void
+expected_key_free (ExpectedKey *k)
+{
+ g_assert (k);
+ g_free (k->key);
+ g_free (k->data);
+ memset (k, 0, sizeof (ExpectedKey));
+ g_free (k);
+}
+
+static ExpectedBlock *
+expected_block_new (const char *type, const char *name)
+{
+ ExpectedBlock *b;
+
+ g_assert (type);
+ g_assert (name);
+ b = g_malloc0 (sizeof (ExpectedBlock));
+ g_assert (b);
+ b->type = g_strdup (type);
+ b->name = g_strdup (name);
+ return b;
+}
+
+static void
+expected_block_free (ExpectedBlock *b)
+{
+ g_assert (b);
+ g_slist_foreach (b->keys, (GFunc) expected_key_free, NULL);
+ g_slist_free (b->keys);
+ g_free (b->type);
+ g_free (b->name);
+ memset (b, 0, sizeof (ExpectedBlock));
+ g_free (b);
+}
+
+static void
+expected_block_add_key (ExpectedBlock *b, ExpectedKey *k)
+{
+ g_assert (b);
+ g_assert (k);
+ b->keys = g_slist_append (b->keys, k);
+}
+
+static Expected *
+expected_new (void)
+{
+ Expected *e;
+
+ e = g_malloc0 (sizeof (Expected));
+ g_assert (e);
+ return e;
+}
+
+static void
+expected_add_block (Expected *e, ExpectedBlock *b)
+{
+ g_assert (e);
+ g_assert (b);
+ e->blocks = g_slist_append (e->blocks, b);
+}
+
+static void
+expected_free (Expected *e)
+{
+ g_assert (e);
+ g_slist_foreach (e->blocks, (GFunc) expected_block_free, NULL);
+ g_slist_free (e->blocks);
+ memset (e, 0, sizeof (Expected));
+ g_free (e);
+}
+
+static void
+compare_expected_to_ifparser (Expected *e)
+{
+ if_block *n;
+ GSList *biter, *kiter;
+
+ g_assert_cmpint (g_slist_length (e->blocks), ==, ifparser_get_num_blocks ());
+
+ for (n = ifparser_getfirst (), biter = e->blocks;
+ n && biter;
+ n = n->next, biter = g_slist_next (biter)) {
+ if_data *m;
+ ExpectedBlock *b = biter->data;
+
+ g_assert (b->type && n->type);
+ g_assert_cmpstr (b->type, ==, n->type);
+ g_assert (b->name && n->name);
+ g_assert_cmpstr (b->name, ==, n->name);
+
+ g_assert_cmpint (g_slist_length (b->keys), ==, ifparser_get_num_info (n));
+
+ for (m = n->info, kiter = b->keys;
+ m && kiter;
+ m = m->next, kiter = g_slist_next (kiter)) {
+ ExpectedKey *k = kiter->data;
+
+ g_assert (k->key && m->key);
+ g_assert_cmpstr (k->key, ==, m->key);
+ g_assert (k->data && m->data);
+ g_assert_cmpstr (k->data, ==, m->data);
+ }
+ }
+}
+
+static void
+dump_blocks (void)
+{
+ if_block *n;
+
+ g_message ("\n***************************************************");
+ for (n = ifparser_getfirst (); n != NULL; n = n->next) {
+ if_data *m;
+
+ // each block start with its type & name
+ // (single quotes used to show typ & name baoundaries)
+ g_print("'%s' '%s'\n", n->type, n->name);
+
+ // each key-value pair within a block is indented & separated by a tab
+ // (single quotes used to show typ & name baoundaries)
+ for (m = n->info; m != NULL; m = m->next)
+ g_print("\t'%s'\t'%s'\n", m->key, m->data);
+
+ // blocks are separated by an empty line
+ g_print("\n");
+ }
+ g_message ("##################################################\n");
+}
+
+static void
+init_ifparser_with_file (const char *path, const char *file)
+{
+ char *tmp;
+
+ tmp = g_strdup_printf ("%s/%s", path, file);
+ ifparser_init (tmp);
+ g_free (tmp);
+}
+
+static void
+test1_ignore_line_before_first_block (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("auto", "eth0");
+ expected_add_block (e, b);
+ b = expected_block_new ("iface", "eth0");
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test2_wrapped_line (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test3_wrapped_multiline_multiarg (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("allow-hotplug", "eth0");
+ expected_add_block (e, b);
+ b = expected_block_new ("allow-hotplug", "wlan0");
+ expected_add_block (e, b);
+ b = expected_block_new ("allow-hotplug", "bnep0");
+ expected_add_block (e, b);
+
+ init_ifparser_with_file (path, "test3");
+ compare_expected_to_ifparser (e);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test4_allow_auto_is_auto (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test5_allow_auto_multiarg (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("allow-hotplug", "eth0");
+ expected_add_block (e, b);
+ b = expected_block_new ("allow-hotplug", "wlan0");
+ expected_add_block (e, b);
+
+ init_ifparser_with_file (path, "test5");
+ compare_expected_to_ifparser (e);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test6_mixed_whitespace (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test7_long_line (const char *path)
+{
+ init_ifparser_with_file (path, "test7");
+ g_assert_cmpint (ifparser_get_num_blocks (), ==, 0);
+ ifparser_destroy ();
+}
+
+static void
+test8_long_line_wrapped (const char *path)
+{
+ init_ifparser_with_file (path, "test8");
+ g_assert_cmpint (ifparser_get_num_blocks (), ==, 0);
+ ifparser_destroy ();
+}
+
+static void
+test9_wrapped_lines_in_block (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("iface", "eth0");
+ expected_add_block (e, b);
+ expected_block_add_key (b, expected_key_new ("inet", "static"));
+ expected_block_add_key (b, expected_key_new ("address", "10.250.2.3"));
+ expected_block_add_key (b, expected_key_new ("netmask", "255.255.255.192"));
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test11_complex_wrap (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("iface", "pppoe");
+ expected_add_block (e, b);
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test12_complex_wrap_split_word (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("iface", "pppoe");
+ expected_add_block (e, b);
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test13_more_mixed_whitespace (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test14_mixed_whitespace_block_start (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ e = expected_new ();
+ b = expected_block_new ("iface", "wlan0");
+ expected_block_add_key (b, expected_key_new ("inet", "manual"));
+ expected_add_block (e, b);
+ b = expected_block_new ("iface", "wlan-adpm");
+ expected_block_add_key (b, expected_key_new ("inet", "dhcp"));
+ expected_add_block (e, b);
+ b = expected_block_new ("iface", "wlan-default");
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test15_trailing_space (const char *path)
+{
+ Expected *e;
+ ExpectedBlock *b;
+
+ 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);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+static void
+test16_missing_newline (const char *path)
+{
+ Expected *e;
+
+ e = expected_new ();
+ expected_add_block (e, expected_block_new ("mapping", "eth0"));
+
+ init_ifparser_with_file (path, "test16");
+ compare_expected_to_ifparser (e);
+
+ ifparser_destroy ();
+ expected_free (e);
+}
+
+#if GLIB_CHECK_VERSION(2,25,12)
+typedef GTestFixtureFunc TCFunc;
+#else
+typedef void (*TCFunc)(void);
+#endif
+
+#define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (TCFunc) t, NULL)
+
+int main (int argc, char **argv)
+{
+ GTestSuite *suite;
+
+ g_test_init (&argc, &argv, NULL);
+
+ suite = g_test_get_root ();
+
+ if (0)
+ dump_blocks ();
+
+ g_test_suite_add (suite, TESTCASE (test1_ignore_line_before_first_block, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test2_wrapped_line, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test3_wrapped_multiline_multiarg, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test4_allow_auto_is_auto, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test5_allow_auto_multiarg, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test6_mixed_whitespace, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test7_long_line, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test8_long_line_wrapped, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test9_wrapped_lines_in_block, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test11_complex_wrap, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test12_complex_wrap_split_word, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test13_more_mixed_whitespace, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test14_mixed_whitespace_block_start, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test15_trailing_space, TEST_ENI_DIR));
+ g_test_suite_add (suite, TESTCASE (test16_missing_newline, TEST_ENI_DIR));
+
+ return g_test_run ();
+}
+
diff --git a/system-settings/plugins/ifupdown/tests/test1 b/system-settings/plugins/ifupdown/tests/test1
new file mode 100644
index 0000000000..74c23b457d
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test1
@@ -0,0 +1,6 @@
+# case 1: line before 1st block (must be ignored)
+address 10.250.2.3
+
+auto eth0
+iface eth0 inet dhcp
+
diff --git a/system-settings/plugins/ifupdown/tests/test11 b/system-settings/plugins/ifupdown/tests/test11
new file mode 100644
index 0000000000..89561dd7df
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test11
@@ -0,0 +1,5 @@
+iface pppoe inet manual
+# case 11: wrapped line (without leading space on the wrapped part, wrap within a multi-word value)
+ pre-up /sbin/ifconfig \
+eth0 up
+
diff --git a/system-settings/plugins/ifupdown/tests/test12 b/system-settings/plugins/ifupdown/tests/test12
new file mode 100644
index 0000000000..6096842e1e
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test12
@@ -0,0 +1,5 @@
+iface pppoe inet manual
+# case 12: wrapped line, splitting a word (must be joined again)
+ up ifup ppp0\
+=dsl
+
diff --git a/system-settings/plugins/ifupdown/tests/test13 b/system-settings/plugins/ifupdown/tests/test13
new file mode 100644
index 0000000000..c001f7ef1b
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test13
@@ -0,0 +1,3 @@
+# case 13: variations of tabs & spaces
+iface dsl inet ppp
+
diff --git a/system-settings/plugins/ifupdown/tests/test14 b/system-settings/plugins/ifupdown/tests/test14
new file mode 100644
index 0000000000..4a153ab3b5
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test14
@@ -0,0 +1,5 @@
+# case 14: variations of tabs and spaces (all must be recognized as lines starting an iface block)
+iface wlan0 inet manual
+ iface wlan-adpm inet dhcp
+iface wlan-default inet dhcp
+
diff --git a/system-settings/plugins/ifupdown/tests/test15 b/system-settings/plugins/ifupdown/tests/test15
new file mode 100644
index 0000000000..c3ceca2409
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test15
@@ -0,0 +1,3 @@
+# case 15: trailing space (must be ignored)
+iface bnep0 inet static
+
diff --git a/system-settings/plugins/ifupdown/tests/test16 b/system-settings/plugins/ifupdown/tests/test16
new file mode 100644
index 0000000000..f4f74fb5a1
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test16
@@ -0,0 +1,2 @@
+# case 16: last line that is not followed by LF (added with 'echo -n "mapping eth0" >> /e/n/i')
+mapping eth0 \ No newline at end of file
diff --git a/system-settings/plugins/ifupdown/tests/test2 b/system-settings/plugins/ifupdown/tests/test2
new file mode 100644
index 0000000000..7462b35268
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test2
@@ -0,0 +1,4 @@
+# case 2: wrapped line
+auto \
+lo
+
diff --git a/system-settings/plugins/ifupdown/tests/test3 b/system-settings/plugins/ifupdown/tests/test3
new file mode 100644
index 0000000000..f6293bbdc6
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test3
@@ -0,0 +1,5 @@
+# case 3: line wrapped over multiple lines & multi-argument allow-*
+allow-hotplug eth0 \
+ wlan0 \
+ bnep0
+
diff --git a/system-settings/plugins/ifupdown/tests/test4 b/system-settings/plugins/ifupdown/tests/test4
new file mode 100644
index 0000000000..46a40bc9c2
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test4
@@ -0,0 +1,3 @@
+# case 4: 'allow-auto' is synonymous to 'auto'
+allow-auto eth0
+
diff --git a/system-settings/plugins/ifupdown/tests/test5 b/system-settings/plugins/ifupdown/tests/test5
new file mode 100644
index 0000000000..b69fc42bd0
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test5
@@ -0,0 +1,3 @@
+# case 5: multi-argument allow-* (even worse: trailing space)
+allow-hotplug eth0 wlan0
+
diff --git a/system-settings/plugins/ifupdown/tests/test6 b/system-settings/plugins/ifupdown/tests/test6
new file mode 100644
index 0000000000..50ac69bd98
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test6
@@ -0,0 +1,3 @@
+# case 6: mix between tabs and spaces
+ iface lo inet loopback
+
diff --git a/system-settings/plugins/ifupdown/tests/test7 b/system-settings/plugins/ifupdown/tests/test7
new file mode 100644
index 0000000000..03cb131a98
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test7
@@ -0,0 +1,3 @@
+# case 7: over-long line (must be ignored completely)
+123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+
diff --git a/system-settings/plugins/ifupdown/tests/test8 b/system-settings/plugins/ifupdown/tests/test8
new file mode 100644
index 0000000000..311f7e15a4
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test8
@@ -0,0 +1,5 @@
+# case 8: over-long line that wraps to consecutive lines (must be ignored completely)
+123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 \
+allow-test eth0 \
+eth0
+
diff --git a/system-settings/plugins/ifupdown/tests/test9 b/system-settings/plugins/ifupdown/tests/test9
new file mode 100644
index 0000000000..7d94563af9
--- /dev/null
+++ b/system-settings/plugins/ifupdown/tests/test9
@@ -0,0 +1,10 @@
+iface eth0 inet static
+# case 9: wrapped lines inside a block (to be on the safe side)
+ address \
+ 10.250.2.3
+ netmask \
+ 255.255.255.192
+
+ broadcast 10.250.2.63
+ gateway 10.250.2.50
+