summaryrefslogtreecommitdiff
path: root/src/platform/tests
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-14 22:34:01 +0200
committerThomas Haller <thaller@redhat.com>2015-06-05 16:52:50 +0200
commitce700d94f54eae64d0f3aac0c6ef50a051dd9a2b (patch)
tree85f234e98fcb60dcd75472206d9378a2a28408ae /src/platform/tests
parentd7a312d17a09b748d5aa06d7dfbebc66f0e8cf68 (diff)
downloadNetworkManager-ce700d94f54eae64d0f3aac0c6ef50a051dd9a2b.tar.gz
platform: add nm-platform-utils.[ch] files
There is no general purpose file for platform utilities. We only have nm-platform.h, which contains (mostly) functions that operate on a NMPlatform instance (and that can be mocked using NMFakePlatform). Add a new file for independent utility functions. nm-platform-utils.c should not call into functions having a NMPlatform instance, to have them independent from platform caching and the platform singleton.
Diffstat (limited to 'src/platform/tests')
-rw-r--r--src/platform/tests/.gitignore9
-rw-r--r--src/platform/tests/Makefile.am8
-rw-r--r--src/platform/tests/test-general.c38
3 files changed, 51 insertions, 4 deletions
diff --git a/src/platform/tests/.gitignore b/src/platform/tests/.gitignore
index 5457fbca6c..cdd8a51f83 100644
--- a/src/platform/tests/.gitignore
+++ b/src/platform/tests/.gitignore
@@ -1,11 +1,12 @@
/dump
/monitor
/platform
-/test-link-fake
-/test-link-linux
/test-address-fake
/test-address-linux
+/test-cleanup-fake
+/test-cleanup-linux
+/test-general
+/test-link-fake
+/test-link-linux
/test-route-fake
/test-route-linux
-/test-cleanup-fake
-/test-cleanup-linux \ No newline at end of file
diff --git a/src/platform/tests/Makefile.am b/src/platform/tests/Makefile.am
index 92400f9091..76b40f7ca3 100644
--- a/src/platform/tests/Makefile.am
+++ b/src/platform/tests/Makefile.am
@@ -37,6 +37,7 @@ noinst_PROGRAMS = \
test-link-linux \
test-address-fake \
test-address-linux \
+ test-general \
test-route-fake \
test-route-linux \
test-cleanup-fake \
@@ -109,12 +110,19 @@ test_cleanup_linux_CPPFLAGS = \
-DKERNEL_HACKS=1
test_cleanup_linux_LDADD = $(PLATFORM_LDADD)
+test_general_SOURCES = \
+ test-general.c
+test_general_LDADD = \
+ $(top_builddir)/src/libNetworkManager.la
+
+
@VALGRIND_RULES@
TESTS = \
test-address-fake \
test-address-linux \
test-cleanup-fake \
test-cleanup-linux \
+ test-general \
test-link-fake \
test-link-linux \
test-route-fake \
diff --git a/src/platform/tests/test-general.c b/src/platform/tests/test-general.c
new file mode 100644
index 0000000000..2f29d7de70
--- /dev/null
+++ b/src/platform/tests/test-general.c
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* nm-platform.c - Handle runtime kernel networking configuration
+ *
+ * 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) 2015 Red Hat, Inc.
+ */
+
+#include "nm-platform-utils.h"
+
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
+
+
+/******************************************************************/
+
+NMTST_DEFINE ();
+
+int
+main (int argc, char **argv)
+{
+ nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
+
+ return g_test_run ();
+}