mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
test: Switch to ncat instead of nc
ncat is available in CentOS Stream 9 without having to enable EPEL.
(cherry picked from commit e842deeac6
)
This commit is contained in:
parent
0c51e28088
commit
74475a5169
@ -37,8 +37,8 @@ Packages=
|
|||||||
linux
|
linux
|
||||||
man-db
|
man-db
|
||||||
multipath-tools
|
multipath-tools
|
||||||
|
nmap
|
||||||
open-iscsi
|
open-iscsi
|
||||||
openbsd-netcat
|
|
||||||
openssh
|
openssh
|
||||||
openssl
|
openssl
|
||||||
pacman
|
pacman
|
||||||
|
@ -45,7 +45,7 @@ Packages=
|
|||||||
libcap-ng-utils
|
libcap-ng-utils
|
||||||
libubsan
|
libubsan
|
||||||
man-db
|
man-db
|
||||||
netcat
|
nmap-ncat
|
||||||
openssh-clients
|
openssh-clients
|
||||||
openssh-server
|
openssh-server
|
||||||
pam
|
pam
|
||||||
|
@ -65,7 +65,7 @@ Packages=
|
|||||||
locales
|
locales
|
||||||
man-db
|
man-db
|
||||||
multipath-tools
|
multipath-tools
|
||||||
netcat-openbsd
|
ncat
|
||||||
open-iscsi
|
open-iscsi
|
||||||
openssh-client
|
openssh-client
|
||||||
openssh-server
|
openssh-server
|
||||||
|
@ -8,6 +8,7 @@ InitrdInclude=initrd/
|
|||||||
|
|
||||||
[Distribution]
|
[Distribution]
|
||||||
Release=tumbleweed
|
Release=tumbleweed
|
||||||
|
Repositories=non-oss
|
||||||
PackageManagerTrees=macros.db_backend:/etc/rpm/macros.db_backend
|
PackageManagerTrees=macros.db_backend:/etc/rpm/macros.db_backend
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
@ -60,6 +61,7 @@ Packages=
|
|||||||
libkmod2
|
libkmod2
|
||||||
libubsan1
|
libubsan1
|
||||||
multipath-tools
|
multipath-tools
|
||||||
|
ncat
|
||||||
open-iscsi
|
open-iscsi
|
||||||
openssh-clients
|
openssh-clients
|
||||||
openssh-server
|
openssh-server
|
||||||
|
@ -7,7 +7,7 @@ Distribution=arch
|
|||||||
Packages=
|
Packages=
|
||||||
inetutils
|
inetutils
|
||||||
iproute
|
iproute
|
||||||
openbsd-netcat
|
nmap
|
||||||
|
|
||||||
RemoveFiles=
|
RemoveFiles=
|
||||||
# Arch Linux doesn't split their gcc-libs package so we manually remove
|
# Arch Linux doesn't split their gcc-libs package so we manually remove
|
||||||
|
@ -9,4 +9,4 @@ Packages=
|
|||||||
hostname
|
hostname
|
||||||
iproute
|
iproute
|
||||||
iproute-tc
|
iproute-tc
|
||||||
netcat
|
nmap-ncat
|
||||||
|
@ -9,4 +9,4 @@ Packages=
|
|||||||
hostname
|
hostname
|
||||||
iproute2
|
iproute2
|
||||||
mount
|
mount
|
||||||
netcat-openbsd
|
ncat
|
||||||
|
@ -7,5 +7,5 @@ Distribution=opensuse
|
|||||||
Packages=
|
Packages=
|
||||||
hostname
|
hostname
|
||||||
iproute2
|
iproute2
|
||||||
netcat-openbsd
|
ncat
|
||||||
patterns-base-minimal_base
|
patterns-base-minimal_base
|
||||||
|
@ -32,7 +32,7 @@ test_append_files() {
|
|||||||
ls \
|
ls \
|
||||||
md5sum \
|
md5sum \
|
||||||
mountpoint \
|
mountpoint \
|
||||||
nc \
|
ncat \
|
||||||
ps \
|
ps \
|
||||||
seq \
|
seq \
|
||||||
sleep \
|
sleep \
|
||||||
|
@ -208,7 +208,7 @@ BASICTOOLS=(
|
|||||||
mount
|
mount
|
||||||
mountpoint
|
mountpoint
|
||||||
mv
|
mv
|
||||||
nc
|
ncat
|
||||||
nproc
|
nproc
|
||||||
ping
|
ping
|
||||||
pkill
|
pkill
|
||||||
|
@ -186,27 +186,27 @@ if ! systemd-detect-virt -cq; then
|
|||||||
)
|
)
|
||||||
|
|
||||||
# We should fail with EPERM when trying to bind to a socket not on the allow list
|
# We should fail with EPERM when trying to bind to a socket not on the allow list
|
||||||
# (nc exits with 2 in that case)
|
# (ncat exits with 2 in that case)
|
||||||
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -l 127.0.0.1 9999; exit 42'
|
bash -xec 'timeout 1s ncat -l 127.0.0.1 9999; exit 42'
|
||||||
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -l ::1 9999; exit 42'
|
bash -xec 'timeout 1s ncat -l ::1 9999; exit 42'
|
||||||
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -6 -u -l ::1 9999; exit 42'
|
bash -xec 'timeout 1s ncat -6 -u -l ::1 9999; exit 42'
|
||||||
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -4 -l 127.0.0.1 6666; exit 42'
|
bash -xec 'timeout 1s ncat -4 -l 127.0.0.1 6666; exit 42'
|
||||||
systemd-run --wait -p SuccessExitStatus="1 2" --pipe -p SocketBindDeny=any \
|
systemd-run --wait -p SuccessExitStatus="1 2" --pipe -p SocketBindDeny=any \
|
||||||
bash -xec 'timeout 1s nc -l 127.0.0.1 9999; exit 42'
|
bash -xec 'timeout 1s ncat -l 127.0.0.1 9999; exit 42'
|
||||||
# Consequently, we should succeed when binding to a socket on the allow list
|
# Consequently, we should succeed when binding to a socket on the allow list
|
||||||
# and keep listening on it until we're killed by `timeout` (EC 124)
|
# and keep listening on it until we're killed by `timeout` (EC 124)
|
||||||
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -4 -l 127.0.0.1 1234; exit 1'
|
bash -xec 'timeout 1s ncat -4 -l 127.0.0.1 1234; exit 1'
|
||||||
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -4 -u -l 127.0.0.1 5678; exit 1'
|
bash -xec 'timeout 1s ncat -4 -u -l 127.0.0.1 5678; exit 1'
|
||||||
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -6 -l ::1 1234; exit 1'
|
bash -xec 'timeout 1s ncat -6 -l ::1 1234; exit 1'
|
||||||
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \
|
||||||
bash -xec 'timeout 1s nc -6 -l ::1 6666; exit 1'
|
bash -xec 'timeout 1s ncat -6 -l ::1 6666; exit 1'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
losetup -d "$LODEV"
|
losetup -d "$LODEV"
|
||||||
|
@ -8,7 +8,7 @@ set -o pipefail
|
|||||||
|
|
||||||
rm -f /tmp/nonexistent
|
rm -f /tmp/nonexistent
|
||||||
systemctl start issue2467.socket
|
systemctl start issue2467.socket
|
||||||
nc -i20 -w20 -U /run/test.ctl || :
|
ncat -i20 -w20 -U /run/test.ctl || :
|
||||||
|
|
||||||
# TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should give
|
# TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should give
|
||||||
# systemd enough time even on slower machines, to reach the trigger limit.
|
# systemd enough time even on slower machines, to reach the trigger limit.
|
||||||
|
@ -30,21 +30,21 @@ EOF
|
|||||||
systemctl start issue-3171.socket
|
systemctl start issue-3171.socket
|
||||||
systemctl is-active issue-3171.socket
|
systemctl is-active issue-3171.socket
|
||||||
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
||||||
echo A | nc -w1 -U /run/issue-3171.socket
|
echo A | ncat -w1 -U /run/issue-3171.socket
|
||||||
|
|
||||||
mv $U ${U}.disabled
|
mv $U ${U}.disabled
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl is-active issue-3171.socket
|
systemctl is-active issue-3171.socket
|
||||||
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
||||||
echo B | nc -w1 -U /run/issue-3171.socket && exit 1
|
echo B | ncat -w1 -U /run/issue-3171.socket && exit 1
|
||||||
|
|
||||||
mv ${U}.disabled $U
|
mv ${U}.disabled $U
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl is-active issue-3171.socket
|
systemctl is-active issue-3171.socket
|
||||||
echo C | nc -w1 -U /run/issue-3171.socket && exit 1
|
echo C | ncat -w1 -U /run/issue-3171.socket && exit 1
|
||||||
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
||||||
|
|
||||||
systemctl restart issue-3171.socket
|
systemctl restart issue-3171.socket
|
||||||
systemctl is-active issue-3171.socket
|
systemctl is-active issue-3171.socket
|
||||||
echo D | nc -w1 -U /run/issue-3171.socket
|
echo D | ncat -w1 -U /run/issue-3171.socket
|
||||||
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
[[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]]
|
||||||
|
@ -702,7 +702,7 @@ EOF
|
|||||||
testcase_notification_socket() {
|
testcase_notification_socket() {
|
||||||
# https://github.com/systemd/systemd/issues/4944
|
# https://github.com/systemd/systemd/issues/4944
|
||||||
local root
|
local root
|
||||||
local cmd='echo a | nc -U -u -w 1 /run/host/notify'
|
local cmd='echo a | ncat -U -u -w 1 /run/host/notify'
|
||||||
|
|
||||||
root="$(mktemp -d /var/lib/machines/TEST-13-NSPAWN.check_notification_socket.XXX)"
|
root="$(mktemp -d /var/lib/machines/TEST-13-NSPAWN.check_notification_socket.XXX)"
|
||||||
create_dummy_container "$root"
|
create_dummy_container "$root"
|
||||||
|
Loading…
Reference in New Issue
Block a user