[network-manager-vpnc/th/vpn-editor-split-bgo766170: 12/23] src/tests: refactor test-vpnc-output
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc/th/vpn-editor-split-bgo766170: 12/23] src/tests: refactor test-vpnc-output
- Date: Tue, 17 May 2016 14:53:26 +0000 (UTC)
commit 965b1e128126e55e9ef22c4c404e50342a841c9a
Author: Thomas Haller <thaller redhat com>
Date: Mon May 9 12:07:33 2016 +0200
src/tests: refactor test-vpnc-output
Run the tests during `make check` by declaring them
as TESTS in Makefile.am.
Also use nmtst_init() to initialize the tests. This replaces
g_test_init(), but also calls g_type_init() -- which was missing
previously -- and provides further nice features for tests that
are available via "nm-test-utils.h" header.
.gitignore | 2 ++
src/Makefile.am | 4 ++--
src/test-vpnc-output.c | 6 +++++-
3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 3157698..53b0ae1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,8 @@ appdata/network-manager-vpnc.metainfo.xml
/test-driver
*/tests/*.log
*/tests/*.trs
+/src/*.log
+/src/*.trs
/cscope.*
diff --git a/src/Makefile.am b/src/Makefile.am
index 1de7a68..c8850ca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,7 +41,7 @@ test_vpnc_output_SOURCES = \
test_vpnc_output_LDADD = $(GLIB_LIBS)
-check-local:
- $(abs_builddir)/test-vpnc-output
+TESTS = \
+ test-vpnc-output
CLEANFILES = *~
diff --git a/src/test-vpnc-output.c b/src/test-vpnc-output.c
index 5eefb5e..7e3a924 100644
--- a/src/test-vpnc-output.c
+++ b/src/test-vpnc-output.c
@@ -24,6 +24,8 @@
#include "utils.h"
+#include "nm-utils/nm-test-utils.h"
+
#define TEST_HEADER \
GString *output;\
guint pos = 0, num, olen, linelen;\
@@ -267,10 +269,12 @@ Password for VPN person 1 1 1 1: ";
TEST_CLEANUP
}
+NMTST_DEFINE ();
+
int
main (int argc, char **argv)
{
- g_test_init (&argc, &argv, NULL);
+ nmtst_init (&argc, &argv, TRUE);
g_test_add_func ("/output/simple", test_output_simple);
g_test_add_func ("/output/message", test_output_message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]