summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Roth <robert.roth.off@gmail.com>2013-12-07 00:05:36 +0200
committerRobert Roth <robert.roth.off@gmail.com>2013-12-07 00:05:36 +0200
commit4dc31b6c94399f90cd9093a16b527e1d5aefc668 (patch)
treeea40451bed2cfd9e794c6152e5a36d581333108a
parent69989d716fa4c1b7fa5d968ab4b72b10a56acc4a (diff)
downloadlibgtop-testing.tar.gz
Added not-working basic testtesting
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac1
-rw-r--r--m4/glibtests.m414
-rw-r--r--tests/Makefile.am22
-rw-r--r--tests/cpuinfo-tests.c11
5 files changed, 42 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index eca41ffd..5238b446 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 dc4e6543..26bfe0e9 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 1bffb703..e03fa469 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 00000000..d864ce8e
--- /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 00000000..0466d473
--- /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);
+
+}