summaryrefslogtreecommitdiff
path: root/mkosi.build
diff options
context:
space:
mode:
authorMichal Koutný <mkoutny@suse.com>2020-04-22 01:58:44 +0200
committerMichal Koutný <mkoutny@suse.com>2020-04-22 10:35:12 +0200
commitff5499824f96a7e7b93ca0b294eec62ad21e6592 (patch)
tree477ba72a6b60461e600b3cf729853ce82188f5b2 /mkosi.build
parent9acb2964d7798813274dbd5992fb6f370add23b9 (diff)
downloadsystemd-ff5499824f96a7e7b93ca0b294eec62ad21e6592.tar.gz
mkosi: Unify environment for unit tests
Some testcases in test-execute rely on existence of user groups with certain gids. However, their existence is not universally granted [1]. Although the test could be skipped in their absence and give up testing some code paths, different approach was chosen -- create dummy groups in the testing image. [1] See how systemd-sysusers allocates gids (e.g. src/test/test-uid-range.c).
Diffstat (limited to 'mkosi.build')
-rwxr-xr-xmkosi.build8
1 files changed, 7 insertions, 1 deletions
diff --git a/mkosi.build b/mkosi.build
index fc09baeadd..4a13f1075e 100755
--- a/mkosi.build
+++ b/mkosi.build
@@ -88,7 +88,13 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then
fi
ninja -C "$BUILDDIR" all
-[ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test
+if [ "$WITH_TESTS" = 1 ] ; then
+ for id in 1 2 3; do
+ groupadd -g $id testgroup$id || :
+ done
+
+ ninja -C "$BUILDDIR" test
+fi
ninja -C "$BUILDDIR" install
mkdir -p "$DESTDIR"/etc