public inbox for linux-ppp@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Qingfang Deng <dqfext@gmail.com>, Shuah Khan <shuah@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-ppp@vger.kernel.org, netdev@vger.kernel.org
Cc: Paul Mackerras <paulus@ozlabs.org>
Subject: Re: [PATCH net-next v2] selftests: net: add tests for PPP
Date: Tue, 24 Mar 2026 15:28:42 +0100	[thread overview]
Message-ID: <51b1b736-17b4-4e2e-b11a-3d94c8410a9c@redhat.com> (raw)
In-Reply-To: <20260321154616.2754-1-dqfext@gmail.com>

On 3/21/26 4:46 PM, Qingfang Deng wrote:
> Add ping and iperf3 tests for ppp_async.c and pppoe.c.
> 
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>
> ---
> v2: fix shellcheck and add trailing backslashes.
>  - https://lore.kernel.org/netdev/20260320071755.483733-1-dqfext@gmail.com/
> 
>  MAINTAINERS                                   |  1 +
>  tools/testing/selftests/Makefile              |  1 +
>  tools/testing/selftests/net/ppp/Makefile      | 15 +++++++
>  tools/testing/selftests/net/ppp/config        |  8 ++++
>  tools/testing/selftests/net/ppp/ppp_async.sh  | 37 ++++++++++++++++
>  tools/testing/selftests/net/ppp/ppp_common.sh | 42 +++++++++++++++++++
>  .../selftests/net/ppp/pppoe-server-options    |  2 +
>  tools/testing/selftests/net/ppp/pppoe.sh      | 36 ++++++++++++++++
>  8 files changed, 142 insertions(+)
>  create mode 100644 tools/testing/selftests/net/ppp/Makefile
>  create mode 100644 tools/testing/selftests/net/ppp/config
>  create mode 100755 tools/testing/selftests/net/ppp/ppp_async.sh
>  create mode 100644 tools/testing/selftests/net/ppp/ppp_common.sh
>  create mode 100644 tools/testing/selftests/net/ppp/pppoe-server-options
>  create mode 100755 tools/testing/selftests/net/ppp/pppoe.sh
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a09bf30a057d..d553437d5ac1 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -21078,6 +21078,7 @@ PPP PROTOCOL DRIVERS AND COMPRESSORS
>  L:	linux-ppp@vger.kernel.org
>  S:	Orphan
>  F:	drivers/net/ppp/ppp_*
> +F:	tools/testing/selftests/net/ppp/
>  
>  PPS SUPPORT
>  M:	Rodolfo Giometti <giometti@enneenne.com>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 450f13ba4cca..65f84e8a0cf0 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -78,6 +78,7 @@ TARGETS += net/netfilter
>  TARGETS += net/openvswitch
>  TARGETS += net/ovpn
>  TARGETS += net/packetdrill
> +TARGETS += net/ppp
>  TARGETS += net/rds
>  TARGETS += net/tcp_ao
>  TARGETS += nolibc
> diff --git a/tools/testing/selftests/net/ppp/Makefile b/tools/testing/selftests/net/ppp/Makefile
> new file mode 100644
> index 000000000000..b39b0abadde6
> --- /dev/null
> +++ b/tools/testing/selftests/net/ppp/Makefile
> @@ -0,0 +1,15 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +top_srcdir = ../../../../..
> +
> +TEST_PROGS := \
> +	ppp_async.sh \
> +	pppoe.sh \
> +# end of TEST_PROGS
> +
> +TEST_FILES := \
> +	ppp_common.sh \
> +	pppoe-server-options \
> +# end of TEST_FILES
> +
> +include ../../lib.mk
> diff --git a/tools/testing/selftests/net/ppp/config b/tools/testing/selftests/net/ppp/config
> new file mode 100644
> index 000000000000..7053aa9d8d74
> --- /dev/null
> +++ b/tools/testing/selftests/net/ppp/config
> @@ -0,0 +1,8 @@
> +CONFIG_PACKET=y
> +CONFIG_PPP=m
> +CONFIG_PPP_ASYNC=m
> +CONFIG_PPP_BSDCOMP=m
> +CONFIG_PPP_DEFLATE=m
> +CONFIG_PPPOE=m
> +CONFIG_PPPOE_HASH_BITS_4=y
> +CONFIG_TTY=y

