From a699603b36f5bf8dbafb8a630d8840ebec601ed0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 14 Sep 2026 23:42:42 +0100 Subject: [PATCH 1/2] libtest.sh: Add assert_file_has_content_extended This is the same as assert_file_has_content, but uses POSIX extended regexps (`grep -E`) instead of basic regexps (plain `grep`). Signed-off-by: Simon McVittie --- tests/libtest.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/libtest.sh b/tests/libtest.sh index 9227b4bf..2b1d34d3 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -159,6 +159,14 @@ assert_file_has_content () { fi } +assert_file_has_content_extended () { + if ! grep -q -E -e "$2" "$1"; then + sed -e 's/^/# /' < "$1" >&2 + echo 1>&2 "File '$1' doesn't match extended regexp '$2'" + exit 1 + fi +} + assert_symlink_has_content () { if ! readlink "$1" | grep -q -e "$2"; then readlink "$1" |sed -e 's/^/# /' >&2 From ccb563c351d09f263954cd0715354205e6d72dfd Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 15 Sep 2026 11:03:48 +0100 Subject: [PATCH 2/2] test-appstream.sh: If Appstream XML doesn't match, show its content This made it feasible to diagnose #776. Signed-off-by: Simon McVittie --- tests/test-appstream.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test-appstream.sh b/tests/test-appstream.sh index 1244af28..fed1f937 100755 --- a/tests/test-appstream.sh +++ b/tests/test-appstream.sh @@ -46,7 +46,9 @@ run_build \ org.flatpak.appstream_media.json # we test for the icon tag instead of screenshot # the former works offline the latter does not -gzip -cdq builddir_sc/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz|grep -Eq '>org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.png' +gzip -cdq builddir_sc/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz \ + > appstream.xml +assert_file_has_content_extended appstream.xml '>org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.png' echo "ok compose partial url policy" @@ -59,7 +61,9 @@ if appstream_has_version 0 16 3; then --compose-url-policy=full \ org.flatpak.appstream_media.json - gzip -cdq builddir_sc/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz|grep -Eq '>https://example.org/media/org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.png' + gzip -cdq builddir_sc/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz \ + > appstream.xml + assert_file_has_content_extended appstream.xml '>https://example.org/media/org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.png' echo "ok compose full url policy" else @@ -76,7 +80,9 @@ if appstream_has_version 1 2 0; then --compose-image-format=jxl \ org.flatpak.appstream_media.json - gzip -cdq builddir_jxl/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz|grep -Eq '>https://example.org/media/org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.jxl' + gzip -cdq builddir_jxl/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz \ + > appstream.xml + assert_file_has_content_extended appstream.xml '>https://example.org/media/org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.jxl' echo "ok compose jxl image format" else