From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] ssh-stress: Convert to new api
Date: Wed, 16 Jun 2021 08:42:33 +0200 [thread overview]
Message-ID: <YMmdWRGTB0MrtdxJ@pevik> (raw)
In-Reply-To: <fae3c38e-ae64-05ac-264b-f11cae8c1c55@jv-coder.de>
Hi Joerg, Alexey,
> Hi Alexey,
> > > + # Kill all remaining ssh processes
> > > + tst_rhost_run -c "ps auwx | \
> > > + awk '\$0 ~ \"$RHOST_SSH_CONF\" && \$11 == \"ssh\" {print \$2}' | \
> > > + xargs -r -t kill -- >/dev/null 2>&1"
> > > }
> > What about using pkill -f instead of ps|awk|kill?
> I guess I did not use pkill for two reasons:
> 1. I wanted to be sure to really only kill ssh processes with
> $RHOST_SSH_CONF in their arguments
> 2. I did not want to use an extra tool, that is not necessarily available on
> all systems.
> The first one could be solved by using "pkill -f "^ssh .*$RHOST_SSH_CONF", I
> guess. This still leaves a problem with unescaped regexp meta characters in
> RHOST_SSH_CONF, but my awk solution has the same problem. But I think this
> is only theoretical, it is extremely unlikely, that any regexp meta
> character apart from "." is used in RHOST_SSH_CONF and the dot will unlikely
> produce false positives.
> The second point can be ignored. pkill is used in many locations throughout
> ltp already. It should probably be added as a runtime dependency.
+1. pkill as runtime dependency is probably better than xargs dependency.
BTW I thought in the past to write tst_kill command, either as a shell
implementation (which would look on pkill, killall and if none of them
it'd used ps and grep) or (better) just to implement it in C.
> > > - tst_rhost_run -s -c "ssh-stress02-rmt.sh $TST_IPVER $(tst_ipaddr) \
> > > - $rconfig $CONNECTION_TOTAL $NS_DURATION"
> > > + tst_res TINFO "Verify the ssh connectivity over IPv4/IPv6 is not broken after creating many ssh sessions"
> > ^
> > The message may have indicated the exact IP version with $TST_IPVER
> Yeah right, that was just copy and pasted from the original test
> description.
+ nit: "Verify SSH connectivity ..."
Kind regards,
Petr
prev parent reply other threads:[~2021-06-16 6:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 9:43 [LTP] [PATCH v2] ssh-stress: Convert to new api Joerg Vehlow
2021-06-14 22:12 ` Petr Vorel
2021-06-15 14:28 ` Alexey Kodanev
2021-06-16 6:12 ` Petr Vorel
2021-06-16 6:16 ` Joerg Vehlow
2021-06-16 6:42 ` Petr Vorel [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=YMmdWRGTB0MrtdxJ@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.