Allow the test suite to run in %check

This commit is contained in:
Richard Hughes 2016-04-01 08:53:58 +01:00
parent f3f4e8dae5
commit f7c81e312a
3 changed files with 10 additions and 2 deletions

View File

@ -24,6 +24,7 @@ BuildRequires: libarchive-devel
BuildRequires: gobject-introspection-devel
BuildRequires: libappstream-glib-devel >= 0.5.10
BuildRequires: gcab
BuildRequires: valgrind
%ifarch x86_64 %{ix86} aarch64
BuildRequires: fwupdate-devel >= 0.5
@ -79,6 +80,9 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
%find_lang %{name}
%check
make check VERBOSE=1
%post
/sbin/ldconfig
%systemd_post fwupd.service

View File

@ -25,7 +25,6 @@ AM_CPPFLAGS = \
-DLIBDIR=\"$(libdir)\" \
-DDATADIR=\"$(datadir)\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
-DVERSION="\"$(VERSION)\"" \
-DDAEMON_USER="\"$(daemon_user)\"" \
-DTESTDATADIR=\""$(top_srcdir)/data/tests"\" \
@ -63,6 +62,7 @@ fwupdmgr_LDFLAGS = \
fwupdmgr_CFLAGS = \
-DFU_OFFLINE_DESTDIR=\"\" \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
$(WARNINGFLAGS_C)
fu-resources.c: fwupd.gresource.xml $(dist_introspection_DATA)
@ -148,6 +148,7 @@ fwupd_LDFLAGS = \
fwupd_CFLAGS = \
-DFU_OFFLINE_DESTDIR=\"\" \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
$(WARNINGFLAGS_C)
TESTS_ENVIRONMENT = \
@ -190,6 +191,7 @@ fu_self_test_LDADD = \
fu_self_test_CFLAGS = \
-DFU_OFFLINE_DESTDIR=\"/tmp/fwupd-self-test\" \
-DLOCALSTATEDIR=\"/tmp/fwupd-self-test/var\" \
$(WARNINGFLAGS_C)
install-data-hook:

View File

@ -183,6 +183,7 @@ fu_provider_func (void)
FwupdResult *res;
gboolean ret;
guint cnt = 0;
g_autofree gchar *mapped_file_fn = NULL;
g_autofree gchar *pending_cap = NULL;
g_autofree gchar *pending_db = NULL;
g_autoptr(FuDevice) device = NULL;
@ -211,7 +212,8 @@ fu_provider_func (void)
"00000000-0000-0000-0000-000000000000");
/* schedule an offline update */
mapped_file = g_mapped_file_new ("/etc/resolv.conf", FALSE, &error);
mapped_file_fn = fu_test_get_filename ("colorhug/firmware.bin");
mapped_file = g_mapped_file_new (mapped_file_fn, FALSE, &error);
g_assert_no_error (error);
g_assert (mapped_file != NULL);
blob_cab = g_mapped_file_get_bytes (mapped_file);