mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
test: Switch to ncat instead of nc
ncat is available in CentOS Stream 9 without having to enable EPEL.
This commit is contained in:
parent
3e3a15c06e
commit
e842deeac6
@ -37,8 +37,8 @@ Packages=
|
||||
linux
|
||||
man-db
|
||||
multipath-tools
|
||||
nmap
|
||||
open-iscsi
|
||||
openbsd-netcat
|
||||
openssh
|
||||
openssl
|
||||
pacman
|
||||
|
@ -45,7 +45,7 @@ Packages=
|
||||
libcap-ng-utils
|
||||
libubsan
|
||||
man-db
|
||||
netcat
|
||||
nmap-ncat
|
||||
openssh-clients
|
||||
openssh-server
|
||||
pam
|
||||
|
@ -65,7 +65,7 @@ Packages=
|
||||
locales
|
||||
man-db
|
||||
multipath-tools
|
||||
netcat-openbsd
|
||||
ncat
|
||||
open-iscsi
|
||||
openssh-client
|
||||
openssh-server
|
||||
|
@ -8,6 +8,7 @@ InitrdInclude=initrd/
|
||||
|
||||
[Distribution]
|
||||
Release=tumbleweed
|
||||
Repositories=non-oss
|
||||
PackageManagerTrees=macros.db_backend:/etc/rpm/macros.db_backend
|
||||
|
||||
[Content]
|
||||
@ -60,6 +61,7 @@ Packages=
|
||||
libkmod2
|
||||
libubsan1
|
||||
multipath-tools
|
||||
ncat
|
||||
open-iscsi
|
||||
openssh-clients
|
||||
openssh-server
|
||||
|
@ -7,7 +7,7 @@ Distribution=arch
|
||||
Packages=
|
||||
inetutils
|
||||
iproute
|
||||
openbsd-netcat
|
||||
nmap
|
||||
|
||||
RemoveFiles=
|
||||
# Arch Linux doesn't split their gcc-libs package so we manually remove
|
||||
|
@ -9,4 +9,4 @@ Packages=
|
||||
hostname
|
||||
iproute
|
||||
iproute-tc
|
||||
netcat
|
||||
nmap-ncat
|
||||
|
@ -9,4 +9,4 @@ Packages=
|
||||
hostname
|
||||
iproute2
|
||||
mount
|
||||
netcat-openbsd
|
||||
ncat
|
||||
|
@ -7,5 +7,5 @@ Distribution=opensuse
|
||||
Packages=
|
||||
hostname
|
||||
iproute2
|
||||
netcat-openbsd
|
||||
ncat
|
||||
patterns-base-minimal_base
|
||||
|
@ -32,7 +32,7 @@ test_append_files() {
|
||||
ls \
|
||||
md5sum \
|
||||
mountpoint \
|
||||
nc \
|
||||
ncat \
|
||||
ps \
|
||||
seq \
|
||||
sleep \
|
||||
|
@ -208,7 +208,7 @@ BASICTOOLS=(
|
||||
mount
|
||||
mountpoint
|
||||
mv
|
||||
nc
|
||||
ncat
|
||||
nproc
|
||||
ping
|
||||
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
|
||||
# (nc exits with 2 in that case)
|
||||
# (ncat exits with 2 in that case)
|
||||
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[@]}" \
|
||||
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[@]}" \
|
||||
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[@]}" \
|
||||
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 \
|
||||
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
|
||||
# and keep listening on it until we're killed by `timeout` (EC 124)
|
||||
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[@]}" \
|
||||
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[@]}" \
|
||||
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[@]}" \
|
||||
bash -xec 'timeout 1s nc -6 -l ::1 6666; exit 1'
|
||||
bash -xec 'timeout 1s ncat -6 -l ::1 6666; exit 1'
|
||||
fi
|
||||
|
||||
losetup -d "$LODEV"
|
||||
|
@ -8,7 +8,7 @@ set -o pipefail
|
||||
|
||||
rm -f /tmp/nonexistent
|
||||
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
|
||||
# systemd enough time even on slower machines, to reach the trigger limit.
|
||||
|
@ -30,21 +30,21 @@ EOF
|
||||
systemctl start issue-3171.socket
|
||||
systemctl is-active issue-3171.socket
|
||||
[[ "$(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
|
||||
systemctl daemon-reload
|
||||
systemctl is-active issue-3171.socket
|
||||
[[ "$(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
|
||||
systemctl daemon-reload
|
||||
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 ]]
|
||||
|
||||
systemctl restart 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 ]]
|
||||
|
@ -702,7 +702,7 @@ EOF
|
||||
testcase_notification_socket() {
|
||||
# https://github.com/systemd/systemd/issues/4944
|
||||
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)"
|
||||
create_dummy_container "$root"
|
||||
|
Loading…
Reference in New Issue
Block a user