Added test coverage result generation 16/14116/1 accepted/tizen/ivi/20131223.212935 accepted/tizen/mobile/20131223.184305 submit/tizen/20131223.140056
authorImran Zaman <imran.zaman@intel.com>
Mon, 23 Dec 2013 13:37:35 +0000 (15:37 +0200)
committerImran Zaman <imran.zaman@intel.com>
Mon, 23 Dec 2013 13:38:51 +0000 (15:38 +0200)
- added test cases for error and dictionary objects
- utilized dictionary functions for get/set key-value pairs
- clean up generated coverage files on make clean
- enable tests by default if coverage is enabled
- exclude external and generated dbus files from code coverage calculation

Change-Id: Iabcd6f179298301dccc830e6f36ea2aa5e416a8f
Signed-off-by: Imran Zaman <imran.zaman@intel.com>
33 files changed:
.gitignore
Makefile.am
Makefile.in
configure
configure.ac
dists/rpm/gum-suse.spec
dists/rpm/tizen/packaging/gumd.changes
docs/html/GumConfig.html
docs/html/GumDisposable.html
docs/html/ch01.html
docs/html/ch02.html
docs/html/ch03.html
docs/html/ch04.html
docs/html/ch05.html
docs/html/gumd-examples.html
docs/html/um-intro.html
examples/Makefile.am
examples/Makefile.in
src/common/Makefile.am
src/common/Makefile.in
src/common/gum-config.c
src/daemon/Makefile.am
src/daemon/Makefile.in
src/lib/Makefile.am
src/lib/Makefile.in
test/Makefile.am
test/common/Makefile.am
test/common/Makefile.in
test/common/commontest.c
test/daemon/Makefile.am
test/daemon/Makefile.in
test/lib/Makefile.am
test/lib/Makefile.in

index 878a53f..4900283 100644 (file)
@@ -22,6 +22,8 @@ m4/lt*.m4
 *.stamp
 *.typelib
 *.tar.*
+*.gcno
+*.gcda
 build-aux
 *dbus*gen*
 src/common/gum.conf
index 8ea26de..ce70a36 100644 (file)
@@ -21,7 +21,8 @@ valgrind:
 
 lcov: check
        @rm -rf lcov-report
-       @lcov -c --directory src/ --output-file lcov.output
+       @lcov --no-external -c --directory src/ --output-file cov.output
+       @lcov -r cov.output common/dbus/\* daemon/dbus/\*.c --output-file lcov.output
        @genhtml lcov.output --output-directory lcov-report
-       @rm lcov.output
+       @rm lcov.output cov.output
        @echo "Coverage report is in file://$(abs_srcdir)/lcov-report/index.html"
index 908f2f1..22de36c 100644 (file)
@@ -809,9 +809,10 @@ valgrind:
 
 lcov: check
        @rm -rf lcov-report
-       @lcov -c --directory src/ --output-file lcov.output
+       @lcov --no-external -c --directory src/ --output-file cov.output
+       @lcov -r cov.output common/dbus/\* daemon/dbus/\*.c --output-file lcov.output
        @genhtml lcov.output --output-directory lcov-report
-       @rm lcov.output
+       @rm lcov.output cov.output
        @echo "Coverage report is in file://$(abs_srcdir)/lcov-report/index.html"
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index fe19a17..d63356f 100755 (executable)
--- a/configure
+++ b/configure
@@ -797,7 +797,7 @@ enable_fast_install
 with_gnu_ld
 with_sysroot
 enable_libtool_lock
-enable_gcov
+enable_cov
 enable_distcheck
 enable_dbus_type
 enable_tests
@@ -1468,7 +1468,7 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --enable-gcov build to be used for coverage analysis
+  --enable-cov build to be used for coverage analysis
   --enable-distcheck build for distcheck target
   --enable-dbus-type=dbus-type specify daemon dbus type:
            p2p: uses peer to peer dbus
@@ -12271,15 +12271,15 @@ if test "x$CRYPT_LIB" = "x" ; then
     as_fn_error $? "\"CRYPT Library is required\"" "$LINENO" 5
 fi
 
