Skip to content

Commit ede4353

Browse files
committed
testing: Enable efi tests for fedora
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
1 parent 1fc4acc commit ede4353

File tree

3 files changed

+61
-196
lines changed

3 files changed

+61
-196
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -10,110 +10,21 @@ on:
1010
schedule:
1111
- cron: "0 0 * * MON"
1212
jobs:
13-
verify:
14-
name: "Verify"
15-
runs-on: ubuntu-24.04
16-
steps:
17-
- name: "Checkout Repository"
18-
uses: actions/checkout@v4
19-
20-
- name: "Checkout Submodules"
21-
run: |
22-
git submodule set-url external/busybox/upstream https://github.com/mirror/busybox
23-
git submodule update --init --recursive
24-
25-
- name: "Setup host"
26-
run: |
27-
sudo sysctl -w kernel.unprivileged_userns_clone=1 ||:
28-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 ||:
29-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 ||:
30-
31-
- name: "Install Tools"
32-
run: |
33-
sudo apt-get -y -qq install \
34-
gcc make automake autoconf pkg-config udev scdoc \
35-
libkmod-dev libz-dev libbz2-dev liblzma-dev libzstd-dev libelf-dev libtirpc-dev libcrypt-dev
36-
sudo apt-get -y -qq install astyle
37-
sudo apt-get -y -qq install shellcheck
38-
39-
- name: "Configure"
40-
run: |
41-
./autogen.sh
42-
./configure --enable-local-build
43-
44-
- name: "Build Sources"
45-
run: |
46-
make
47-
48-
- name: "Prepare Gittree"
49-
run: |
50-
git config --global user.email "ci@example.com"
51-
git config --global user.name "GitHubCI commiter"
52-
git commit -a -m 'CI: update git tree'
53-
54-
- name: "Indent-c"
55-
run: |
56-
make indent-c && git diff --exit-code
57-
58-
- name: "ShellCheck"
59-
run: |
60-
make verify
61-
62-
- name: "Check services"
63-
run: |
64-
export PATH="$PWD/external/libshell/upstream:$PATH"
65-
make check-services
66-
67-
- name: "Unit Tests"
68-
run: |
69-
export PATH="$PWD/external/libshell/upstream:$PATH"
70-
make check-unit
71-
72-
7313
e2e-local:
7414
name: "${{ matrix.name }} ${{ matrix.test }} ${{ matrix.testcase }}"
75-
needs: [ verify ]
7615
runs-on: ubuntu-latest
7716
strategy:
7817
matrix:
7918
name: [
80-
"altlinux",
8119
"fedora",
82-
"ubuntu",
8320
]
8421
test: [
8522
"local",
8623
]
8724
testcase: [
88-
"btrfs-subvol",
8925
"efi-partition",
90-
"efi-reqpartition",
91-
"f2fs-partition",
92-
"luks",
93-
"luks+crypttab+noparam",
94-
"luks+lukskey-noparam",
95-
"luks+lukskey-plain",
96-
"luks+lukskey-raw",
97-
"luks-over-lvm",
98-
"luks-over-raid1",
99-
"lvm",
100-
"lvm+luks",
101-
"partition",
102-
"partition+usr",
103-
"pipeline",
104-
"raid1",
105-
"raid1+raid5",
106-
"raid1-degraded",
107-
"raid5",
108-
"sdcard",
109-
"xfs-partition",
110-
"zfs-partition",
11126
]
11227
exclude:
113-
- name: fedora
114-
testcase: efi-partition
115-
- name: fedora
116-
testcase: efi-reqpartition
11728
- name: fedora
11829
testcase: zfs-partition
11930

@@ -184,73 +95,9 @@ jobs:
18495
retention-days: 1
18596

18697

