Skip to content

Commit 4540e57

Browse files
committed
ci: provide dummy ALSA device for software tests
1 parent 6f2c261 commit 4540e57

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

.build/images/dietpi-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ esac
212212
fsname='' afspackages=() afs_opts=() afsck=() aresize=() apackages=()
213213
case $FSTYPE in
214214
'ext4') afspackages+=('e2fsprogs') afs_opts=('-e' 'remount-ro' '-O' '^has_journal') afsck=('e2fsck' '-fyD') aresize=('resize2fs');;
215-
'f2fs') fsname='F2FS' afspackages+=('f2fs-tools') afsck=('fsck.f2fs' '-f') aresize=('resize.f2fs'); uname -r | grep -q '-azure$' && apackages+=("linux-modules-extra-$(uname -r)");;
215+
'f2fs') fsname='F2FS' afspackages+=('f2fs-tools') afsck=('fsck.f2fs' '-f') aresize=('resize.f2fs'); uname -r | grep -q '\-azure$' && apackages+=("linux-modules-extra-$(uname -r)");;
216216
'btrfs') fsname='Btrfs' afspackages+=('btrfs-progs') afsck=('btrfs' 'check' '--repair') aresize=('btrfs' 'filesystem' 'resize' 'max'); ((root_size*=5,root_size/=4));;
217217
*) Error_Exit "Invalid root filesystem type \"$FSTYPE\" passed";;
218218
esac

.github/workflows/dietpi-software.bash

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ emulation=0
9494
##########################################
9595
# Create service and port lists
9696
##########################################
97-
aINSTALL=() aSERVICES=() aTCP=() aUDP=() aCOMMANDS=() aDELAY=() CAPABILITIES='' SYSCALLS='' aOPTIONS=()
97+
aINSTALL=() aSERVICES=() aTCP=() aUDP=() aCOMMANDS=() aDELAY=() CAPABILITIES='' SYSCALLS='' aOPTIONS=() AUDIO=0
9898
Process_Software()
9999
{
100100
local i
@@ -108,7 +108,7 @@ Process_Software()
108108
2) aSERVICES[i]='fahclient' aTCP[i]='7396';;
109109
3) aCOMMANDS[i]='mc -V';;
110110
4) aCOMMANDS[i]='fish -v';;
111-
5) aCOMMANDS[i]='aplay -l';;
111+
5) aCOMMANDS[i]='aplay -l' AUDIO=1;;
112112
6) aCOMMANDS[i]='X -version';;
113113
7) aCOMMANDS[i]='ffmpeg -version';;
114114
8) aCOMMANDS[i]='javac -version';;
@@ -117,7 +117,7 @@ Process_Software()
117117
11) aCOMMANDS[i]='gzdoom -norun | grep '\''^GZDoom version '\';;
118118
12) aSERVICES[i]='rustdesksignal rustdeskrelay' aTCP[i]='21115 21116 21117 21118 21119' aUDP[i]='21116';;
119119
#16) aSERVICES[i]='microblog-pub' aTCP[i]='8007';; Service enters a CPU-intense internal error loop until it has been configured interactively via "microblog-pub configure", hence it is not enabled and started anymore after install but instead as part of "microblog-pub configure"
120-
17) aCOMMANDS[i]='git --version';; # from Bookworm on, the shorthand "-v" is supported
120+
17) aCOMMANDS[i]='git -v';;
121121
#22) QuiteRSS: has no CLI
122122
23) aCOMMANDS[i]='lxsession -h';;
123123
24) aCOMMANDS[i]='mate-session -h';;
@@ -132,7 +132,7 @@ Process_Software()
132132
33) (( $emulation )) || aSERVICES[i]='airsonic' aTCP[i]='8080' aDELAY[i]=60;; # Fails in QEMU-emulated containers, probably due to missing device access
133133
34) aCOMMANDS[i]='COMPOSER_ALLOW_SUPERUSER=1 composer -n -V';;
134134
35) aSERVICES[i]='lyrionmusicserver' aTCP[i]='9000';;
135-
36) aCOMMANDS[i]='squeezelite -t';; # Service listens on random high UDP port and exits if no audio device has been found, which does not exist on GitHub Actions runners, respectively within the containers
135+
36) aSERVICES[i]='squeezelite';; # Service listens on random high UDP port
136136
37) aSERVICES[i]='shairport-sync' aTCP[i]='5000';; # AirPlay 2 would be TCP port 7000
137137
38) aCOMMANDS[i]='/opt/FreshRSS/cli/user-info.php';;
138138
39) aSERVICES[i]='minidlna' aTCP[i]='8200';;
@@ -233,7 +233,7 @@ Process_Software()
233233
132) aSERVICES[i]='aria2' aTCP[i]='6800';; # aTCP[i]+=' 6881-6999';; # Listens on random port
234234
133) aSERVICES[i]='yacy' aTCP[i]='8090'; (( $emulation )) && aDELAY[i]=120;;
235235
134) aCOMMANDS[i]='docker compose version';;
236-
135) aSERVICES[i]='icecast2' aTCP[i]='8000' aCOMMANDS[i]='darkice -h | grep '\''^DarkIce'\';; # darkice service cannot start in container as is requires audio recording device access
236+
135) aSERVICES[i]='icecast2 darkice' aTCP[i]='8000';;
237237
136) aSERVICES[i]='motioneye' aTCP[i]='8765';;
238238
137) aCOMMANDS[i]='/opt/mjpg-streamer/mjpg_streamer -v';; # aSERVICES[i]='mjpg-streamer' aTCP[i]='8082' Service does not start without an actual video device
239239
138) aSERVICES[i]='virtualhere' aTCP[i]='7575';;
@@ -323,10 +323,10 @@ do
323323
case $i in
324324
205) Process_Software webserver;;
325325
27|56|63|64|107|132) Process_Software 89 webserver;;
326-
38|40|48|54|55|57|59|90|160|210) Process_Software 88 89 webserver;;
326+
38|48|54|55|57|59|90|160|210) Process_Software 88 89 webserver;;
327327
159) Process_Software 36 37 65 88 89 96 121 124 128 129 152 160 163 webserver;;
328328
47|114|168) Process_Software 88 89 91 webserver;;
329-
8|33|80|133|164|179|181|206) Process_Software 196;;
329+
8|80|133|164|179|181|206) Process_Software 196;;
330330
122) Process_Software 9;;
331331
53|131) Process_Software 9 196;;
332332
32|148|119) Process_Software 128;;
@@ -341,13 +341,17 @@ do
341341
188) Process_Software 17;;
342342
213) Process_Software 17 188;;
343343
183) Process_Software 87;;
344-
31|37|128|138|163|167|187) Process_Software 152;;
344+
138|187) Process_Software 152;;
345345
75) Process_Software 83 87 89;;
346346
76) Process_Software 83 88 89;;
347347
78) Process_Software 85 87 89;;
348348
79) Process_Software 85 88 89;;
349349
81) Process_Software 84 87 89;;
350350
82) Process_Software 84 88 89;;
351+
23|24|25|26|173|36|118|121|124|135|154|191|192|199|204|108|10|51|112|156|11|189|113|67) Process_Software 5;;
352+
31|37|128|163|167) Process_Software 5 152;;
353+
33) Process_Software 5 196;;
354+
40) Process_Software 5 88 89 webserver;;
351355
*) :;;
352356
esac
353357
Process_Software "$i"
@@ -362,6 +366,32 @@ apackages=('xz-utils' 'parted' 'fdisk' 'systemd-container')
362366

