From patchwork Mon Mar 8 10:16:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 1448960 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=tessares-net.20150623.gappssmtp.com header.i=@tessares-net.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=l7cJq+cu; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DvDlm5VNPz9sWF for ; Mon, 8 Mar 2021 21:16:52 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6D5D2100EBBCD; Mon, 8 Mar 2021 02:16:50 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::42e; helo=mail-wr1-x42e.google.com; envelope-from=matthieu.baerts@tessares.net; receiver= Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9DCE0100EC1F5 for ; Mon, 8 Mar 2021 02:16:47 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id h98so10768641wrh.11 for ; Mon, 08 Mar 2021 02:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nzUWkaYgDrlSxWk49Xybb79yyGYBmKN95vy1NzIaMnw=; b=l7cJq+cuKfBEoxMWkj9dkAmmSANB4uXaDdJnCdhUs4OlR3M9ENkhfbBoOTjIlPpMPU CPy4qCSWznh2fWPE4eN49kInFhM52CeQ+BTFmSh9q3OM6tUliu8wO7+MRpuNyEFXizSO K+gJXnuPF4oSZ9Kyqngt0dYpaMNYuKV53Ciemghu9Ype0kolcWyEAzhNRaekIargAZ39 HLZVe8tF/PLNk5kLeycZRfUeYqDBtYpfwcNJetLCiVKCzJc7PEzR1AliXLWoLT88zZBs Wf5zJY2wEisqA0LV2zyM/7QbeTCLkvndaXPjWSuyTAY82zW32o7GZJufjj+d6/p4XfEZ D0uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nzUWkaYgDrlSxWk49Xybb79yyGYBmKN95vy1NzIaMnw=; b=lcCzZXfK2xHZrwM+/JIZYJpSnUDoh10F4m9iW+YFI/LLA5vaUp17v0uSObf8A1nPGI R3JY5UKtGukKMTbBYJ886EOfVQVk/o9iwN2Xq+1Q8ceDFNMliMk5+M3WKOjAieQgY7eg 8xRItIzVQ2FGorQ41eg4/+OMPkk+S+ENZBhgeEbxZGI8ts9pwfGuey/yWI2qYF/PEi6Q k8yHJjHjqsuuHZBrbK4ifWURqgFcJaAerXi1oIjjup8PvRoUtU/LejYjT2seeHp+8fK+ m1/L1sBvUIVAWYFI97dL2jES6VIbhY5NgPo2nELS5t695Q3qtVb+uQuYkPh58ZDNTQvu q6Mw== X-Gm-Message-State: AOAM530Qo+8fDmMjtsk5VKps9pzr/5oM3mhecVmlXww1vEYlmW4Ea+i4 m2fVWGhJILInQeIxyjn1srBbTleKyGmahcus X-Google-Smtp-Source: ABdhPJzH9brARvZJUA0lBXHnTjtm3hbwVEu1K90aXFFYY8qbXBgOUpslR2l+SZhfIVfOxRx3fbOyFA== X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr22041466wri.373.1615198604983; Mon, 08 Mar 2021 02:16:44 -0800 (PST) Received: from tsr-vdi-mbaerts.nix.tessares.net (static.23.216.130.94.clients.your-server.de. [94.130.216.23]) by smtp.gmail.com with ESMTPSA id f22sm18251693wmc.33.2021.03.08.02.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 02:16:44 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.01.org Cc: Matthieu Baerts Date: Mon, 8 Mar 2021 11:16:27 +0100 Message-Id: <20210308101627.2161839-1-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Message-ID-Hash: LYHWTHTHF3SOH7GXQLR7H4SKXAHJSGGV X-Message-ID-Hash: LYHWTHTHF3SOH7GXQLR7H4SKXAHJSGGV X-MailFrom: matthieu.baerts@tessares.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH mptcp-next] Squash to "selftests: mptcp: launch mptcp_connect with timeout" List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: In diag.sh, we want to send signals to mptcp_connect instances that have been started in the netns. But we cannot send this signal to 'timeout' otherwise that will stop the timeout and print something like: # ./diag.sh: line 1: 9536 Done echo a # 9537 User defined signal 1 | timeout ${timeout_test} ip netns (...) Instead of trying to find the right PID and storing them in an array, we can simply use the output of 'ip netns pids' and send a signal to all these PIDs. Signed-off-by: Matthieu Baerts --- Notes: to be squashed in "selftests: mptcp: launch mptcp_connect with timeout" tools/testing/selftests/net/mptcp/diag.sh | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index 35846f89cdad..2674ba20d524 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -8,7 +8,6 @@ test_cnt=1 timeout_poll=100 timeout_test=$((timeout_poll * 2 + 1)) ret=0 -pids=() flush_pids() { @@ -16,18 +15,14 @@ flush_pids() # give it some time sleep 1.1 - for pid in ${pids[@]}; do - [ -d /proc/$pid ] && kill -SIGUSR1 $pid >/dev/null 2>&1 - done - pids=() + ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null } cleanup() { + ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null + ip netns del $ns - for pid in ${pids[@]}; do - [ -d /proc/$pid ] && kill -9 $pid >/dev/null 2>&1 - done } ip -Version > /dev/null 2>&1 @@ -87,7 +82,6 @@ echo "a" | \ ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ 0.0.0.0 >/dev/null & sleep 0.1 -pids[0]=$! chk_msk_nr 0 "no msk on netns creation" echo "b" | \ @@ -96,7 +90,6 @@ echo "b" | \ ./mptcp_connect -p 10000 -j -t ${timeout_poll} \ 127.0.0.1 >/dev/null & sleep 0.1 -pids[1]=$! chk_msk_nr 2 "after MPC handshake " chk_msk_remote_key_nr 2 "....chk remote_key" chk_msk_fallback_nr 0 "....chk no fallback" @@ -108,14 +101,12 @@ echo "a" | \ ip netns exec $ns \ ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ 0.0.0.0 >/dev/null & -pids[0]=$! sleep 0.1 echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ ./mptcp_connect -p 10001 -j -t ${timeout_poll} \ 127.0.0.1 >/dev/null & -pids[1]=$! sleep 0.1 chk_msk_fallback_nr 1 "check fallback" flush_pids @@ -127,7 +118,6 @@ for I in `seq 1 $NR_CLIENTS`; do ip netns exec $ns \ ./mptcp_connect -p $((I+10001)) -l -w 10 \ -t ${timeout_poll} 0.0.0.0 >/dev/null & - pids[$((I*2))]=$! done sleep 0.1 @@ -137,7 +127,6 @@ for I in `seq 1 $NR_CLIENTS`; do ip netns exec $ns \ ./mptcp_connect -p $((I+10001)) -w 10 \ -t ${timeout_poll} 127.0.0.1 >/dev/null & - pids[$((I*2 + 1))]=$! done sleep 1.5