Merge lp:~online-accounts/libsignon-glib/packaging into lp:libsignon-glib

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: no longer in the source branch.
Merged at revision: 159
Proposed branch: lp:~online-accounts/libsignon-glib/packaging
Merge into: lp:libsignon-glib
Diff against target: 1063 lines (+407/-122)
23 files modified
.gitlab-ci.yml (+47/-0)
Makefile.am (+2/-0)
Makefile.am.coverage (+38/-0)
NEWS (+21/-0)
README (+0/-23)
README.md (+29/-0)
configure.ac (+10/-8)
debian/changelog (+13/-0)
libsignon-glib/Makefile.am (+9/-6)
libsignon-glib/signon-auth-service.c (+1/-0)
libsignon-glib/signon-auth-session.c (+20/-51)
libsignon-glib/signon-dbus-queue.c (+2/-2)
libsignon-glib/signon-dbus-queue.h (+1/-1)
libsignon-glib/signon-errors.h (+1/-1)
libsignon-glib/signon-identity-info.c (+1/-0)
libsignon-glib/signon-identity.c (+1/-22)
libsignon-glib/signon-utils.c (+2/-1)
libsignon-glib/sso-auth-service.c (+9/-1)
m4/gcov.m4 (+92/-0)
tests/Makefile.am (+4/-0)
tests/check_signon.c (+92/-4)
tests/signon-glib-test-wrapper.sh (+3/-0)
tests/signon-glib-test.sh (+9/-2)
To merge this branch: bzr merge lp:~online-accounts/libsignon-glib/packaging
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Online Accounts Pending
Review via email: mp+294012@code.launchpad.net

Description of the change

Migrate to GTask

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
159. By Alberto Mardegan

Migrate to GTask
Approved by: PS Jenkins bot

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.gitlab-ci.yml'
2--- .gitlab-ci.yml 1970-01-01 00:00:00 +0000
3+++ .gitlab-ci.yml 2016-05-19 15:30:34 +0000
4@@ -0,0 +1,47 @@
5+image: ubuntu:xenial
6+
7+cache:
8+ key: apt-cache
9+ paths:
10+ - apt-cache/
11+
12+before_script:
13+ - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
14+ - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -yq autotools-dev gobject-introspection gtk-doc-tools libgirepository1.0-dev libglib2.0-dev libtool python3 python3-gi python-gi-dev signond-dev
15+ - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -yq signon-plugin-ssotest check dbus-test-runner lcov gcovr
16+
17+build_amd64:
18+ stage: build
19+ script:
20+ - export PYTHON=python3
21+ - mkdir build
22+ - cd build
23+ - ../autogen.sh --enable-gtk-doc --enable-gcov --enable-debug --enable-python --prefix=/usr
24+ - make -j 4
25+ artifacts:
26+ paths:
27+ - ./
28+
29+test_amd64:
30+ stage: test
31+ script:
32+ - cd build
33+ - make check || (cat tests/test-suite.log && /bin/false)
34+ - make coverage-html
35+ dependencies:
36+ - build_amd64
37+ artifacts:
38+ paths:
39+ - ./
40+
41+pages:
42+ stage: deploy
43+ script:
44+ - mkdir public
45+ - cp -a build/coveragereport public/coverage
46+ - cp -a build/docs/reference/html/* public/
47+ dependencies:
48+ - test_amd64
49+ artifacts:
50+ paths:
51+ - public
52
53=== modified file 'Makefile.am'
54--- Makefile.am 2012-10-30 09:28:39 +0000
55+++ Makefile.am 2016-05-19 15:30:34 +0000
56@@ -12,6 +12,8 @@
57 SUBDIRS += tests
58 endif
59
60+include $(top_srcdir)/Makefile.am.coverage
61+
62 pkgconfigdir = $(libdir)/pkgconfig
63 pkgconfig_in_files = libsignon-glib.pc.in
64 pkgconfig_DATA = $(pkgconfig_in_files:.pc.in=.pc)
65
66=== added file 'Makefile.am.coverage'
67--- Makefile.am.coverage 1970-01-01 00:00:00 +0000
68+++ Makefile.am.coverage 2016-05-19 15:30:34 +0000
69@@ -0,0 +1,38 @@
70+
71+# Coverage targets
72+
73+.PHONY: clean-gcda
74+clean-gcda:
75+ @echo Removing old coverage results
76+ -$(AM_V_at)find -name '*.gcda' -print | xargs -r rm
77+
78+.PHONY: coverage-html generate-coverage-html clean-coverage-html
79+coverage-html: clean-gcda
80+ -$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
81+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
82+
83+if HAVE_GCOV
84+
85+generate-coverage-html:
86+ @echo Collecting coverage data
87+ $(AM_V_at)$(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
88+ $(AM_V_at)$(LCOV) --remove coverage.info signon-enum-types.c signon-errors-enum.c signon-marshal.c "sso-*-gen.*" -o coverage.info # autogenerated files
89+ $(AM_V_at)LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
90+
91+clean-coverage-html: clean-gcda
92+ -$(AM_V_at)$(LCOV) --directory $(top_builddir) -z
93+ -$(AM_V_at)rm -rf coverage.info coveragereport
94+
95+clean-local: clean-coverage-html
96+
97+else
98+
99+generate-coverage-html:
100+ $(AM_V_at)echo "Code coverage reporting not available"
101+
102+clean-coverage-html: clean-gcda
103+ -$(AM_V_at)rm -rf coverage.info coveragereport
104+
105+clean-local: clean-coverage-html
106+
107+endif # HAVE_GCOV
108
109=== modified file 'NEWS'
110--- NEWS 2014-12-09 08:52:37 +0000
111+++ NEWS 2016-05-19 15:30:34 +0000
112@@ -1,5 +1,26 @@
113 libsignon-glib NEWS
114
115+Version 1.14
116+------------
117+
118+* Migrate to GTask
119+* Fix memory leaks reported by valgrind
120+* Enable CI in gitlab.com
121+* Build: add test coverage reporting
122+* Build: fix parallel builds and out-of-tree builds
123+* Tests: add a test for signon_auth_session_process_async()
124+* Tests: allow running tests with valgrind
125+
126+Version 1.13
127+------------
128+
129+* Build: don't emit a build error on deprecations
130+* Build: ignore deprecations of GSimpleAsyncResult
131+* pkg-config: remove unused variable
132+ Fixes: https://gitlab.com/accounts-sso/libsignon-glib/issues/1
133+* Tests: do not count on mechanisms being ordered
134+* Introspection: mark ACL and realms as string lists, update Vala bindings
135+
136 Version 1.12
137 ------------
138
139
140=== removed file 'README'
141--- README 2015-11-27 02:48:53 +0000
142+++ README 1970-01-01 00:00:00 +0000
143@@ -1,23 +0,0 @@
144-Single signon authentication library for GLib applications
145-----------------------------------------------------------
146-
147-This project is a library for managing single signon credentilas which can be
148-used from GLib applications. It is effectively a GLib binding for the D-Bus API
149-provided by signond. It is part of the accounts-sso project:
150-
151-https://gitlab.com/groups/accounts-sso
152-
153-Dependencies
154-------------
155-
156-The project depends on GLib (including GIO and GObject), signond and check.
157-
158-Licence
159--------
160-
161-The library is licensed under the GNU LGPL version 2.1.
162-
163-Resources
164----------
165-
166-https://gitlab.com/accounts-sso/libsignon-glib
167
168=== added file 'README.md'
169--- README.md 1970-01-01 00:00:00 +0000
170+++ README.md 2016-05-19 15:30:34 +0000
171@@ -0,0 +1,29 @@
172+Single signon authentication library for GLib applications
173+==========================================================
174+
175+This project is a library for managing single signon credentilas which can be
176+used from GLib applications. It is effectively a GLib binding for the D-Bus API
177+provided by [signond][].
178+It is part of the accounts-sso project:
179+
180+https://gitlab.com/groups/accounts-sso
181+
182+Dependencies
183+------------
184+
185+The project depends on GLib (including GIO and GObject), [signond][] and [check][].
186+
187+Licence
188+-------
189+
190+The library is licensed under the GNU LGPL version 2.1.
191+
192+Resources
193+---------
194+
195+[API reference documentation](http://accounts-sso.gitlab.io/libsignon-glib/)
196+
197+[Official source code repository](https://gitlab.com/accounts-sso/libsignon-glib)
198+
199+[signond]: https://gitlab.com/accounts-sso/signond
200+[check]: https://github.com/libcheck/check
201
202=== modified file 'configure.ac'
203--- configure.ac 2015-12-09 07:59:54 +0000
204+++ configure.ac 2016-05-19 15:30:34 +0000
205@@ -1,7 +1,7 @@
206 dnl Process this file with autoconf to produce a configure script.
207 AC_PREREQ([2.64])
208 AC_INIT([libsignon-glib],
209- [1.13],
210+ [1.14],
211 [https://gitlab.com/accounts-sso/libsignon-glib/issues],
212 [libsignon-glib],
213 [https://gitlab.com/accounts-sso/libsignon-glib])
214@@ -11,7 +11,7 @@
215 AC_CONFIG_SRCDIR([libsignon-glib.pc.in])
216 AC_CONFIG_MACRO_DIR([m4])
217
218-AM_INIT_AUTOMAKE([1.11 -Wall check-news nostdinc silent-rules subdir-objects])
219+AM_INIT_AUTOMAKE([1.11 -Wall check-news nostdinc silent-rules subdir-objects foreign])
220
221 AC_PROG_CC
222 AC_PROG_CC_STDC
223@@ -25,7 +25,7 @@
224
225 PKG_CHECK_MODULES(
226 [DEPS],
227- [gio-2.0 >= 2.30
228+ [gio-2.0 >= 2.36
229 gio-unix-2.0
230 glib-2.0 >= 2.32
231 gobject-2.0 >= 2.35.1
232@@ -51,6 +51,13 @@
233 [AS_IF([test "x$enable_tests" = "xyes"],
234 [AC_MSG_ERROR([tests enabled but required dependencies were not found])])])
235
236+# gcov coverage reporting
237+m4_include([m4/gcov.m4])
238+AC_TDD_GCOV
239+AC_SUBST(COVERAGE_CFLAGS)
240+AC_SUBST(COVERAGE_CXXFLAGS)
241+AC_SUBST(COVERAGE_LDFLAGS)
242+
243 AM_CONDITIONAL([ENABLE_TESTS], [test "x$have_check" = "xyes"])
244
245 GTK_DOC_CHECK([1.14], [--flavour no-tmpl])
246@@ -75,11 +82,6 @@
247 AS_IF([test "x$enable_debug" = "xyes"],
248 [CFLAGS="$CFLAGS -DENABLE_DEBUG"])
249
250-AC_ARG_ENABLE([coverage],
251- [AS_HELP_STRING([--enable-coverage], [compile with coverage info])])
252-AS_IF([test "x$enable_coverage" = "xyes"],
253- [CFLAGS="$CFLAGS -g -fprofile-arcs -ftest-coverage"])
254-
255 # Python support.
256 PYGOBJECT_REQUIRED=2.90
257
258
259=== modified file 'debian/changelog'
260--- debian/changelog 2015-12-09 10:24:53 +0000
261+++ debian/changelog 2016-05-19 15:30:34 +0000
262@@ -1,3 +1,16 @@
263+libsignon-glib (1.14-0ubuntu1) UNRELEASED; urgency=medium
264+
265+ * New upstream release.
266+ - Migrate to GTask (LP: #1577373)
267+ - Fix memory leaks reported by valgrind
268+ - Enable CI in gitlab.com
269+ - Build: add test coverage reporting
270+ - Build: fix parallel builds and out-of-tree builds
271+ - Tests: add a test for signon_auth_session_process_async()
272+ - Tests: allow running tests with valgrind
273+
274+ -- Alberto Mardegan <alberto.mardegan@canonical.com> Thu, 19 May 2016 18:28:23 +0300
275+
276 libsignon-glib (1.13+16.04.20151209.1-0ubuntu1) xenial; urgency=medium
277
278 [ Alberto Mardegan ]
279
280=== modified file 'libsignon-glib/Makefile.am'
281--- libsignon-glib/Makefile.am 2015-12-02 08:57:16 +0000
282+++ libsignon-glib/Makefile.am 2016-05-19 15:30:34 +0000
283@@ -5,11 +5,14 @@
284 -I$(top_srcdir) \
285 -I$(srcdir) \
286 -I$(top_builddir) \
287- -I$(builddir) \
288+ -I$(builddir)
289+libsignon_glib_la_CFLAGS = \
290 $(DEPS_CFLAGS) \
291+ $(COVERAGE_CFLAGS) \
292 -Wall -Werror -Wno-error=deprecated-declarations
293 libsignon_glib_la_LIBADD = $(DEPS_LIBS)
294 libsignon_glib_la_LDFLAGS = \
295+ $(COVERAGE_LDFLAGS) \
296 -version-info 1:0:0 \
297 -export-symbols-regex '^signon_'
298
299@@ -75,8 +78,7 @@
300 signon-auth-session.h \
301 signon-identity-info.h
302
303-# This should come from `pkg-config --variable=interfaces_dir dbus-1`
304-DBUS_INTERFACES_DIR = /usr/share/dbus-1/interfaces
305+DBUS_INTERFACES_DIR = $(datadir)/dbus-1/interfaces
306
307 sso-auth-service-gen.h sso-auth-service-gen.c: $(DBUS_INTERFACES_DIR)/com.google.code.AccountsSSO.SingleSignOn.AuthService.xml
308 $(AM_V_GEN)gdbus-codegen \
309@@ -145,9 +147,9 @@
310 --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \
311 signon-errors.h ) | \
312 $(SED) -e 's/SEDSIGNON_ERROR_\([^,]*\)/SIGNOND_\1_ERR_NAME/' \
313- > xgen-getc \
314- && cp xgen-getc signon-errors-enum.c \
315- && rm -f xgen-getc
316+ > xgen-getc-enum \
317+ && cp xgen-getc-enum signon-errors-enum.c \
318+ && rm -f xgen-getc-enum
319
320 signon-errors-map.c: Makefile signon-errors.h
321 $(AM_V_GEN)( cd $(srcdir) && \
322@@ -189,6 +191,7 @@
323 --warn-all
324 Signon_1_0_gir_CFLAGS = \
325 -I$(top_srcdir) \
326+ -I$(top_builddir) \
327 $(DEPS_CFLAGS)
328 Signon_1_0_gir_LIBS = libsignon-glib.la
329 Signon_1_0_gir_FILES = $(introspection_sources)
330
331=== modified file 'libsignon-glib/signon-auth-service.c'
332--- libsignon-glib/signon-auth-service.c 2014-12-05 07:15:03 +0000
333+++ libsignon-glib/signon-auth-service.c 2016-05-19 15:30:34 +0000
334@@ -86,6 +86,7 @@
335 if (priv->cancellable)
336 {
337 g_cancellable_cancel (priv->cancellable);
338+ g_object_unref (priv->cancellable);
339 priv->cancellable = NULL;
340 }
341
342
343=== modified file 'libsignon-glib/signon-auth-session.c'
344--- libsignon-glib/signon-auth-session.c 2015-12-02 08:40:47 +0000
345+++ libsignon-glib/signon-auth-session.c 2016-05-19 15:30:34 +0000
346@@ -93,7 +93,6 @@
347 {
348 GVariant *session_data;
349 gchar *mechanism;
350- GCancellable *cancellable;
351 } AuthSessionProcessData;
352
353 typedef struct _AuthSessionQueryAvailableMechanismsCbData
354@@ -138,7 +137,7 @@
355 {
356 SignonAuthSession *self;
357 SsoAuthSession *proxy = SSO_AUTH_SESSION (object);
358- GSimpleAsyncResult *res_process = (GSimpleAsyncResult *)userdata;
359+ GTask *res_process = userdata;
360 GVariant *reply;
361 GError *error = NULL;
362
363@@ -146,29 +145,20 @@
364
365 sso_auth_session_call_process_finish (proxy, &reply, res, &error);
366
367-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
368- self = SIGNON_AUTH_SESSION (g_async_result_get_source_object (
369- (GAsyncResult *)res_process));
370+ self = SIGNON_AUTH_SESSION (g_task_get_source_object (res_process));
371 self->priv->busy = FALSE;
372
373 if (G_LIKELY (error == NULL))
374 {
375- g_simple_async_result_set_op_res_gpointer (res_process, reply,
376- (GDestroyNotify)
377- g_variant_unref);
378+ g_task_return_pointer (res_process, reply,
379+ (GDestroyNotify) g_variant_unref);
380 }
381 else
382 {
383- g_simple_async_result_take_error (res_process, error);
384+ g_task_return_error (res_process, error);
385 }
386
387- /* We use the idle variant in order to avoid the following critical
388- * message:
389- * g_main_context_pop_thread_default: assertion `g_queue_peek_head (stack) == context' failed
390- */
391- g_simple_async_result_complete_in_idle (res_process);
392-G_GNUC_END_IGNORE_DEPRECATIONS
393- g_object_unref (self);
394+ g_object_unref (res_process);
395 }
396
397 static void
398@@ -176,18 +166,17 @@
399 {
400 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
401 SignonAuthSessionPrivate *priv;
402- GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
403+ GTask *res = G_TASK (user_data);
404 AuthSessionProcessData *process_data;
405
406 g_return_if_fail (self != NULL);
407 priv = self->priv;
408
409-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
410 if (error != NULL)
411 {
412 DEBUG ("AuthSessionError: %s", error->message);
413- g_simple_async_result_set_from_error (res, error);
414- g_simple_async_result_complete (res);
415+ g_task_return_error (res, g_error_copy (error));
416+ g_object_unref (res);
417 return;
418 }
419
420@@ -195,14 +184,13 @@
421 {
422 priv->busy = FALSE;
423 priv->canceled = FALSE;
424- g_simple_async_result_set_error (res,
425- signon_error_quark (),
426- SIGNON_ERROR_SESSION_CANCELED,
427- "Authentication session was canceled");
428- g_simple_async_result_complete (res);
429+ g_task_return_new_error (res,
430+ signon_error_quark (),
431+ SIGNON_ERROR_SESSION_CANCELED,
432+ "Authentication session was canceled");
433+ g_object_unref (res);
434 return;
435 }
436-G_GNUC_END_IGNORE_DEPRECATIONS
437
438 process_data = g_object_get_data ((GObject *)res, data_key_process);
439 g_return_if_fail (process_data != NULL);
440@@ -210,7 +198,7 @@
441 sso_auth_session_call_process (priv->proxy,
442 process_data->session_data,
443 process_data->mechanism,
444- process_data->cancellable,
445+ g_task_get_cancellable (res),
446 auth_session_process_reply,
447 res);
448
449@@ -254,7 +242,6 @@
450
451 g_slice_free (AuthSessionProcessCbData, cb_data);
452 g_clear_error (&error);
453- g_object_unref (res);
454 }
455
456 static void
457@@ -432,8 +419,6 @@
458 {
459 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
460
461- SignonAuthSessionPrivate *priv = self->priv;
462- g_return_if_fail (priv != NULL);
463 g_return_if_fail (id >= 0);
464
465 auth_session_check_remote_object(self);
466@@ -490,9 +475,6 @@
467 gpointer user_data)
468 {
469 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
470- SignonAuthSessionPrivate* priv = self->priv;
471-
472- g_return_if_fail (priv != NULL);
473
474 AuthSessionQueryAvailableMechanismsCbData *cb_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsCbData);
475 cb_data->self = self;
476@@ -589,23 +571,18 @@
477 {
478 SignonAuthSessionPrivate *priv;
479 AuthSessionProcessData *process_data;
480- GSimpleAsyncResult *res;
481+ GTask *res;
482
483 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
484 priv = self->priv;
485
486 g_return_if_fail (session_data != NULL);
487
488-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
489- res = g_simple_async_result_new ((GObject *)self, callback, user_data,
490- signon_auth_session_process_async);
491- g_simple_async_result_set_check_cancellable (res, cancellable);
492-G_GNUC_END_IGNORE_DEPRECATIONS
493+ res = g_task_new (self, cancellable, callback, user_data);
494
495 process_data = g_slice_new0 (AuthSessionProcessData);
496 process_data->session_data = g_variant_ref_sink (session_data);
497 process_data->mechanism = g_strdup (mechanism);
498- process_data->cancellable = cancellable;
499 g_object_set_data_full ((GObject *)res, data_key_process, process_data,
500 (GDestroyNotify)auth_session_process_data_free);
501
502@@ -636,19 +613,12 @@
503 signon_auth_session_process_finish (SignonAuthSession *self, GAsyncResult *res,
504 GError **error)
505 {
506- GSimpleAsyncResult *async_result;
507- GVariant *reply;
508+ GTask *task;
509
510 g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), NULL);
511
512- async_result = (GSimpleAsyncResult *)res;
513-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
514- if (g_simple_async_result_propagate_error (async_result, error))
515- return NULL;
516-
517- reply = g_simple_async_result_get_op_res_gpointer (async_result);
518-G_GNUC_END_IGNORE_DEPRECATIONS
519- return g_variant_ref (reply);
520+ task = G_TASK (res);
521+ return g_task_propagate_pointer (task, error);
522 }
523
524 /**
525@@ -748,7 +718,6 @@
526 DEBUG ("Object path received: %s", object_path);
527 g_free (object_path);
528 _signon_object_ready (self, auth_session_object_quark (), error);
529- g_clear_error (&error);
530 }
531
532 static void
533
534=== modified file 'libsignon-glib/signon-dbus-queue.c'
535--- libsignon-glib/signon-dbus-queue.c 2010-06-29 07:25:04 +0000
536+++ libsignon-glib/signon-dbus-queue.c 2016-05-19 15:30:34 +0000
537@@ -121,7 +121,7 @@
538 }
539
540 void
541-_signon_object_ready (gpointer object, GQuark quark, const GError *error)
542+_signon_object_ready (gpointer object, GQuark quark, GError *error)
543 {
544 SignonReadyData *rd;
545
546@@ -129,7 +129,7 @@
547
548 if(error)
549 g_object_set_qdata_full ((GObject *)object, _signon_object_error_quark(),
550- g_error_copy(error),
551+ error,
552 (GDestroyNotify)g_error_free);
553
554 /* steal the qdata so the callbacks won't be invoked again, even if the
555
556=== modified file 'libsignon-glib/signon-dbus-queue.h'
557--- libsignon-glib/signon-dbus-queue.h 2010-06-28 11:59:12 +0000
558+++ libsignon-glib/signon-dbus-queue.h 2016-05-19 15:30:34 +0000
559@@ -36,7 +36,7 @@
560 void _signon_object_call_when_ready (gpointer object, GQuark quark,
561 SignonReadyCb callback, gpointer user_data);
562
563-void _signon_object_ready (gpointer object, GQuark quark, const GError *error);
564+void _signon_object_ready (gpointer object, GQuark quark, GError *error);
565 void _signon_object_not_ready (gpointer object);
566
567 const GError *_signon_object_last_error (gpointer object);
568
569=== modified file 'libsignon-glib/signon-errors.h'
570--- libsignon-glib/signon-errors.h 2012-01-27 10:24:27 +0000
571+++ libsignon-glib/signon-errors.h 2016-05-19 15:30:34 +0000
572@@ -27,7 +27,7 @@
573
574 #include <glib.h>
575 #include <glib-object.h>
576-#include "signon-enum-types.h"
577+#include <libsignon-glib/signon-enum-types.h>
578
579 #define SIGNON_ERROR (signon_error_quark())
580
581
582=== modified file 'libsignon-glib/signon-identity-info.c'
583--- libsignon-glib/signon-identity-info.c 2015-04-02 13:23:18 +0000
584+++ libsignon-glib/signon-identity-info.c 2016-05-19 15:30:34 +0000
585@@ -144,6 +144,7 @@
586 {
587 g_hash_table_insert (info->methods, method, mechanisms);
588 }
589+ g_variant_unref (method_map);
590 }
591
592 g_variant_lookup (variant,
593
594=== modified file 'libsignon-glib/signon-identity.c'
595--- libsignon-glib/signon-identity.c 2015-04-02 13:23:18 +0000
596+++ libsignon-glib/signon-identity.c 2016-05-19 15:30:34 +0000
597@@ -949,9 +949,6 @@
598 {
599 g_return_if_fail (SIGNON_IS_IDENTITY (self));
600
601- SignonIdentityPrivate *priv = self->priv;
602- g_return_if_fail (priv != NULL);
603-
604 DEBUG ("%s %d", G_STRFUNC, __LINE__);
605
606 IdentityVerifyCbData *cb_data = g_slice_new0 (IdentityVerifyCbData);
607@@ -1202,7 +1199,7 @@
608 }
609 }
610
611- if (priv->updated == TRUE)
612+ if (priv->updated || priv->removed)
613 g_slice_free (IdentityInfoCbData, cb_data);
614
615 g_slice_free (IdentityVoidData, operation_data);
616@@ -1308,9 +1305,6 @@
617 {
618 g_return_if_fail (SIGNON_IS_IDENTITY (self));
619
620- SignonIdentityPrivate *priv = self->priv;
621- g_return_if_fail (priv != NULL);
622-
623 DEBUG ("%s %d", G_STRFUNC, __LINE__);
624
625 IdentityVoidData *operation_data = g_slice_new0 (IdentityVoidData);
626@@ -1335,9 +1329,6 @@
627 {
628 g_return_if_fail (SIGNON_IS_IDENTITY (self));
629
630- SignonIdentityPrivate *priv = self->priv;
631- g_return_if_fail (priv != NULL);
632-
633 IdentityVoidCbData *cb_data = g_slice_new0 (IdentityVoidCbData);
634 cb_data->self = self;
635 cb_data->cb = (SignonIdentityVoidCb)cb;
636@@ -1368,9 +1359,6 @@
637 {
638 g_return_if_fail (SIGNON_IS_IDENTITY (self));
639
640- SignonIdentityPrivate *priv = self->priv;
641- g_return_if_fail (priv != NULL);
642-
643 IdentityVoidCbData *cb_data = g_slice_new0 (IdentityVoidCbData);
644 cb_data->self = self;
645 cb_data->cb = (SignonIdentityVoidCb)cb;
646@@ -1399,9 +1387,6 @@
647 {
648 g_return_if_fail (SIGNON_IS_IDENTITY (self));
649
650- SignonIdentityPrivate *priv = self->priv;
651- g_return_if_fail (priv != NULL);
652-
653 //TODO implement
654
655 if (cb)
656@@ -1424,9 +1409,6 @@
657 {
658 g_return_if_fail (SIGNON_IS_IDENTITY (self));
659
660- SignonIdentityPrivate *priv = self->priv;
661- g_return_if_fail (priv != NULL);
662-
663 //TODO implement
664
665 if (cb)
666@@ -1448,9 +1430,6 @@
667 {
668 g_return_if_fail (SIGNON_IS_IDENTITY (self));
669
670- SignonIdentityPrivate *priv = self->priv;
671- g_return_if_fail (priv != NULL);
672-
673 IdentityInfoCbData *cb_data = g_slice_new0 (IdentityInfoCbData);
674 cb_data->self = self;
675 cb_data->cb = cb;
676
677=== modified file 'libsignon-glib/signon-utils.c'
678--- libsignon-glib/signon-utils.c 2012-10-17 07:06:24 +0000
679+++ libsignon-glib/signon-utils.c 2016-05-19 15:30:34 +0000
680@@ -106,7 +106,7 @@
681
682 if (G_VALUE_TYPE (value) == G_TYPE_VARIANT)
683 {
684- val = g_value_get_variant (value);
685+ val = g_value_dup_variant (value);
686 }
687 else
688 {
689@@ -115,6 +115,7 @@
690 val = g_dbus_gvalue_to_gvariant (value, type);
691 }
692 g_variant_builder_add (&builder, "{sv}", key, val);
693+ g_variant_unref (val);
694 }
695 return g_variant_builder_end (&builder);
696 }
697
698=== modified file 'libsignon-glib/sso-auth-service.c'
699--- libsignon-glib/sso-auth-service.c 2012-08-02 10:25:45 +0000
700+++ libsignon-glib/sso-auth-service.c 2016-05-19 15:30:34 +0000
701@@ -51,6 +51,13 @@
702 }
703
704 static void
705+weak_ref_free(GWeakRef *ref)
706+{
707+ g_weak_ref_clear (ref);
708+ g_slice_free (GWeakRef, ref);
709+}
710+
711+static void
712 set_singleton (SsoAuthService *object)
713 {
714 g_return_if_fail (IS_SSO_AUTH_SERVICE (object));
715@@ -59,7 +66,8 @@
716
717 if (thread_objects == NULL)
718 {
719- thread_objects = g_hash_table_new (g_direct_hash, g_direct_equal);
720+ thread_objects = g_hash_table_new_full (g_direct_hash, g_direct_equal,
721+ NULL, (GDestroyNotify) weak_ref_free);
722 }
723
724 if (object != NULL)
725
726=== added file 'm4/gcov.m4'
727--- m4/gcov.m4 1970-01-01 00:00:00 +0000
728+++ m4/gcov.m4 2016-05-19 15:30:34 +0000
729@@ -0,0 +1,92 @@
730+# Copyright 2012-2016 Canonical Ltd.
731+#
732+# This program is free software: you can redistribute it and/or modify it
733+# under the terms of the GNU General Public License version 3, as published
734+# by the Free Software Foundation.
735+#
736+# This program is distributed in the hope that it will be useful, but
737+# WITHOUT ANY WARRANTY; without even the implied warranties of
738+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
739+# PURPOSE. See the GNU General Public License for more details.
740+#
741+# You should have received a copy of the GNU General Public License along
742+# with this program. If not, see <http://www.gnu.org/licenses/>.
743+
744+# Checks for existence of coverage tools:
745+# * gcov
746+# * lcov
747+# * genhtml
748+# * gcovr
749+#
750+# Sets ac_cv_check_gcov to yes if tooling is present
751+# and reports the executables to the variables LCOV, GCOVR and GENHTML.
752+AC_DEFUN([AC_TDD_GCOV],
753+[
754+ AC_ARG_ENABLE(gcov,
755+ AS_HELP_STRING([--enable-gcov],
756+ [enable coverage testing with gcov]))
757+
758+ AM_CONDITIONAL(HAVE_GCOV, test "x$enable_gcov" = "xyes")
759+
760+ if test "x$enable_gcov" = "xyes"; then
761+ # we need gcc:
762+ if test "$GCC" != "yes"; then
763+ AC_MSG_ERROR([GCC is required for --enable-gcov])
764+ fi
765+
766+ # Check if ccache is being used
767+ AC_CHECK_PROG(SHTOOL, shtool, shtool)
768+ if test "$SHTOOL"; then
769+ AS_CASE([`$SHTOOL path $CC`],
770+ [*ccache*], [gcc_ccache=yes],
771+ [gcc_ccache=no])
772+ fi
773+
774+ if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
775+ AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
776+ fi
777+
778+ lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
779+ AC_CHECK_PROG(LCOV, lcov, lcov)
780+ AC_CHECK_PROG(GENHTML, genhtml, genhtml)
781+
782+ if test "$LCOV"; then
783+ AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
784+ glib_cv_lcov_version=invalid
785+ lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
786+ for lcov_check_version in $lcov_version_list; do
787+ if test "$lcov_version" = "$lcov_check_version"; then
788+ glib_cv_lcov_version="$lcov_check_version (ok)"
789+ fi
790+ done
791+ ])
792+ else
793+ lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
794+ AC_MSG_ERROR([$lcov_msg])
795+ fi
796+
797+ case $glib_cv_lcov_version in
798+ ""|invalid[)]
799+ lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
800+ AC_MSG_ERROR([$lcov_msg])
801+ LCOV="exit 0;"
802+ ;;
803+ esac
804+
805+ if test -z "$GENHTML"; then
806+ AC_MSG_ERROR([Could not find genhtml from the lcov package])
807+ fi
808+
809+ # Remove all optimization flags from CFLAGS
810+ changequote({,})
811+ CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
812+ changequote([,])
813+
814+ # Add the special gcc flags
815+ COVERAGE_CFLAGS="--coverage -DG_DISABLE_ASSERTS -DG_DISABLE_CHECKS"
816+ COVERAGE_CXXFLAGS="--coverage"
817+ COVERAGE_LDFLAGS="-lgcov"
818+
819+fi
820+]) # AC_TDD_GCOV
821+
822
823=== modified file 'tests/Makefile.am'
824--- tests/Makefile.am 2014-12-09 09:20:01 +0000
825+++ tests/Makefile.am 2016-05-19 15:30:34 +0000
826@@ -5,6 +5,7 @@
827
828 signon_glib_testsuite_SOURCES = check_signon.c
829 signon_glib_testsuite_CPPFLAGS = \
830+ -I$(top_builddir) \
831 -I$(top_srcdir) \
832 $(DEPS_CFLAGS) \
833 $(CHECK_FLAGS)
834@@ -14,4 +15,7 @@
835 $(DEPS_LIBS) \
836 -lpthread
837
838+TESTS_ENVIRONMENT = \
839+ TESTDIR=$(top_srcdir)/tests/; export TESTDIR;
840+
841 TESTS = signon-glib-test.sh
842
843=== modified file 'tests/check_signon.c'
844--- tests/check_signon.c 2015-04-20 11:32:46 +0000
845+++ tests/check_signon.c 2016-05-19 15:30:34 +0000
846@@ -309,6 +309,7 @@
847 g_main_loop_run (main_loop);
848
849 g_free(patterns[0]);
850+ g_object_unref(auth_session);
851 g_object_unref(idty);
852
853 end_test ();
854@@ -366,6 +367,7 @@
855 g_free(patterns[0]);
856 g_free(patterns[1]);
857 g_free(patterns[2]);
858+ g_object_unref(auth_session);
859 g_object_unref(idty);
860
861 end_test ();
862@@ -406,8 +408,6 @@
863 fail_unless(g_strcmp0(g_value_get_string(usernameVa), "test_username") == 0, "Wrong value of username");
864 fail_unless(g_strcmp0(g_value_get_string(realmVa), "testRealm_after_test") == 0, "Wrong value of realm");
865
866- g_hash_table_destroy(sessionData);
867-
868 g_free(usernameKey);
869 g_free(realmKey);
870
871@@ -528,6 +528,88 @@
872 g_free(passwordVa);
873 g_free(passwordKey);
874
875+ g_hash_table_unref (sessionData);
876+
877+ end_test ();
878+}
879+END_TEST
880+
881+static void
882+test_auth_session_process_async_cb (GObject *source_object,
883+ GAsyncResult *res,
884+ gpointer user_data)
885+{
886+ SignonAuthSession *auth_session = SIGNON_AUTH_SESSION (source_object);
887+ GVariant **v_reply = user_data;
888+ GError *error = NULL;
889+
890+ fail_unless (SIGNON_IS_AUTH_SESSION (source_object));
891+
892+ *v_reply = signon_auth_session_process_finish (auth_session, res, &error);
893+ fail_unless (error == NULL);
894+
895+ g_main_loop_quit (main_loop);
896+}
897+
898+START_TEST(test_auth_session_process_async)
899+{
900+ gint state_counter = 0;
901+ GError *err = NULL;
902+ GVariantBuilder builder;
903+ GVariant *session_data, *reply;
904+ gchar *username, *realm;
905+ gboolean ok;
906+
907+ g_debug("%s", G_STRFUNC);
908+ SignonIdentity *idty = signon_identity_new(NULL, NULL);
909+ fail_unless (idty != NULL, "Cannot create Iddentity object");
910+
911+ SignonAuthSession *auth_session = signon_identity_create_session(idty,
912+ "ssotest",
913+ &err);
914+
915+ fail_unless (auth_session != NULL, "Cannot create AuthSession object");
916+
917+ g_clear_error(&err);
918+
919+ g_signal_connect(auth_session, "state-changed",
920+ G_CALLBACK(test_auth_session_states_cb), &state_counter);
921+
922+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
923+ g_variant_builder_add (&builder, "{sv}",
924+ SIGNON_SESSION_DATA_USERNAME,
925+ g_variant_new_string ("test_username"));
926+ g_variant_builder_add (&builder, "{sv}",
927+ SIGNON_SESSION_DATA_SECRET,
928+ g_variant_new_string ("test_pw"));
929+
930+ session_data = g_variant_builder_end (&builder);
931+
932+ signon_auth_session_process_async (auth_session,
933+ session_data,
934+ "mech1",
935+ NULL,
936+ test_auth_session_process_async_cb,
937+ &reply);
938+ main_loop = g_main_loop_new (NULL, FALSE);
939+ g_main_loop_run (main_loop);
940+ fail_unless (state_counter == 12, "Wrong numer of state change signals: %d", state_counter);
941+
942+ fail_unless (reply != NULL);
943+ session_data = NULL;
944+
945+ ok = g_variant_lookup (reply, SIGNON_SESSION_DATA_USERNAME, "&s", &username);
946+ ck_assert (ok);
947+ ck_assert_str_eq (username, "test_username");
948+ ok = g_variant_lookup (reply, SIGNON_SESSION_DATA_REALM, "&s", &realm);
949+ ck_assert (ok);
950+ ck_assert_str_eq (realm, "testRealm_after_test");
951+
952+ g_variant_unref (reply);
953+
954+ g_object_unref (auth_session);
955+ g_object_unref (idty);
956+
957 end_test ();
958 }
959 END_TEST
960@@ -581,6 +663,7 @@
961 fail_unless (error->domain == SIGNON_ERROR);
962 fail_unless (error->code == SIGNON_ERROR_METHOD_NOT_KNOWN);
963
964+ g_error_free (error);
965 g_object_unref (auth_session);
966
967 end_test ();
968@@ -610,7 +693,6 @@
969 fail_unless (g_strcmp0 (g_value_get_string (v_username), "Nice user") == 0,
970 "Wrong value of username");
971
972- g_hash_table_unref (reply);
973 g_object_unref (self);
974
975 g_main_loop_quit (main_loop);
976@@ -654,6 +736,7 @@
977 "mech1",
978 test_auth_session_process_after_store_cb,
979 NULL);
980+ g_hash_table_unref (session_data);
981 }
982
983 START_TEST(test_auth_session_process_after_store)
984@@ -681,6 +764,7 @@
985 g_main_loop_run (main_loop);
986
987 g_object_unref (identity);
988+ signon_identity_info_free (info);
989
990 end_test ();
991 }
992@@ -722,6 +806,7 @@
993
994 *new_id = id;
995
996+ g_object_unref (self);
997 g_main_loop_quit (main_loop);
998 }
999
1000@@ -1064,7 +1149,7 @@
1001 fail_unless (_contains(mechs3, "mechanism3"));
1002 }
1003
1004- if (info)
1005+ if (info && pattern_ptr)
1006 {
1007 signon_identity_info_free (pattern);
1008 *pattern_ptr = signon_identity_info_copy (info);
1009@@ -1309,6 +1394,7 @@
1010 signon_identity_query_info (idty, identity_info_cb, &info);
1011 g_main_loop_run (main_loop);
1012
1013+ signon_identity_info_free (info);
1014 g_object_unref (idty);
1015 g_object_unref (idty2);
1016
1017@@ -1425,6 +1511,7 @@
1018 "mech1",
1019 test_regression_unref_process_cb,
1020 "Hi there!");
1021+ g_hash_table_unref (session_data);
1022 g_main_loop_run (main_loop);
1023
1024 end_test ();
1025@@ -1453,6 +1540,7 @@
1026 tcase_add_test (tc_core, test_auth_session_query_mechanisms);
1027 tcase_add_test (tc_core, test_auth_session_query_mechanisms_nonexisting);
1028 tcase_add_test (tc_core, test_auth_session_process);
1029+ tcase_add_test (tc_core, test_auth_session_process_async);
1030 tcase_add_test (tc_core, test_auth_session_process_failure);
1031 tcase_add_test (tc_core, test_auth_session_process_after_store);
1032 tcase_add_test (tc_core, test_store_credentials_identity);
1033
1034=== added file 'tests/signon-glib-test-wrapper.sh'
1035--- tests/signon-glib-test-wrapper.sh 1970-01-01 00:00:00 +0000
1036+++ tests/signon-glib-test-wrapper.sh 2016-05-19 15:30:34 +0000
1037@@ -0,0 +1,3 @@
1038+#!/bin/sh
1039+
1040+exec "$(pwd)/../libtool" --mode=execute $WRAPPER ./signon-glib-testsuite
1041
1042=== modified file 'tests/signon-glib-test.sh'
1043--- tests/signon-glib-test.sh 2015-04-10 07:27:34 +0000
1044+++ tests/signon-glib-test.sh 2016-05-19 15:30:34 +0000
1045@@ -10,9 +10,16 @@
1046
1047 #Environment variables for the test application
1048 export G_MESSAGES_DEBUG=all
1049-export G_SLICE=debug-blocks
1050+# If running the test executable under a wrapper, setup the tests so that the
1051+# wrapper can debug them more easily.
1052+if [ -n "$WRAPPER" ]; then
1053+ export G_SLICE=always-malloc
1054+ export CK_FORK="no"
1055+else
1056+ export G_SLICE=debug-blocks
1057+fi
1058
1059-TEST_APP=./signon-glib-testsuite
1060+TEST_APP="$TESTDIR/signon-glib-test-wrapper.sh"
1061
1062 # If dbus-test-runner exists, use it to run the tests in a separate D-Bus
1063 # session

Subscribers

No one subscribed via source and target branches