363367
G_AG_CHECK_INSTALL_PREREQ "${apackages[@]}"
364368

369+
# Dummy sound device
370+
if (( $AUDIO )) && ! lsmod | grep -q '^snd'
371+
then
372+
G_AG_CHECK_INSTALL_PREREQ "linux-headers-$(uname -r)" dkms
373+
G_EXEC mkdir -p /usr/src/snd-dummy-0.1
374+
G_EXEC cd /usr/src/snd-dummy-0.1
375+
cat << '_EOF_' > dkms.conf
376+
PACKAGE_NAME="snd-dummy"
377+
PACKAGE_VERSION="0.1"
378+
MAKE[0]="make -C /lib/modules/${kernelver}/build M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
379+
CLEAN="make -C /lib/modules/${kernelver}/build M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
380+
BUILT_MODULE_NAME[0]="snd_dummy"
381+
DEST_MODULE_LOCATION[0]="/kernel/sound/drivers"
382+
AUTOINSTALL="yes"
383+
_EOF_
384+
cat << '_EOF_' > Makefile
385+
obj-m += snd_dummy.o
386+
snd_dummy-objs := dummy.o
387+
_EOF_
388+
G_EXEC curl -sSfo 'dummy.c' 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/sound/drivers/dummy.c?h=linux-6.11.y'
389+
G_EXEC_OUTPUT=1 G_EXEC dkms add .
390+
G_EXEC_NOHALT=1 G_EXEC_OUTPUT=1 G_EXEC dkms build snd-dummy/0.1 || cat /var/lib/dkms/snd-dummy/0.1/build/make.log
391+
G_EXEC_OUTPUT=1 G_EXEC dkms install snd-dummy/0.1
392+
G_EXEC modprobe snd_dummy
393+
fi
394+
365395
# Register QEMU binfmt configs
366396
(( $emulation )) && G_EXEC systemctl restart systemd-binfmt
367397

0 commit comments

Comments
 (0)