Skip to content

Commit 678e4a0

Browse files
committed
tests: Add test to catch duplicate build group in platform metadata
1 parent aabdf0c commit 678e4a0

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

tests/make-test-runtime.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ PATH="$PATH:/usr/sbin:/sbin"
2828
# Add bash and dependencies
2929
mkdir -p ${DIR}/usr/bin
3030
mkdir -p ${DIR}/usr/lib
31+
mkdir -p ${DIR}/usr/share/runtime/locale/en
32+
echo "test" > ${DIR}/usr/share/runtime/locale/en/test
3133
ln -s ../lib ${DIR}/usr/lib64
3234
ln -s ../lib ${DIR}/usr/lib32
3335
if test -f /sbin/ldconfig.real; then

tests/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ if get_option('installed_tests')
125125
'org.test.Hello-256.png',
126126
'org.flatpak.install_test.json',
127127
'test-locale-cleanup.json',
128+
'test-runtime-platform.json',
128129

129130
install_dir: installed_testdir,
130131
install_mode: 'rw-r--r--',

tests/test-builder.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set -euo pipefail
2323

2424
skip_without_fuse
2525

26-
echo "1..12"
26+
echo "1..13"
2727

2828
setup_repo
2929
install_repo
@@ -41,6 +41,7 @@ cp $(dirname $0)/test-rename-appdata.json .
4141
cp $(dirname $0)/test.json .
4242
cp $(dirname $0)/test.yaml .
4343
cp $(dirname $0)/test-runtime.json .
44+
cp $(dirname $0)/test-runtime-platform.json .
4445
cp $(dirname $0)/0001-Add-test-logo.patch .
4546
cp $(dirname $0)/Hello.desktop .
4647
cp $(dirname $0)/Hello.xml .
@@ -139,6 +140,23 @@ ${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean runtimedir \
139140

140141
echo "ok runtime build cleanup with build-args"
141142

143+
${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean runtimedir \
144+
test-runtime-platform.json >&2
145+
146+
BUILD_GROUP_COUNT=$(grep -c '^\[Build\]' runtimedir/metadata.platform)
147+
if [ "$BUILD_GROUP_COUNT" -gt 1 ]; then
148+
echo "not ok no duplicate [Build] groups in platform metadata"
149+
exit 1
150+
fi
151+
152+
BUILT_EXTENSIONS_COUNT=$(grep -c '^built-extensions=' runtimedir/metadata.platform)
153+
if [ "$BUILT_EXTENSIONS_COUNT" -gt 1 ]; then
154+
echo "not ok duplicate built-extensions keys in platform metadata"
155+
exit 1
156+
fi
157+
158+
echo "ok no duplicate [Build] groups in platform metadata"
159+
142160
# test screenshot ref commit
143161
${FLATPAK_BUILDER} --repo=$REPO/repo_sc --force-clean builddir_sc \
144162
--mirror-screenshots-url=https://example.org/media \

tests/test-runtime-platform.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"build-runtime": true,
3+
"id": "org.test.Hello.Sdk",
4+
"id-platform": "org.test.Hello.Platform",
5+
"runtime": "org.test.Platform",
6+
"sdk": "org.test.Sdk",
7+
"separate-locales": true,
8+
"modules": []
9+
}

0 commit comments

Comments
 (0)