The config list looks quite tiny. Have you double-checked that it's
enough to run successfully the self-tests via the nipa-like setup:

https://github.com/linux-netdev/nipa/wiki/How-to-run-netdev-selftests-CI-style

?

> diff --git a/tools/testing/selftests/net/ppp/ppp_async.sh b/tools/testing/selftests/net/ppp/ppp_async.sh
> new file mode 100755
> index 000000000000..5c0eb84945e8
> --- /dev/null
> +++ b/tools/testing/selftests/net/ppp/ppp_async.sh
> @@ -0,0 +1,37 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +set -e
> +source ppp_common.sh
> +
> +# Temporary files for PTY symlinks
> +TTY_SERVER=$(mktemp -u /tmp/ppp_async_server.XXXXXX)
> +TTY_CLIENT=$(mktemp -u /tmp/ppp_async_client.XXXXXX)

You need to delete the above files at cleanup time

> +
> +cleanup() {
> +	cleanup_all_ns
> +	[ -n "$SOCAT_PID" ] && kill "$SOCAT_PID" 2>/dev/null || true
> +}
> +
> +trap cleanup EXIT
> +
> +require_command socat
> +ppp_common_init
> +
> +# Create the virtual serial device
> +socat -d PTY,link="$TTY_SERVER",rawer PTY,link="$TTY_CLIENT",rawer &
> +SOCAT_PID=$!
> +
> +# Wait for symlinks to be created
> +slowwait 5 [ -L "$TTY_SERVER" ]
> +
> +# Start the PPP Server
> +ip netns exec "$NS_SERVER" pppd "$TTY_SERVER" 115200 \
> +	"$IP_SERVER":"$IP_CLIENT" \
> +	local noauth nodefaultroute debug
> +
> +# Start the PPP Client
> +ip netns exec "$NS_CLIENT" pppd "$TTY_CLIENT" 115200 \
> +	local noauth updetach nodefaultroute debug
> +
> +ppp_test_connectivity
> diff --git a/tools/testing/selftests/net/ppp/ppp_common.sh b/tools/testing/selftests/net/ppp/ppp_common.sh
> new file mode 100644
> index 000000000000..9ddfba0f9a05
> --- /dev/null
> +++ b/tools/testing/selftests/net/ppp/ppp_common.sh
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# shellcheck disable=SC2153
> +
> +source ../lib.sh
> +
> +IP_SERVER="192.168.200.1"
> +IP_CLIENT="192.168.200.2"
> +
> +ppp_common_init() {
> +	# Package requirements
> +	require_command pppd
> +	require_command iperf3
> +
> +	# Check for root privileges
> +	if [ "$(id -u)" -ne 0 ];then
> +		echo "SKIP: Need root privileges"
> +		exit $ksft_skip
> +	fi
> +
> +	# Namespaces
> +	setup_ns NS_SERVER NS_CLIENT
> +}
> +
> +ppp_check_addr() {
> +	dev=$1
> +	addr=$2
> +	ns=$3
> +	ip -netns "$ns" -4 addr show dev "$dev" 2>/dev/null | grep -q "$addr"
> +	return $?
> +}
> +
> +ppp_test_connectivity() {
> +	slowwait 10 ppp_check_addr "ppp0" "$IP_CLIENT" "$NS_CLIENT"
> +
> +	ip netns exec "$NS_CLIENT" ping -c 3 "$IP_SERVER"
> +
> +	ip netns exec "$NS_SERVER" iperf3 -s -1 -D
> +	wait_local_port_listen "$NS_SERVER" 5201 tcp
> +
> +	ip netns exec "$NS_CLIENT" iperf3 -c "$IP_SERVER" -Z -t 2

It would be possibly helpful to let the test emit a one line test
name/description followed by [ ok ] / [fail] as most test cases currently do

/P


      reply	other threads:[~2026-03-24 14:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21 15:46 [PATCH net-next v2] selftests: net: add tests for PPP Qingfang Deng
2026-03-24 14:28 ` Paolo Abeni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51b1b736-17b4-4e2e-b11a-3d94c8410a9c@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulus@ozlabs.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox