[libgtop/testing] Added not-working basic test



commit 4dc31b6c94399f90cd9093a16b527e1d5aefc668
Author: Robert Roth <robert roth off gmail com>
Date:   Sat Dec 7 00:05:36 2013 +0200

    Added not-working basic test

 Makefile.am           |    2 +-
 configure.ac          |    1 +
 m4/glibtests.m4       |   14 +++++++-------
 tests/Makefile.am     |   22 ++++++++++++++++++++++
 tests/cpuinfo-tests.c |   11 +++++++++++
 5 files changed, 42 insertions(+), 8 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index eca41ff..5238b44 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@ else
 EXAMPLES_DIR = 
 endif
 
-SUBDIRS = po misc include sysdeps lib src $(EXAMPLES_DIR) doc
+SUBDIRS = po misc include sysdeps lib src $(EXAMPLES_DIR) doc tests
 
 libgtopinclude_HEADERS = glibtop.h libgtopconfig.h
 libgtopincludedir = $(includedir)/libgtop-2.0
diff --git a/configure.ac b/configure.ac
index dc4e654..26bfe0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
 
 GNOME_LIBGTOP_SYSDEPS
 GNOME_LIBGTOP_TYPES
+GLIB_TESTS
 
 GLIB_REQUIRED=2.6.0
 
diff --git a/m4/glibtests.m4 b/m4/glibtests.m4
index 1bffb70..e03fa46 100644
--- a/m4/glibtests.m4
+++ b/m4/glibtests.m4
@@ -184,21 +184,21 @@ AC_DEFUN([GLIB_TESTS],
                 AS_HELP_STRING([--enable-installed-tests],
                                [Enable installation of some test cases]),
                 [case ${enableval} in
-                  yes) ENABLE_INSTALLED_TESTS=&quot;1&quot;  ;;
-                  no)  ENABLE_INSTALLED_TESTS=&quot;&quot; ;;
+                  yes) ENABLE_INSTALLED_TESTS='1'  ;;
+                  no)  ENABLE_INSTALLED_TESTS='' ;;
                   *) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;;
                  esac])
-  AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test &quot;$ENABLE_INSTALLED_TESTS&quot; = &quot;1&quot;)
+  AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test '$ENABLE_INSTALLED_TESTS' = '1')
   AC_ARG_ENABLE(always-build-tests,
                 AS_HELP_STRING([--enable-always-build-tests],
                                [Enable always building tests during 'make all']),
                 [case ${enableval} in
-                  yes) ENABLE_ALWAYS_BUILD_TESTS=&quot;1&quot;  ;;
-                  no)  ENABLE_ALWAYS_BUILD_TESTS=&quot;&quot; ;;
+                  yes) ENABLE_ALWAYS_BUILD_TESTS='1'  ;;
+                  no)  ENABLE_ALWAYS_BUILD_TESTS='' ;;
                   *) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;;
                  esac])
-  AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test &quot;$ENABLE_ALWAYS_BUILD_TESTS&quot; = &quot;1&quot;)
-  if test &quot;$ENABLE_INSTALLED_TESTS&quot; = &quot;1&quot;; then
+  AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test '$ENABLE_ALWAYS_BUILD_TESTS' = '1')
+  if test '$ENABLE_INSTALLED_TESTS' = '1'; then
     AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME)
     AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME)
   fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..d864ce8
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,22 @@
+include $top_srcdir/glib-tap.mk
+
+noinst_PROGRAMS = test
+
+TESTS = test
+
+test_LDADD             = $(top_builddir)/lib/libgtop-2.0.la \
+                                 $(top_builddir)/sysdeps/common/libgtop_common-2.0.la \
+                                 $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps-2.0.la \
+                                 @sysdeps_suid_lib@ \
+                                 $(suid_sysdeps) $(suid_common) \
+                                 $(LIBGTOP_LIBS) \
+                                 @libs_xauth@
+
+test_CPPFLAGS = \
+       $(GLIB_CFLAGS) \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include/glibtop \
+       $(NULL)
+
+test_SOURCES = \
+    cpuinfo-tests.c
diff --git a/tests/cpuinfo-tests.c b/tests/cpuinfo-tests.c
new file mode 100644
index 0000000..0466d47
--- /dev/null
+++ b/tests/cpuinfo-tests.c
@@ -0,0 +1,11 @@
+#include <glibtop.h>
+#include <glibtop/sysinfo.h>
+
+static void
+test_simple_cpuinfo (void)
+{
+  glibtop_sysinfo *infos = glibtop_get_sysinfo ();
+
+  g_assert_cmpint (infos->ncpu, ==, 4);
+
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]