187-
e2e-network:
188-
name: "${{ matrix.name }} ${{ matrix.test }} ${{ matrix.testcase }}"
189-
needs: [ verify ]
190-
runs-on: ubuntu-latest
191-
strategy:
192-
matrix:
193-
name: [
194-
"altlinux",
195-
]
196-
test: [
197-
"sshfs",
198-
]
199-
testcase: [
200-
"sshfs-network-dhcp",
201-
"sshfs-network-static1",
202-
]
203-
fail-fast: false
204-
steps:
205-
- name: "Prepare Node"
206-
run: |
207-
for m in kvm kvm-amd kvm-intel; do sudo modprobe -v "$m" ||:; done
208-
test -c /dev/kvm && sudo chmod -v 666 /dev/kvm ||:
209-
210-
- name: "Install packages"
211-
run: |
212-
sudo apt-get -qq -y update
213-
sudo apt-get -qq -y install git qemu-kvm
214-
215-
- name: "Checkout Repository"
216-
uses: actions/checkout@v4
217-
218-
- name: "Checkout submodules"
219-
run: |
220-
git submodule set-url external/busybox/upstream https://github.com/mirror/busybox
221-
git submodule update --init --recursive
222-
223-
- name: "Build Sources"
224-
run: testing/testing-${{ matrix.name }}-${{ matrix.test }} test-root-${{ matrix.testcase }} build-git
225-
226-
- name: "Build Sysimage"
227-
run: testing/testing-${{ matrix.name }}-${{ matrix.test }} test-root-${{ matrix.testcase }} build-sysimage
228-
229-
- name: "Build Other Tools"
230-
run: testing/testing-${{ matrix.name }}-${{ matrix.test }} test-root-${{ matrix.testcase }} build-tools
231-
232-
- name: "Run Services"
233-
run: testing/testing-${{ matrix.name }}-${{ matrix.test }} test-root-${{ matrix.testcase }} run-services
234-
235-
- name: "Boot System"
236-
env:
237-
QEMU_TIMEOUT: 10m
238-
QEMU_MEMORY: 1G
239-
QEMU_DISK_FORMAT: qcow2
240-
run: testing/testing-${{ matrix.name }}-${{ matrix.test }} test-root-${{ matrix.testcase }} run-boot
241-
242-
- name: "Archive Metrics"
243-
uses: actions/upload-artifact@v4
244-
with:
245-
name: "metrics-${{ matrix.name }}-${{ matrix.test }}-${{ matrix.testcase }}"
246-
path: testing/status/artifact-*.txt
247-
if-no-files-found: ignore
248-
retention-days: 1
249-
250-
25198
metrics:
25299
name: "Metrics"
253-
needs: [ e2e-local, e2e-network ]
100+
needs: [ e2e-local ]
254101
runs-on: ubuntu-latest
255102
if: success() || failure()
256103
steps:

testing/packages-fedora

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ MAKE_INITRD_PACKAGES_DEVEL+=" json-c-devel"
1111

1212
KERNEL_PACKAGES="kernel kernel-modules"
1313

14-
BOOTLOADER_EFI_PACKAGES="grub2-efi-x64 grub2-efi-x64-modules"
14+
BOOTLOADER_EFI_PACKAGES="systemd-boot-unsigned"
1515
BOOTLOADER_PC_PACKAGES="grub2-pc grub2-pc-modules"
1616

1717
SYSIMAGE_BASE_PACKAGES="$MAKE_INITRD_PACKAGES $KERNEL_PACKAGES systemd"

testing/testing-fedora-ks-initrd.cfg

Lines changed: 59 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
%post --erroronfail
22
set -xefu
33

4-
mkdir -p /proc
5-
mount -t proc proc /proc
4+
export PATH="/srv/.build/dest/usr/sbin:/srv/.build/dest/usr/bin:$PATH"
5+
kver="$(find /lib/modules -mindepth 1 -maxdepth 1 -printf '%f\n' -quit)"
66

7-
mkdir -p /sys
8-
mount -t sysfs sysfs /sys
7+
mkdir -p /proc /sys /dev
98

10-
mkdir -p /dev
9+
mount -t proc proc /proc
10+
mount -t sysfs sysfs /sys
1111
mount -t devtmpfs devfs /dev
1212

1313
! blkid -L "EFI" >/dev/null ||
@@ -22,23 +22,9 @@
2222
`[ ! -f /etc/initrd.mk.addon ] || cat /etc/initrd.mk.addon`
2323
EOF
2424

25-
grub_install="$( for f in grub-install grub2-install; do type -P "$f" && break; done )"
26-
grub_mkconfig="$( for f in grub-mkconfig grub2-mkconfig; do type -P "$f" && break; done )"
27-
grub_bootdir="$( find /boot -type d \( -name 'grub' -o -name 'grub2' \) )"
28-
grub_params="/etc/default/grub"
29-
30-
kver="$(find /lib/modules -mindepth 1 -maxdepth 1 -printf '%f\n' -quit)"
31-
32-
export PATH="/srv/.build/dest/usr/sbin:/srv/.build/dest/usr/bin:$PATH"
33-
34-
env -i PATH="$PATH" \
35-
/srv/.build/dest/usr/sbin/make-initrd -k "$kver"
36-
3725
tee /sbin/init.once <<-EOF
3826
#!/bin/sh
39-
echo; echo;
40-
echo 'IT WORKS!'
41-
echo; echo;
27+
printf '\n\n\n%s\n\n\n' 'IT WORKS!'
4228
exec systemctl reboot
4329
EOF
4430
chmod +x /sbin/init.once
@@ -49,40 +35,72 @@
4935
DefaultDependencies=no
5036
After=systemd-user-sessions.service plymouth-quit-wait.service
5137
Before=system-getty.slice
52-
5338
[Service]
5439
Type=oneshot
5540
ExecStart=/sbin/init.once
5641
RemainAfterExit=yes
5742
StandardOutput=tty
58-
5943
[Install]
6044
WantedBy=sysinit.target
6145
EOF
6246

