Added not-working basic test
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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="1" ;;
|
||||
no) ENABLE_INSTALLED_TESTS="" ;;
|
||||
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 "$ENABLE_INSTALLED_TESTS" = "1")
|
||||
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="1" ;;
|
||||
no) ENABLE_ALWAYS_BUILD_TESTS="" ;;
|
||||
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 "$ENABLE_ALWAYS_BUILD_TESTS" = "1")
|
||||
if test "$ENABLE_INSTALLED_TESTS" = "1"; 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
|
||||
|
||||
22
tests/Makefile.am
Normal file
22
tests/Makefile.am
Normal file
@@ -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
|
||||
11
tests/cpuinfo-tests.c
Normal file
11
tests/cpuinfo-tests.c
Normal file
@@ -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);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user