Merge lp:~ballogy/libappindicator/make-tests-optional into lp:libappindicator/0.5

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 223
Merged at revision: 224
Proposed branch: lp:~ballogy/libappindicator/make-tests-optional
Merge into: lp:libappindicator/0.5
Diff against target: 146 lines (+55/-6)
3 files modified
Makefile.am (+4/-1)
bindings/mono/Makefile.am (+22/-4)
configure.ac (+29/-1)
To merge this branch: bzr merge lp:~ballogy/libappindicator/make-tests-optional
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+90545@code.launchpad.net

This proposal supersedes a proposal from 2011-11-22.

Description of the change

This change makes it possible to disable building tests with '--disable-tests' and '--disable-mono-test' configure switches.

By default, mono-test is build only if nunit or mono-nunit available on build system.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2011-06-15 15:44:55 +0000
3+++ Makefile.am 2012-01-27 22:06:37 +0000
4@@ -4,9 +4,12 @@
5 src \
6 bindings \
7 example \
8- tests \
9 docs
10
11+if WANT_TESTS
12+SUBDIRS += tests
13+endif
14+
15 EXTRA_DIST = \
16 m4/introspection.m4 \
17 gtk-doc.make \
18
19=== modified file 'bindings/mono/Makefile.am'
20--- bindings/mono/Makefile.am 2011-02-24 04:46:17 +0000
21+++ bindings/mono/Makefile.am 2012-01-27 22:06:37 +0000
22@@ -3,7 +3,9 @@
23 pkgconfigdir = $(libdir)/pkgconfig
24 pkgconfig_DATA = appindicator-sharp-0.1.pc
25
26+if BUILD_MONO_TEST
27 TEST = AppIndicator.Test.dll
28+endif
29
30 API = libappindicator-api.xml
31 MIDDLE_API = libappindicator-api.middle
32@@ -40,16 +42,24 @@
33 $(API) \
34 $(MIDDLE_API) \
35 $(RAW_API) \
36- $(TEST) \
37 $(DLLPOLICY) \
38 $(DLLPOLICY1) \
39 $(WRAPPER_FREE_BINDING) \
40 $(POLICY).config \
41 $(POLICY1).config
42
43+if BUILD_MONO_TEST
44+CLEANFILES += $(TEST)
45+endif
46+
47 DISTCLEANFILES = $(ASSEMBLY).config
48+
49+if BUILD_MONO_TEST
50 TEST_SOURCES = TestIndicator.cs
51+endif
52+
53 customs = ApplicationIndicator.custom
54+
55 EXTRA_DIST = \
56 AssemblyInfo.cs \
57 $(RAW_API) \
58@@ -60,13 +70,19 @@
59 $(ASSEMBLY_NAME).snk \
60 $(POLICY).config.in \
61 $(POLICY1).config.in \
62- $(customs) \
63- $(TEST_SOURCES)
64+ $(customs)
65+
66+if BUILD_MONO_TEST
67+EXTRA_DIST += $(TEST_SOURCES)
68+endif
69
70 GACUTIL_FLAGS=-package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib
71
72 references = $(GTK_SHARP_LIBS)
73-test_references = $(GTK_SHARP_LIBS) $(NUNIT_LIBS) -r:$(ASSEMBLY)
74+
75+if BUILD_MONO_TEST
76+test_references = $(GTK_SHARP_LIBS) $(NUNIT_LIBS) $(MONO_NUNIT_LIBS) -r:$(ASSEMBLY)
77+endif
78
79 $(RAW_API): app-indicator.sources.xml $(WRAPPER_FREE_BINDING)
80 $(GAPI_PARSER) $(srcdir)/app-indicator.sources.xml
81@@ -130,10 +146,12 @@
82 echo "$(GACUTIL) -u $(DLLPOLICY) $(GACUTIL_FLAGS)"; \
83 $(GACUTIL) -u $(POLICY) $(GACUTIL_FLAGS) || exit 1;
84
85+if BUILD_MONO_TEST
86 $(TEST): $(ASSEMBLY) $(TEST_SOURCES)
87 $(CSC) -out:$(TEST) -target:library $(test_references) $(srcdir)/$(TEST_SOURCES)
88
89 all: $(TEST)
90+endif
91
92 $(POLICY).config: $(POLICY).config.in Makefile
93 sed -e "s|@ASSEMBLY_NAME@|$(ASSEMBLY_NAME)|" \
94
95=== modified file 'configure.ac'
96--- configure.ac 2011-09-28 17:41:09 +0000
97+++ configure.ac 2012-01-27 22:06:37 +0000
98@@ -153,7 +153,25 @@
99 AC_PATH_PROG(GAPI_FIXUP, gapi2-fixup, no)
100 AC_SUBST(GAPI_FIXUP)
101
102-PKG_CHECK_MODULES(NUNIT, nunit >= 2.4.7)
103+# Check for nunit
104+AC_ARG_ENABLE([mono-test],
105+ AC_HELP_STRING([--disable-mono-test], [Disable mono test]),,
106+ [enable_mono_test=auto])
107+
108+if test x"$enable_mono_test" != x"no" ; then
109+ PKG_CHECK_MODULES(NUNIT, nunit >= 2.4.7,
110+ [have_nunit=yes],
111+ [PKG_CHECK_MODULES(MONO_NUNIT, mono-nunit,
112+ [have_nunit=yes],
113+ [have_nunit=no])
114+ ])
115+ if test x${enable_mono_test} = xyes && test x${have_nunit} = xno; then
116+ AC_MSG_ERROR([Mono test configured but nunit not found])
117+ fi
118+else
119+ have_nunit=no
120+fi
121+AM_CONDITIONAL(BUILD_MONO_TEST, test x${have_nunit} = xyes)
122
123 ###########################
124 # Check to see if we're local
125@@ -189,6 +207,14 @@
126 AC_SUBST(PYGTK_CODEGEN)
127 AC_MSG_RESULT($PYGTK_CODEGEN)
128
129+#########################
130+# Check if build tests
131+#########################
132+AC_ARG_ENABLE([tests],
133+ AC_HELP_STRING([--disable-tests], [Disable tests]),,
134+ [enable_tests=yes])
135+AM_CONDITIONAL([WANT_TESTS], [test "x$enable_tests" != "xno"])
136+
137 ###########################
138 # Files
139 ###########################
140@@ -226,4 +252,6 @@
141
142 Prefix: $prefix
143 GTK+ Version: $with_gtk
144+ Tests: $enable_tests
145+ Mono tests: $have_nunit
146 ])

Subscribers

People subscribed via source and target branches