Merge lp:~amigadave/account-plugins/add-some-tests into lp:account-plugins

Proposed by David King on 2012-12-06
Status: Merged
Approved by: Alberto Mardegan on 2012-12-06
Approved revision: 88
Merged at revision: 85
Proposed branch: lp:~amigadave/account-plugins/add-some-tests
Merge into: lp:account-plugins
Diff against target: 93 lines (+45/-3)
3 files modified
.bzrignore (+2/-0)
Makefile.am (+26/-2)
configure.ac (+17/-1)
To merge this branch: bzr merge lp:~amigadave/account-plugins/add-some-tests
Reviewer Review Type Date Requested Status
Alberto Mardegan (community) 2012-12-06 Approve on 2012-12-06
PS Jenkins bot (community) continuous-integration Approve on 2012-12-06
Ken VanDine 2012-12-06 Pending
Review via email: mp+138393@code.launchpad.net

Commit message

Add a couple of simple tests

* Add tests for well-formed XML files
* Enable automake silent rules

Description of the change

Add a couple of simple tests

* Add tests for well-formed XML files
* Enable automake silent rules

To post a comment you must log in.
David King (amigadave) wrote :

This checks the .provider and .service files with xmllint. It does not check against the DTDs provided by libaccounts-glib, as those will not be available until a future 1.4 release. Some tests for the binary plugins could be provided, but I am not sure how to approach that problem at the moment.

87. By David King on 2012-12-06

Enable the XML tests only if xmllint is present

88. By David King on 2012-12-06

Force tests to be enabled during distcheck

Add an --enable-tests configure argument, and add it to
DISTCHECK_CONFIGURE_FLAGS.

Alberto Mardegan (mardy) wrote :

I don't think there is much sense in making tests for the binary plugins, are they mostly consist of data only -- which BTW will soon be migrated to the provider files, once the new libaccounts-glib is released.

Anyway, this MR makes lots of sense, thanks! :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2012-11-23 10:02:15 +0000
3+++ .bzrignore 2012-12-06 08:13:21 +0000
4@@ -57,3 +57,5 @@
5 /src/sohu.c
6 /src/twitter.c
7 /src/windows-live.c
8+/test-provider
9+/test-service
10
11=== modified file 'Makefile.am'
12--- Makefile.am 2012-11-23 10:02:52 +0000
13+++ Makefile.am 2012-12-06 08:13:21 +0000
14@@ -2,7 +2,8 @@
15 po
16
17 DISTCHECK_CONFIGURE_FLAGS = \
18- --enable-libaccount-plugin
19+ --enable-libaccount-plugin \
20+ --enable-tests
21
22 if ENABLE_LIBACCOUNT_PLUGIN
23 # Binary account plugins.
24@@ -185,9 +186,32 @@
25 $(services_in_files) \
26 src/config.vapi
27
28+if HAVE_XMLLINT
29+TESTS = \
30+ test-provider \
31+ test-service
32+
33+test-provider: Makefile $(providers_DATA)
34+ $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
35+ echo "for provider in $(providers_DATA)" >> $@; \
36+ echo "do" >> $@; \
37+ echo " $(XMLLINT) --noout $(top_builddir)/\$$provider || exit 1" >> $@; \
38+ echo "done" >> $@; \
39+ chmod +x $@
40+
41+test-service: Makefile $(services_DATA)
42+ $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
43+ echo "for service in $(services_DATA)" >> $@; \
44+ echo "do" >> $@; \
45+ echo " $(XMLLINT) --noout $(top_builddir)/\$$service || exit 1" >> $@; \
46+ echo "done" >> $@; \
47+ chmod +x $@
48+endif # HAVE_XMLLINT
49+
50 CLEANFILES = \
51 $(services_DATA) \
52- $(providers_DATA)
53+ $(providers_DATA) \
54+ $(TESTS)
55
56 DISTCLEANFILES = \
57 intltool-extract \
58
59=== modified file 'configure.ac'
60--- configure.ac 2012-11-13 09:00:39 +0000
61+++ configure.ac 2012-12-06 08:13:21 +0000
62@@ -6,7 +6,7 @@
63 [account-plugins],
64 [https://launchpad.net/online-accounts-account-plugins])
65
66-AM_INIT_AUTOMAKE([1.10 -Wall -Wno-portability subdir-objects])
67+AM_INIT_AUTOMAKE([1.10 -Wall -Wno-portability silent-rules subdir-objects])
68 AM_CONFIG_HEADER(config.h)
69
70 # Gobject Introspection
71@@ -56,6 +56,22 @@
72 AC_SUBST([servicesdir],
73 [`$PKG_CONFIG --variable servicefilesdir libaccounts-glib`])
74
75+AC_ARG_ENABLE([TESTS],
76+ [AS_HELP_STRING([--disable-tests], [Disable tests])])
77+
78+AS_IF([test "x$enable_tests" != "xno"],
79+ [AC_PATH_PROG([XMLLINT], [xmllint], [notfound])
80+ AS_IF([test "x$XMLLINT" = "xnotfound"],
81+ [have_xmllint=no],
82+ [have_xmllint=yes])])
83+
84+AS_IF([test "x$have_xmllint" = "xyes"],
85+ [AC_SUBST([XMLLINT])],
86+ [AS_IF([test "x$enable_tests" = "xyes"],
87+ [AC_MSG_ERROR([testing support enabled but required dependencies were not found])])])
88+
89+AM_CONDITIONAL([HAVE_XMLLINT], [test "x$have_xmllint" = "xyes"])
90+
91 # Set Twitter consumer key/secret
92 AC_ARG_WITH(twitter-consumer-key,
93 [AS_HELP_STRING([--with-twitter-consumer-key],

Subscribers

People subscribed via source and target branches