-# Enable gcov
-# Check whether --enable-gcov was given.
-if test "${enable_gcov+set}" = set; then :
-  enableval=$enable_gcov; enable_gcov=yes
+# Enable cov
+# Check whether --enable-cov was given.
+if test "${enable_cov+set}" = set; then :
+  enableval=$enable_cov; enable_cov=yes
 else
-  enable_gcov=no
+  enable_cov=no
 fi
 
-if test "x$enable_gcov" = "xyes" ; then
+if test "x$enable_cov" = "xyes" ; then
     GCOV_CFLAGS="-ftest-coverage -fprofile-arcs"
     GCOV_LIBS="-lgcov"
 fi
@@ -12575,6 +12575,10 @@ else
   enable_tests=no
 fi
 
+if test "x$enable_cov" = "xyes" ; then
+    # Enable tests automatically when code coverage is enabled
+    enable_tests="yes"
+fi
 echo "--------------------------------"
 echo "Enable tests features: '$enable_tests'"
 if test "x$enable_tests" = "xyes" ; then
index 70154c8..071c892 100644 (file)
@@ -55,10 +55,10 @@ if test "x$CRYPT_LIB" = "x" ; then
     AC_MSG_ERROR("CRYPT Library is required")
 fi
 
-# Enable gcov
-AC_ARG_ENABLE(gcov, [  --enable-gcov build to be used for coverage analysis ],
-          [enable_gcov=yes], [enable_gcov=no])
-if test "x$enable_gcov" = "xyes" ; then
+# Enable cov
+AC_ARG_ENABLE(cov, [  --enable-cov build to be used for coverage analysis ],
+          [enable_cov=yes], [enable_cov=no])
+if test "x$enable_cov" = "xyes" ; then
     GCOV_CFLAGS="-ftest-coverage -fprofile-arcs"
     GCOV_LIBS="-lgcov"
 fi
@@ -130,6 +130,10 @@ fi
 # Enable tests
 AC_ARG_ENABLE(tests, [  --enable-tests  enable tests features],
           [enable_tests=yes], [enable_tests=no])
+if test "x$enable_cov" = "xyes" ; then
+    # Enable tests automatically when code coverage is enabled
+    enable_tests="yes"
+fi
 echo "--------------------------------"
 echo "Enable tests features: '$enable_tests'"
 if test "x$enable_tests" = "xyes" ; then
index 690065e..cf1c1a2 100644 (file)
@@ -189,6 +189,13 @@ groupadd -f -r gumd
 
 
 %changelog
+* Mon Dec 23 2013 Imran Zaman <imran.zaman@intel.com>
+- added test cases for error and dictionary objects
+- utilized dictionary functions for get/set key-value pairs
+- clean up generated coverage files on make clean
+- enable tests by default if coverage is enabled
+- exclude external and generated dbus files from code coverage calculation
+
 * Fri Dec 20 2013 Imran Zaman <imran.zaman@intel.com>
 - Corrected spec and changes file names 
 
index c9b00ac..994a06d 100644 (file)
@@ -1,3 +1,10 @@
+* Mon Dec 23 2013 Imran Zaman <imran.zaman@intel.com>
+- added test cases for error and dictionary objects
+- utilized dictionary functions for get/set key-value pairs
+- clean up generated coverage files on make clean
+- enable tests by default if coverage is enabled
+- exclude external and generated dbus files from code coverage calculation
+
 * Fri Dec 20 2013 Imran Zaman <imran.zaman@intel.com>
 - Corrected spec and changes file names 
 
index ce2d537..9f69256 100644 (file)
@@ -87,7 +87,7 @@ for where the file is searched for.
 <p>
 </p>
 <div class="refsect1">
-<a name="idp7772064"></a><h2>Usage</h2>
+<a name="idp10298048"></a><h2>Usage</h2>
 </div>
 <p>
 Following code snippet demonstrates how to create and use config object:
@@ -105,7 +105,7 @@ g_object_unref(config);
 <p>
 </p>
 <div class="refsect1">
