From c053c49eadf65faeba0f338c513b0ca8bd96dd57 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 24 Apr 2017 09:46:15 +0200 Subject: [PATCH] Extend flatpak-builder test We now test including modules, including doing so recursively, and find patches and source files from those. --- tests/Makefile.am.inc | 6 ++++++ tests/data1 | 1 + tests/data1.patch | 5 +++++ tests/data2 | 1 + tests/data2.patch | 5 +++++ tests/module1.json | 25 +++++++++++++++++++++++++ tests/module2.json | 19 +++++++++++++++++++ tests/test-builder.sh | 10 ++++++++++ tests/test.json | 1 + 9 files changed, 73 insertions(+) create mode 100644 tests/data1 create mode 100644 tests/data1.patch create mode 100644 tests/data2 create mode 100644 tests/data2.patch create mode 100644 tests/module1.json create mode 100644 tests/module2.json diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc index ba2da108..2978769a 100644 --- a/tests/Makefile.am.inc +++ b/tests/Makefile.am.inc @@ -88,6 +88,12 @@ dist_installed_test_data = \ tests/org.test.Hello.png \ tests/package_version.txt \ tests/test.json \ + tests/module1.json \ + tests/data1 \ + tests/data1.patch \ + tests/module2.json \ + tests/data2 \ + tests/data2.patch \ tests/session.conf.in \ tests/0001-Add-test-logo.patch \ tests/org.test.Python.json \ diff --git a/tests/data1 b/tests/data1 new file mode 100644 index 00000000..18cb9ad0 --- /dev/null +++ b/tests/data1 @@ -0,0 +1 @@ +Some data1 diff --git a/tests/data1.patch b/tests/data1.patch new file mode 100644 index 00000000..09ede7e4 --- /dev/null +++ b/tests/data1.patch @@ -0,0 +1,5 @@ +--- data1 2017-04-24 09:24:02.861719643 +0200 ++++ data1.mod 2017-04-24 09:35:44.589157410 +0200 +@@ -1 +1 @@ +-Some data1 ++Some modified data1 diff --git a/tests/data2 b/tests/data2 new file mode 100644 index 00000000..d1eea3cb --- /dev/null +++ b/tests/data2 @@ -0,0 +1 @@ +some data2 diff --git a/tests/data2.patch b/tests/data2.patch new file mode 100644 index 00000000..6f3c4351 --- /dev/null +++ b/tests/data2.patch @@ -0,0 +1,5 @@ +--- tests/data2 2017-04-24 09:31:18.793726921 +0200 ++++ tests/data2.mod 2017-04-24 09:36:26.485552769 +0200 +@@ -1 +1 @@ +-some data2 ++some modified data2 diff --git a/tests/module1.json b/tests/module1.json new file mode 100644 index 00000000..01fce7e3 --- /dev/null +++ b/tests/module1.json @@ -0,0 +1,25 @@ +{ + "name": "module1", + "modules": [ + { + "name": "module1-first", + "buildsystem": "simple", + "build-commands": [ + "echo module1 > /app/ran_module1", + "echo module1 > /app/modify_me" + ], + "sources": [ + { + "type": "file", + "path": "data1" + }, + { + "type": "patch", + "strip-components": 0, + "path": "data1.patch" + } + ] + }, + "include2/module2.json" + ] +} diff --git a/tests/module2.json b/tests/module2.json new file mode 100644 index 00000000..ef9896c8 --- /dev/null +++ b/tests/module2.json @@ -0,0 +1,19 @@ +{ + "name": "module2", + "buildsystem": "simple", + "ensure-writable": [ "/modify_me"], + "build-commands": [ + "echo module2 > /app/ran_module2", + "echo module2 > /app/modify_me" + ], + "sources": [ + { + "type": "file", + "path": "data2" + }, + { + "type": "patch", + "path": "data2.patch" + } + ] +} diff --git a/tests/test-builder.sh b/tests/test-builder.sh index 68ceeb14..f7cd9116 100755 --- a/tests/test-builder.sh +++ b/tests/test-builder.sh @@ -39,11 +39,21 @@ cp -a $(dirname $0)/test-configure . echo "version1" > app-data cp $(dirname $0)/test.json . cp $(dirname $0)/0001-Add-test-logo.patch . +mkdir include1 +cp $(dirname $0)/module1.json include1/ +cp $(dirname $0)/data1 include1/ +cp $(dirname $0)/data1.patch include1/ +mkdir include1/include2 +cp $(dirname $0)/module2.json include1/include2/ +cp $(dirname $0)/data2 include1/include2/ +cp $(dirname $0)/data2.patch include1/include2/ ${FLATPAK_BUILDER} --repo=$REPO $FL_GPGARGS --force-clean appdir test.json assert_file_has_content appdir/files/share/app-data version1 assert_file_has_content appdir/metadata shared=network; assert_file_has_content appdir/metadata tags=test; +assert_file_has_content appdir/files/ran_module1 module1 +assert_file_has_content appdir/files/ran_module2 module2 assert_not_has_file appdir/files/cleanup/a_filee assert_not_has_file appdir/files/bin/file.cleanup diff --git a/tests/test.json b/tests/test.json index a90b2de5..c837e725 100644 --- a/tests/test.json +++ b/tests/test.json @@ -18,6 +18,7 @@ "cleanup": ["/cleanup", "*.cleanup"], "cleanup-commands": [ "touch /app/cleaned_up" ], "modules": [ + "include1/module1.json", { "name": "root", "modules": [