From cebc32396690cf6c0ed91ffe70d2e244ef3211f9 Mon Sep 17 00:00:00 2001 From: Mia McMahill Date: Sun, 14 Jun 2026 07:39:09 -0500 Subject: [PATCH] tests: Add test for building and installing with exported releases.xml Adds a test that verifies releases.xml metainfo files are not duplicated at any export stage, and that they are not left unexported either. --- tests/meson.build | 1 + tests/test-metainfo-export.sh | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 tests/test-metainfo-export.sh diff --git a/tests/meson.build b/tests/meson.build index d0b4f29e0..b5367f490 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -411,6 +411,7 @@ tests = { 'preinstall': {}, 'run-custom': {'wrap': ['user', 'system']}, 'upgrade-from-header': {'wrap': ['user', 'system', 'system-norevokefs']}, + 'metainfo-export': {}, } wrapped_tests = [] diff --git a/tests/test-metainfo-export.sh b/tests/test-metainfo-export.sh new file mode 100755 index 000000000..8a038f322 --- /dev/null +++ b/tests/test-metainfo-export.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# Copyright (C) 2026 Mia McMahill +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +set -euo pipefail + +source "$(dirname "$0")/libtest.sh" + +echo "1..2" + +setup_repo +install_repo + +APP_DIR="$(mktemp -d)" +APP_ID="org.test.MetainfoReleases" + +$FLATPAK build-init "$APP_DIR" "$APP_ID" org.test.Platform org.test.Platform >&2 + +mkdir -p "${APP_DIR}/files/share/metainfo/" +mkdir -p "${APP_DIR}/files/share/metainfo/releases" + +cat < "${APP_DIR}/files/share/metainfo/${APP_ID}.metainfo.xml" + + + ${APP_ID} + + Metainfo Releases Export Test + Test metainfo releases.xml export +

This is a test app.

+ +
+EOF + +cat < "${APP_DIR}/files/share/metainfo/releases/${APP_ID}.releases.xml" + + + +EOF + +$FLATPAK build-finish "$APP_DIR" >&2 + +assert_has_file "${APP_DIR}/export/share/metainfo/${APP_ID}.metainfo.xml" +assert_file_has_content "${APP_DIR}/export/share/metainfo/${APP_ID}.metainfo.xml" \ + 'Metainfo Releases Export Test' +assert_has_file "${APP_DIR}/export/share/metainfo/releases/${APP_ID}.releases.xml" +assert_file_has_content "${APP_DIR}/export/share/metainfo/releases/${APP_ID}.releases.xml" \ + '' + +ok "build-finish exported metainfo and releases" + +REPO="$(mktemp -d)" + +$FLATPAK build-export "$REPO" "$APP_DIR" >&2 + +$FLATPAK ${U} install -y "$REPO" "$APP_ID" >&2 + +assert_has_file "${FL_DIR}/exports/share/metainfo/${APP_ID}.metainfo.xml" +assert_file_has_content "${APP_DIR}/export/share/metainfo/${APP_ID}.metainfo.xml" \ + 'Metainfo Releases Export Test' +assert_has_file "${FL_DIR}/exports/share/metainfo/releases/${APP_ID}.releases.xml" +assert_file_has_content "${APP_DIR}/export/share/metainfo/releases/${APP_ID}.releases.xml" \ + '' + +ok "install exported metainfo and releases"