mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
networkd-test: add mkosi snippet for building and running networkd-tets.py in a network namespaced container
This provides us with an easy command line to test this script. Because the test was so difficult to get running noone ever did, hence it broke badly quickly. Let's fix that.
This commit is contained in:
parent
0373fc5b6f
commit
bf246ba00e
24
test/mkosi.build.networkd-test
Executable file
24
test/mkosi.build.networkd-test
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
# First, source in the main build script
|
||||
. "$SRCDIR"/mkosi.build
|
||||
|
||||
mkdir -p "$DESTDIR"/usr/local/bin
|
||||
cp "$SRCDIR"/test/networkd-test.py "$DESTDIR"/usr/local/bin/networkd-test.py
|
||||
|
||||
mkdir -p "$DESTDIR"/etc/systemd/system
|
||||
cat > "$DESTDIR"/etc/systemd/system/networkd-test.service <<EOF
|
||||
[Unit]
|
||||
Description=networkd test service
|
||||
SuccessAction=exit
|
||||
FailureAction=exit
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/networkd-test.py
|
||||
EOF
|
||||
|
||||
mkdir -p "$DESTDIR"/etc/systemd/system/multi-user.target.wants/
|
||||
ln -s ../networkd-test.service "$DESTDIR"/etc/systemd/system/multi-user.target.wants/
|
||||
|
||||
systemctl --root="$DESTDIR" disable systemd-networkd.service
|
80
test/mkosi.default.networkd-test
Normal file
80
test/mkosi.default.networkd-test
Normal file
@ -0,0 +1,80 @@
|
||||
# Puts together an nspawn container and runs networkd-test.py in it, inside a
|
||||
# network namespace and everything. Run this with "mkosi
|
||||
# --default=mkosi.default.networkd-test boot". This will start the test and
|
||||
# eventually exit with sucess in case the test succeeded.
|
||||
|
||||
[Distribution]
|
||||
Distribution=fedora
|
||||
Release=29
|
||||
|
||||
[Output]
|
||||
Format=raw_btrfs
|
||||
Bootable=yes
|
||||
KernelCommandLine=printk.devkmsg=on
|
||||
OutputDirectory=../mkosi.output
|
||||
Output=networkd-test.raw
|
||||
|
||||
[Partitions]
|
||||
RootSize=3G
|
||||
|
||||
[Packages]
|
||||
BuildPackages=
|
||||
audit-libs-devel
|
||||
bzip2-devel
|
||||
cryptsetup-devel
|
||||
dbus-devel
|
||||
diffutils
|
||||
docbook-style-xsl
|
||||
elfutils-devel
|
||||
gcc
|
||||
gettext
|
||||
git
|
||||
gnu-efi
|
||||
gnu-efi-devel
|
||||
gnutls-devel
|
||||
gperf
|
||||
hostname
|
||||
iptables-devel
|
||||
kmod-devel
|
||||
libacl-devel
|
||||
libblkid-devel
|
||||
libcap-devel
|
||||
libcurl-devel
|
||||
libgcrypt-devel
|
||||
libidn2-devel
|
||||
libmicrohttpd-devel
|
||||
libmount-devel
|
||||
libseccomp-devel
|
||||
libselinux-devel
|
||||
libtool
|
||||
libxkbcommon-devel
|
||||
libxslt
|
||||
lz4
|
||||
lz4-devel
|
||||
m4
|
||||
meson
|
||||
pam-devel
|
||||
pcre2-devel
|
||||
pkgconfig
|
||||
python3-devel
|
||||
python3-lxml
|
||||
qrencode-devel
|
||||
tree
|
||||
xz-devel
|
||||
|
||||
Packages=
|
||||
dnsmasq
|
||||
iproute
|
||||
libidn2
|
||||
polkit
|
||||
python3
|
||||
|
||||
# Share caches with the top-level mkosi
|
||||
BuildDirectory=../mkosi.builddir
|
||||
Cache=../mkosi.cache
|
||||
|
||||
# Run our own script
|
||||
BuildScript=mkosi.build.networkd-test
|
||||
|
||||
BuildSources=..
|
||||
NSpawnSettings=mkosi.nspawn.networkd-test
|
2
test/mkosi.nspawn.networkd-test
Normal file
2
test/mkosi.nspawn.networkd-test
Normal file
@ -0,0 +1,2 @@
|
||||
[Network]
|
||||
Private=yes
|
Loading…
Reference in New Issue
Block a user