-<a name="idp6490208"></a><h2>Where the configuration file is searched for</h2>
+<a name="idp6443376"></a><h2>Where the configuration file is searched for</h2>
 </div>
 <p>
 </p>
@@ -127,7 +127,7 @@ $(sysconfdir) + "gum.conf"
 <p>
 </p>
 <div class="refsect1">
-<a name="idp2053520"></a><h2>Example configuration file</h2>
+<a name="idp7297552"></a><h2>Example configuration file</h2>
 </div>
 <p>
 </p>
index e18b276..8e19247 100644 (file)
@@ -90,7 +90,7 @@ be required to destory after some period of inactivity.
 <p>
 </p>
 <div class="refsect1">
-<a name="idp8989072"></a><h2>Usage</h2>
+<a name="idp9673808"></a><h2>Usage</h2>
 </div>
 <p>
 Following code snippet demonstrates how to derive and use <a class="link" href="GumDisposable.html" title="GumDisposable"><span class="type">GumDisposable</span></a>:
index e7abd77..53ccaf8 100644 (file)
@@ -21,7 +21,7 @@
 </tr></table>
 <div class="chapter">
 <div class="titlepage"><div><div><h2 class="title">
-<a name="idp3960928"></a>Daemon (gumd) configuration</h2></div></div></div>
+<a name="idp3002784"></a>Daemon (gumd) configuration</h2></div></div></div>
 <div class="toc"><dl>
 <dt>
 <span class="refentrytitle"><a href="GumConfig.html">GumConfig</a></span><span class="refpurpose"> — gum configuration information</span>
index 98b696b..90c63a5 100644 (file)
@@ -21,7 +21,7 @@
 </tr></table>
 <div class="chapter">
 <div class="titlepage"><div><div><h2 class="title">
-<a name="idp3451296"></a>Common</h2></div></div></div>
+<a name="idp4620992"></a>Common</h2></div></div></div>
 <div class="toc"><dl>
 <dt>
 <span class="refentrytitle"><a href="gumd-GumDictionary.html">GumDictionary</a></span><span class="refpurpose"> — a dictionary container holding string keys and variant
index 359f37d..82119a1 100644 (file)
@@ -21,7 +21,7 @@
 </tr></table>
 <div class="chapter">
 <div class="titlepage"><div><div><h2 class="title">
-<a name="idp3578176"></a>Client library (libgum) interface</h2></div></div></div>
+<a name="idp2676240"></a>Client library (libgum) interface</h2></div></div></div>
 <div class="toc"><dl>
 <dt>
 <span class="refentrytitle"><a href="GumUser.html">GumUser</a></span><span class="refpurpose"> — provides interface for managing user's account</span>
index ffbcb8a..3cb1ece 100644 (file)
@@ -54,7 +54,7 @@
 </table>
 <div class="chapter">
 <div class="titlepage"><div><div><h2 class="title">
-<a name="idp3871680"></a>Appendices</h2></div></div></div>
+<a name="idp2117968"></a>Appendices</h2></div></div></div>
 <a name="idx"></a><a name="idxC"></a><h3 class="title">C</h3>
 <dt>
 <a class="link" href="GumConfig.html#GumConfig-struct" title="struct GumConfig">GumConfig</a>, struct in <a class="link" href="GumConfig.html" title="GumConfig">GumConfig</a>
index 675cd5d..9cd4c63 100644 (file)
@@ -21,7 +21,7 @@
 </tr></table>
 <div class="chapter">
 <div class="titlepage"><div><div><h2 class="title">
-<a name="idp127328"></a>Deprecated APIs</h2></div></div></div>
+<a name="idp4013616"></a>Deprecated APIs</h2></div></div></div>
 <a name="idx"></a>
 </div>
 <div class="footer">
index e933c9f..392920a 100644 (file)
@@ -45,7 +45,7 @@
      </p>
 </div>
 <div class="refsect1">
-<a name="idp7688560"></a><h2>Add User</h2>
+<a name="idp8945280"></a><h2>Add User</h2>
 <p>
         User can be added with flag <strong class="userinput"><code>--add-user</code></strong>:
         </p>
