Skip to content

Commit 82335ce

Browse files
daandemeyerpull[bot]
authored andcommitted
packit: Move fmf metadata into upstream
This moves https://src.fedoraproject.org/tests/systemd into upstream so it's one less moving piece that we need to remember. While we're at it, do various cleanups as well: - Remove non-packit logic - Set NO_BUILD in mkosi.local.conf as it's not picked up from the process environment - Don't set unused environment variables - Remove workdir logic as we run in an ephemeral VM already - Drop --verbose from meson test to reduce noise from passed tests - Use mkosi sandbox and drop duplicated deps from metadata file - Stop running the unit tests as they already run as part of the rpm build and as part of the integration tests. - Various style fixes
1 parent d608932 commit 82335ce

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed

.packit.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ jobs:
5757

5858
- job: tests
5959
trigger: pull_request
60-
fmf_url: https://src.fedoraproject.org/tests/systemd
61-
fmf_ref: main
60+
fmf_path: test/fmf
6261
tmt_plan: ci
6362
targets:
6463
- fedora-rawhide-x86_64

test/fmf/.fmf/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
summary: Run the upstream integration test suite
4+
test: ./test.sh
5+
duration: 2h
6+
require:
7+
- coreutils
8+
- distribution-gpg-keys
9+
- dnf
10+
- git-core

test/fmf/integration-tests/test.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: LGPL-2.1-or-later
3+
4+
set -eux
5+
set -o pipefail
6+
7+
# Switch SELinux to permissive, since the tests don't set proper contexts
8+
setenforce 0
9+
10+
# Prepare systemd source tree
11+
git clone "$PACKIT_TARGET_URL" systemd
12+
pushd systemd
13+
# If we're running in a pull request job, merge the remote branch into the current main
14+
if [[ -n "${PACKIT_SOURCE_URL:-}" ]]; then
15+
git remote add pr "${PACKIT_SOURCE_URL:?}"
16+
git fetch pr "${PACKIT_SOURCE_BRANCH:?}"
17+
git merge "pr/$PACKIT_SOURCE_BRANCH"
18+
fi
19+
git log --oneline -5
20+
popd
21+
22+
# Now prepare mkosi, possibly at the same version required by the systemd repo
23+
git clone https://github.com/systemd/mkosi
24+
# If we have it, pin the mkosi version to the same one used by Github Actions, to ensure consistency
25+
if [ -f .github/workflows/mkosi.yml ]; then
26+
mkosi_hash="$(grep systemd/mkosi@ .github/workflows/mkosi.yml | sed "s|.*systemd/mkosi@||g")"
27+
git -C mkosi checkout "$mkosi_hash"
28+
fi
29+
30+
export PATH="$PWD/mkosi/bin:$PATH"
31+
32+
pushd systemd
33+
34+
# shellcheck source=/dev/null
35+
. /etc/os-release || . /usr/lib/os-release
36+
37+
tee mkosi.local.conf <<EOF
38+
[Distribution]
39+
Release=${VERSION_ID:-rawhide}
40+
41+
[Build]
42+
ToolsTreeDistribution=$ID
43+
ToolsTreeRelease=${VERSION_ID:-rawhide}
44+
ToolsTreeSandboxTrees=
45+
/etc/yum.repos.d/:/etc/yum.repos.d/
46+
/var/share/test-artifacts/:/var/share/test-artifacts/
47+
SandboxTrees=
48+
/etc/yum.repos.d/:/etc/yum.repos.d/
49+
/var/share/test-artifacts/:/var/share/test-artifacts/
50+
Environment=NO_BUILD=1
51+
EOF
52+
53+
cat /etc/dnf/dnf.conf
54+
cat /etc/yum.repos.d/*
55+
56+
# Ensure packages built for this test have highest priority
57+
echo -e "\npriority=1" >> /etc/yum.repos.d/copr_build*
58+
59+
# Disable mkosi's own repository logic
60+
touch /etc/yum.repos.d/mkosi.repo
61+
62+
# TODO: drop once BTRFS regression is fixed in kernel 6.13
63+
sed -i "s/Format=btrfs/Format=ext4/" mkosi.repart/10-root.conf
64+
65+
# If we don't have KVM, skip running in qemu, as it's too slow. But try to load the module first.
66+
modprobe kvm || true
67+
if [[ ! -e /dev/kvm ]]; then
68+
export TEST_NO_QEMU=1
69+
fi
70+
71+
# Create missing mountpoint for mkosi sandbox.
72+
mkdir -p /etc/pacman.d/gnupg
73+
74+
mkosi summary
75+
mkosi -f sandbox true
76+
mkosi -f sandbox meson setup --buildtype=debugoptimized -Dintegration-tests=true build
77+
mkosi genkey
78+
mkosi -f sandbox meson compile -C build mkosi
79+
mkosi -f sandbox \
80+
meson test \
81+
-C build \
82+
--no-rebuild \
83+
--suite integration-tests \
84+
--print-errorlogs \
85+
--no-stdsplit \
86+
--num-processes "$(($(nproc) - 1))"
87+
88+
popd

test/fmf/plans/ci.fmf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
summary: systemd Fedora test suite
4+
discover:
5+
how: fmf
6+
prepare:
7+
- name: systemd
8+
how: install
9+
exclude:
10+
- systemd-standalone-.*
11+
execute:
12+
how: tmt

0 commit comments

Comments
 (0)