[gnome-software] Fix destdir!=srcdir when running the flatpak tests



commit 967fda1eb4c5a62a467669b83df61338d57c031d
Author: Richard Hughes <richard hughsie com>
Date:   Mon Apr 10 13:05:16 2017 +0100

    Fix destdir!=srcdir when running the flatpak tests

 configure.ac                              |    1 +
 plugins/flatpak/Makefile.am               |    9 ++-------
 plugins/flatpak/meson.build               |    2 +-
 plugins/flatpak/tests/.gitignore          |    4 ----
 plugins/flatpak/tests/Makefile.am         |   26 ++++++++++++++++++++++++++
 plugins/flatpak/tests/flatpakrepos.tar.gz |  Bin 0 -> 37465 bytes
 plugins/flatpak/tests/meson.build         |   21 ++++++++++++++++++++-
 7 files changed, 50 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index eefdcba..6e92700 100644
--- a/configure.ac
+++ b/configure.ac
@@ -503,6 +503,7 @@ plugins/external-appstream/Makefile
 plugins/fedora-distro-upgrades/Makefile
 plugins/fedora-tagger-usage/Makefile
 plugins/flatpak/Makefile
+plugins/flatpak/tests/Makefile
 plugins/fwupd/Makefile
 plugins/limba/Makefile
 plugins/modalias/Makefile
diff --git a/plugins/flatpak/Makefile.am b/plugins/flatpak/Makefile.am
index e8d5cc2..29adeb9 100644
--- a/plugins/flatpak/Makefile.am
+++ b/plugins/flatpak/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 AM_CPPFLAGS =                                          \
        -DG_LOG_DOMAIN=\"GsPluginFlatpak\"              \
        -DSYSCONFDIR=\""$(sysconfdir)"\"                \
@@ -35,13 +37,6 @@ gs_self_test_SOURCES = gs-self-test.c
 gs_self_test_LDADD = $(top_builddir)/lib/libgnomesoftware.a $(GS_PRIVATE_LIBS)
 gs_self_test_CFLAGS = $(GS_PRIVATE_CFLAGS)
 TESTS = gs-self-test
-
-tests/app-with-runtime/repo: tests/app-with-runtime
-       $(AM_V_GEN) cd "$(srcdir)/tests" && ./build.py && cd -
-
-BUILT_SOURCES =                                                \
-       tests/app-with-runtime/repo
-
 endif
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/flatpak/meson.build b/plugins/flatpak/meson.build
index 5a45c80..e26f316 100644
--- a/plugins/flatpak/meson.build
+++ b/plugins/flatpak/meson.build
@@ -33,7 +33,7 @@ i18n.merge_file(
 if get_option('enable-tests')
   cargs += ['-DLOCALPLUGINDIR="' + meson.current_build_dir() + '"']
   cargs += ['-DLOCALPLUGINDIR_CORE="' + meson.current_build_dir() + '/../core"']
-  cargs += ['-DTESTDATADIR="' + join_paths(meson.current_source_dir(), 'tests') + '"']
+  cargs += ['-DTESTDATADIR="' + join_paths(meson.current_build_dir(), 'tests') + '"']
   e = executable('gs-self-test-flatpak',
     sources : [
       'gs-self-test.c'
diff --git a/plugins/flatpak/tests/Makefile.am b/plugins/flatpak/tests/Makefile.am
new file mode 100644
index 0000000..e7fdbc3
--- /dev/null
+++ b/plugins/flatpak/tests/Makefile.am
@@ -0,0 +1,26 @@
+if ENABLE_TESTS
+
+app-with-runtime/repo/config: $(srcdir)/flatpakrepos.tar.gz
+       $(AM_V_GEN) tar -xf $(srcdir)/flatpakrepos.tar.gz
+
+flatpakrepos.tar.gz:
+       $(AM_V_GEN) tar -czf $(srcdir)flatpakrepos.tar.gz       \
+               app-missing-runtime/repo/               \
+               app-update/repo/                        \
+               app-with-runtime/repo/                  \
+               only-runtime/repo/
+
+BUILT_SOURCES =                                                \
+       app-with-runtime/repo/config
+
+DISTCLEANFILES =                                       \
+       app-missing-runtime/repo                        \
+       app-update/repo                                 \
+       app-with-runtime/repo                           \
+       only-runtime/repo
+
+endif
+
+EXTRA_DIST = flatpakrepos.tar.gz
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/flatpak/tests/flatpakrepos.tar.gz b/plugins/flatpak/tests/flatpakrepos.tar.gz
new file mode 100644
index 0000000..0a63de4
Binary files /dev/null and b/plugins/flatpak/tests/flatpakrepos.tar.gz differ
diff --git a/plugins/flatpak/tests/meson.build b/plugins/flatpak/tests/meson.build
index cef0268..1632970 100644
--- a/plugins/flatpak/tests/meson.build
+++ b/plugins/flatpak/tests/meson.build
@@ -1,6 +1,25 @@
+tar = find_program('tar')
 custom_target(
   'flatpak-self-test-data',
-  command : join_paths(meson.current_source_dir(), 'build.py'),
+  input : 'flatpakrepos.tar.gz',
   output : 'done',
+  command : [
+    tar,
+    '--directory=' + meson.current_build_dir(),
+    '-xf', '@INPUT@',
+  ],
   build_by_default : true,
 )
+
+custom_target(
+  'flatpak-self-test-bundle',
+  output : 'flatpakrepos.tar.gz',
+  command : [
+    tar,
+    '-czf', '@OUTPUT@',
+    'app-missing-runtime/repo/',
+    'app-update/repo/',
+    'app-with-runtime/repo/',
+    'only-runtime/repo/',
+  ],
+)


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