@@ -74,7 +74,7 @@
      </p>
 </div>
 <div class="refsect1">
-<a name="idp10589744"></a><h2>Delete User</h2>
+<a name="idp8613200"></a><h2>Delete User</h2>
 <p>
         User can be deleted with flag <strong class="userinput"><code>--delete-user</code></strong>:
         </p>
@@ -89,7 +89,7 @@
      </p>
 </div>
 <div class="refsect1">
-<a name="idp9659056"></a><h2>Update User</h2>
+<a name="idp12556272"></a><h2>Update User</h2>
 <p>
         User can be update with flag <strong class="userinput"><code>--update-user</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp13327120"></a><h2>Get User</h2>
+<a name="idp12561184"></a><h2>Get User</h2>
 <p>
         User data can be retrieved with flag <strong class="userinput"><code>--get-user</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp13217984"></a><h2>Get User By Name</h2>
+<a name="idp12379840"></a><h2>Get User By Name</h2>
 <p>
         User data can be retrieved with flag <strong class="userinput"><code>--get-user-by-name</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp13222496"></a><h2>Add Group</h2>
+<a name="idp13033520"></a><h2>Add Group</h2>
 <p>
         Group can be added with flag <strong class="userinput"><code>--add-group</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp14360928"></a><h2>Delete Group</h2>
+<a name="idp13038256"></a><h2>Delete Group</h2>
 <p>
         Group can be deleted with flag <strong class="userinput"><code>--delete-group</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp14365440"></a><h2>Update Group</h2>
+<a name="idp13042768"></a><h2>Update Group</h2>
 <p>
         Group can be updated with flag <strong class="userinput"><code>--udpate-group</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp14370032"></a><h2>Get Group</h2>
+<a name="idp13047360"></a><h2>Get Group</h2>
 <p>
         Group data can be retrieved with flag <strong class="userinput"><code>--get-group</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp14374544"></a><h2>Get Group By Name</h2>
+<a name="idp14206848"></a><h2>Get Group By Name</h2>
 <p>
         Group data can be retrieved with flag <strong class="userinput"><code>--get-group-by-name</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp12684400"></a><h2>Add member To Group</h2>
+<a name="idp14211360"></a><h2>Add member To Group</h2>
 <p>
         New member can be added to a group with flag <strong class="userinput"><code>--add-member</code></strong>:
         </p>
      </p>
 </div>
 <div class="refsect1">
-<a name="idp12688960"></a><h2>Delete member From Group</h2>
+<a name="idp14215920"></a><h2>Delete member From Group</h2>
 <p>
         A member can be removed from the group with flag <strong class="userinput"><code>--delete-member</code></strong>:
         </p>
index ccaccb2..5806d60 100644 (file)
@@ -22,7 +22,7 @@
 <div class="refentry">
 <a name="um-intro"></a><div class="titlepage"></div>
 <div class="refsect1">
-<a name="idp8603856"></a><h2>What is gumd/libgum?</h2>
+<a name="idp10426944"></a><h2>What is gumd/libgum?</h2>
 <p>
         gumd and libgum together provides a framework for creating, deleting
         and modifying user and groups in the system. gumd is a daemon that
index b5696be..ac1d51c 100644 (file)
@@ -18,4 +18,6 @@ gum_example_LDADD = \
 if HAVE_LIBTLM_NFC
 gum_example_CPPFLAGS += $(LIBTLM_NFC_CFLAGS)
 gum_example_LDADD += $(LIBTLM_NFC_LIBS)
-endif
\ No newline at end of file
+endif
+
+CLEANFILES = *.gcno *.gcda
\ No newline at end of file
index d8a16ed..c5afcfa 100644 (file)
@@ -251,6 +251,7 @@ gum_example_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
        $(am__append_1)
 gum_example_LDADD = $(DEPS_LIBS) $(top_builddir)/src/lib/libgum.la \
        $(LIBGUM_LIBS) $(am__append_2)