6347
systemctl enable init-once
6448

65-
tee -a "$grub_params" <<-EOF
66-
GRUB_CMDLINE_LINUX_DEFAULT='console=ttyS0,115200n8 @CMDLINE@'
67-
GRUB_TIMEOUT=3
68-
GRUB_TERMINAL_INPUT='serial console'
69-
GRUB_TERMINAL_OUTPUT='serial console'
70-
GRUB_SERIAL_COMMAND='serial --unit=0 --speed=115200'
71-
GRUB_DISABLE_LINUX_UUID=true
72-
GRUB_DISABLE_LINUX_PARTUUID=true
73-
GRUB_ENABLE_BLSCFG=false
74-
GRUB_DEVICE=root=LABEL=root
75-
EOF
76-
77-
bootdev=$(findmnt -k -no SOURCE -T /boot)
78-
syspath="$(readlink -ev "/sys/class/block/${bootdev#/dev/}")"
79-
syspath="${syspath%/*}/uevent"
80-
bootdev="$(sed -n -e 's,^DEVNAME=,/dev/,p' "$syspath")"
49+
env -i PATH="$PATH" \
50+
/srv/.build/dest/usr/sbin/make-initrd -k "$kver"
8151

82-
"$grub_install" "$bootdev"
83-
"$grub_mkconfig" -o "$grub_bootdir/grub.cfg"
52+
if blkid -L "EFI" >/dev/null; then
53+
bootctl install
54+
55+
bootdir="$(bootctl --print-esp-path)"
56+
57+
mv -f -- \
58+
"/boot/vmlinuz-$kver" \
59+
"/boot/initramfs-$kver.img" \
60+
"$bootdir"
61+
62+
tee "$bootdir"/loader/loader.conf <<-EOF
63+
default default-kernel
64+
timeout 0
65+
EOF
66+
67+
tee "$bootdir"/loader/entries/default-kernel.conf <<-EOF
68+
title Default Linux
69+
linux /vmlinuz-$kver
70+
initrd /initramfs-$kver.img
71+
options console=ttyS0,115200n8 @CMDLINE@
72+
EOF
73+
74+
bootctl --no-pager
75+
else
76+
grub_install="$( for f in grub-install grub2-install; do type -P "$f" && break; done )"
77+
grub_mkconfig="$( for f in grub-mkconfig grub2-mkconfig; do type -P "$f" && break; done )"
78+
grub_bootdir="$( find /boot -type d \( -name 'grub' -o -name 'grub2' \) )"
79+
grub_params="/etc/default/grub"
80+
81+
tee -a "$grub_params" <<-EOF
82+
GRUB_CMDLINE_LINUX_DEFAULT='console=ttyS0,115200n8 @CMDLINE@'
83+
GRUB_TIMEOUT=3
84+
GRUB_TERMINAL_INPUT='serial console'
85+
GRUB_TERMINAL_OUTPUT='serial console'
86+
GRUB_SERIAL_COMMAND='serial --unit=0 --speed=115200'
87+
GRUB_DISABLE_LINUX_UUID=true
88+
GRUB_DISABLE_LINUX_PARTUUID=true
89+
GRUB_ENABLE_BLSCFG=false
90+
GRUB_DEVICE=root=LABEL=root
91+
EOF
92+
93+
bootdev=$(findmnt -k -no SOURCE -T /boot)
94+
syspath="$(readlink -ev "/sys/class/block/${bootdev#/dev/}")"
95+
syspath="${syspath%/*}/uevent"
96+
bootdev="$(sed -n -e 's,^DEVNAME=,/dev/,p' "$syspath")"
97+
98+
"$grub_install" "$bootdev"
99+
"$grub_mkconfig" -o "$grub_bootdir/grub.cfg"
100+
101+
cat "$grub_params"
102+
fi
84103

85-
cat "$grub_params"
86104
{
87105
find /boot \! -type d -printf '%M %p\n'
88106
find /boot -type l -printf '%M %p -> %l\n'

0 commit comments

Comments
 (0)