+CLEANFILES = *.gcno *.gcda
 all: all-am
 
 .SUFFIXES:
@@ -495,6 +496,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
index 5b87b6c..86dcc48 100644 (file)
@@ -65,5 +65,5 @@ pkgconfig_DATA = libgum-common.pc
 
 sysconf_DATA = gum.conf
 
-CLEANFILES = 
+CLEANFILES = *.gcno *.gcda
 
index 369469d..af4f1f3 100644 (file)
@@ -389,7 +389,7 @@ EXTRA_DIST = \
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgum-common.pc
 sysconf_DATA = gum.conf
-CLEANFILES = 
+CLEANFILES = *.gcno *.gcda
 all: all-recursive
 
 .SUFFIXES:
index f159500..076f862 100644 (file)
@@ -211,7 +211,13 @@ _load_config (
 
             DBG ("found config : '%s/%s' - '%s'", groups[i], keys[j], value);
 
-            gum_config_set_string (self, key, value);
+            if (g_strcmp0 (GUM_CONFIG_DBUS_DAEMON_TIMEOUT, key) == 0 ||
+                g_strcmp0 (GUM_CONFIG_DBUS_USER_TIMEOUT, key) == 0 ||
+                g_strcmp0 (GUM_CONFIG_DBUS_GROUP_TIMEOUT, key) == 0) {
+                gum_config_set_int (self, key, atoi (value));
+            } else {
+                gum_config_set_string (self, key, value);
+            }
 
             g_free (key);
             g_free (value);
@@ -233,19 +239,19 @@ _load_environment (
         GumConfig *self)
 {
     const gchar *e_val = 0;
-    guint timeout = 0;
+    gint timeout = 0;
     
     e_val = g_getenv ("UM_DAEMON_TIMEOUT");
     if (e_val && (timeout = atoi(e_val)))
-        gum_config_set_string (self, GUM_CONFIG_DBUS_DAEMON_TIMEOUT, e_val);
+        gum_config_set_int (self, GUM_CONFIG_DBUS_DAEMON_TIMEOUT, timeout);
 
     e_val = g_getenv ("UM_USER_TIMEOUT");
     if (e_val && (timeout = atoi(e_val)))
-        gum_config_set_string (self, GUM_CONFIG_DBUS_USER_TIMEOUT, e_val);
+        gum_config_set_int (self, GUM_CONFIG_DBUS_USER_TIMEOUT, timeout);
 
     e_val = g_getenv ("UM_GROUP_TIMEOUT");
     if (e_val && (timeout = atoi(e_val)))
-        gum_config_set_string (self, GUM_CONFIG_DBUS_GROUP_TIMEOUT, e_val);
+        gum_config_set_int (self, GUM_CONFIG_DBUS_GROUP_TIMEOUT, timeout);
 
     e_val = g_getenv ("UM_PASSWD_FILE");
     if (e_val)
@@ -290,8 +296,9 @@ gum_config_get_int (
         const gchar *key,
         gint retval)
 {
-    const gchar *str_value = gum_config_get_string (self, key);
-    return (gint) (str_value ? atoi (str_value) : retval);
+    gint32 value = retval;
+    gum_dictionary_get_int32 (self->priv->config_table, key, &value);
+    return value;
 }
 
 /**
@@ -308,15 +315,9 @@ gum_config_set_int (
         const gchar *key,
         gint value)
 {
-    gchar *s_value = 0;
     g_return_if_fail (self && GUM_IS_CONFIG (self));
 
-    s_value = g_strdup_printf ("%d", value);
-    if (!s_value) return;
-
-    gum_config_set_string (self, (gpointer) key, s_value);
-
-    g_free (s_value);
+    gum_dictionary_set_int32 (self->priv->config_table, key, value);
 }
 
 /**
@@ -336,9 +337,8 @@ gum_config_get_uint (
         const gchar *key,
         guint retval)
 {
-    guint value;
-    const gchar *str_value = gum_config_get_string (self, key);
-    if (!str_value || sscanf (str_value,"%u",&value) <= 0) value = retval;
+    guint32 value = retval;
+    gum_dictionary_get_uint32 (self->priv->config_table, key, &value);
     return value;
 }
 
@@ -356,14 +356,9 @@ gum_config_set_uint (
         const gchar *key,
         guint value)
 {
-    gchar *s_value = 0;
     g_return_if_fail (self && GUM_IS_CONFIG (self));
 
-    s_value = g_strdup_printf ("%u", value);
-    if (!s_value) return;
-
-    gum_config_set_string (self, (gpointer) key, s_value);
-    g_free (s_value);
+    gum_dictionary_set_uint32 (self->priv->config_table, key, value);
 }
 
 /**
@@ -383,11 +378,7 @@ gum_config_get_string (
 {
     g_return_val_if_fail (self && GUM_IS_CONFIG (self), NULL);
 
-    GVariant* value = gum_dictionary_get (self->priv->config_table,
-                                               (gpointer) key);
-    if (!value) return NULL;
-
-    return g_variant_get_string (value, NULL);
+    return gum_dictionary_get_string (self->priv->config_table, key);
 }
 
 /**
@@ -406,10 +397,7 @@ gum_config_set_string (
 {
     g_return_if_fail (self && GUM_IS_CONFIG (self));
 
-    gum_dictionary_set (self->priv->config_table,
-                             (gpointer) key,
-                             g_variant_new_string (value));
-
+    gum_dictionary_set_string (self->priv->config_table, key, value);
 }
 
 static void
index 2505273..5a385c7 100644 (file)
@@ -37,3 +37,5 @@ install-exec-hook:
        chown root $(DESTDIR)$(bindir)/gumd || true
        chmod u+s $(DESTDIR)$(bindir)/gumd || true
 endif
+
+CLEANFILES = *.gcno *.gcda
\ No newline at end of file
index dcb41d9..a509bf5 100644 (file)
@@ -347,6 +347,7 @@ EXTRA_DIST = \
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gumd.pc
+CLEANFILES = *.gcno *.gcda
 all: all-recursive
 
 .SUFFIXES:
@@ -770,6 +771,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
index 37fc6fb..3133689 100644 (file)
@@ -44,5 +44,5 @@ EXTRA_DIST = \
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgum.pc
 
-CLEANFILES = 
+CLEANFILES = *.gcno *.gcda
 
index 612df7c..8a760fe 100644 (file)
@@ -358,7 +358,7 @@ EXTRA_DIST = \
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgum.pc
-CLEANFILES = 
+CLEANFILES = *.gcno *.gcda
 all: all-recursive
 
 .SUFFIXES:
index ece4a98..8296d7d 100644 (file)
@@ -18,3 +18,4 @@ EXTRA_DIST = data
 EXTRA_DIST += \
     valgrind.supp \
     valgrind_common.mk 
+  
\ No newline at end of file
index 1e9b99a..3db5eb1 100644 (file)
@@ -19,4 +19,6 @@ commontest_CFLAGS = \
 commontest_LDADD = \
     $(top_builddir)/src/common/libgum-common.la \
     $(GUMD_LIBS) \
-    $(CHECK_LIBS)
\ No newline at end of file
+    $(CHECK_LIBS)
+
+CLEANFILES = *.gcno *.gcda
\ No newline at end of file
index 7a3a2f7..6b1e2ee 100644 (file)
@@ -269,6 +269,7 @@ commontest_LDADD = \
     $(GUMD_LIBS) \
     $(CHECK_LIBS)
 
+CLEANFILES = *.gcno *.gcda
 all: all-am
 
 .SUFFIXES:
@@ -572,6 +573,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
index 7545830..4af5d09 100644 (file)
@@ -44,6 +44,7 @@
 #include "common/gum-lock.h"
 #include "common/gum-string-utils.h"
 #include "common/gum-defines.h"
+#include "common/gum-dictionary.h"
 
 gboolean
 _create_file (
@@ -783,6 +784,75 @@ START_TEST (test_crypt)
 }
 END_TEST
 
+START_TEST (test_error)
+{
+    DBG("");
+
+    GVariant *var = NULL;
+    GError *err = GUM_GET_ERROR_FOR_ID (GUM_ERROR_INVALID_INPUT, "testerror");
+    fail_if (err == NULL);
+
+    var = gum_error_to_variant (err);
+    fail_if (var == NULL);
+
+    g_error_free (err); err = NULL;
+    err = gum_error_new_from_variant (var);
+
+    fail_if (err == NULL);
+    fail_if (err->code != GUM_ERROR_INVALID_INPUT);
+    fail_if (g_strcmp0 (err->message, "testerror") != 0);
+
+    g_error_free (err);
+    g_variant_unref (var);
+}
+END_TEST
+
+START_TEST (test_dictionary)
+{
+    DBG("");
+    gboolean data1 = FALSE;
+    GVariant *var = NULL;
+    gint64 data2 = 123;
+    guint64 data3 = 789;
+
+    GumDictionary* dict = gum_dictionary_new ();
+    fail_if (dict == NULL);
+    fail_if (gum_dictionary_get_boolean (dict,
+            "key1", &data1) == TRUE);
+
+    fail_if (gum_dictionary_set_boolean (dict,
+            "key1", data1) == FALSE);
+    data1 = TRUE;
+    fail_if (gum_dictionary_get_boolean (dict,
+            "key1", &data1) == FALSE);
+    fail_if (data1 == TRUE);
+    fail_if (gum_dictionary_get_boolean (dict,
+            "key1", &data1) == FALSE);
+
+    fail_if (gum_dictionary_set_int64 (dict,
+            "key2", data2) == FALSE);
+    data2 = 456;
+    fail_if (gum_dictionary_set_uint64 (dict,
+            "key3", data3) == FALSE);
+
+    var = gum_dictionary_to_variant (dict);
+    fail_if (var == NULL);
+    g_hash_table_unref (dict);
+
+    dict = gum_dictionary_new_from_variant (var);
+    fail_if (dict == NULL);
+
+    fail_if (gum_dictionary_get_int64 (dict,
+            "key2", &data2) == FALSE);
+    fail_if (data2 != 123);
+    fail_if (gum_dictionary_get_uint64 (dict,
+            "key3", &data3) == FALSE);
+
+    g_variant_unref (var);
+    g_hash_table_unref (dict);
+}
+END_TEST
+
 Suite* common_suite (void)
 {
     Suite *s = suite_create ("Common library");
@@ -797,6 +867,8 @@ Suite* common_suite (void)
     tcase_add_test (tc_core, test_file);
     tcase_add_test (tc_core, test_validate);
     tcase_add_test (tc_core, test_crypt);
+    tcase_add_test (tc_core, test_error);
+    tcase_add_test (tc_core, test_dictionary);
     suite_add_tcase (s, tc_core);
     return s;
 }
index 23b84be..61b62f7 100644 (file)
@@ -27,3 +27,4 @@ daemontest_LDADD = \
     $(GUMD_LIBS) \
     $(CHECK_LIBS)
 
+CLEANFILES = *.gcno *.gcda
\ No newline at end of file
index 2ce9a34..98405f2 100644 (file)
@@ -273,6 +273,7 @@ daemontest_LDADD = \
     $(GUMD_LIBS) \
     $(CHECK_LIBS)
 
+CLEANFILES = *.gcno *.gcda
 all: all-am
 
 .SUFFIXES:
@@ -576,6 +577,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
index 566fde1..1b9847e 100644 (file)
@@ -26,3 +26,5 @@ clienttest_LDADD = \
     $(top_builddir)/src/lib/libgum.la \
     $(GUMD_LIBS) \
     $(CHECK_LIBS)
+
+CLEANFILES = *.gcno *.gcda
\ No newline at end of file
index de65174..eee25a7 100644 (file)
@@ -271,6 +271,7 @@ clienttest_LDADD = \
     $(GUMD_LIBS) \
     $(CHECK_LIBS)
 
+CLEANFILES = *.gcno *.gcda
 all: all-am
 
 .SUFFIXES:
@@ -574,6 +575,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)