All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] ssh-stress: Convert to new api
Date: Wed, 16 Jun 2021 17:11:34 +0300	[thread overview]
Message-ID: <fb4b9d45-2cbb-5e5c-fefe-3ca429373a54@bell-sw.com> (raw)
In-Reply-To: <20210616081856.3026223-1-lkml@jv-coder.de>

On 16.06.2021 11:18, Joerg Vehlow wrote:
> From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> 
> Apart from pure conversion:
>  - Use "StrictModes no" in ssh config, to get rid of
>    access permission problems; All part of the path of the
>    authorized_keys file must not be writeable by anyone but the owner.
>    This allows writing the file to the default temp directory
>  - Moved all rhost scripts into ssh-stress.sh
> 
> Changes in v3:
> - use pkill instead of ps | awk | xargs
> - Changed test descriptions slightly
>   * include actual ip version
>   * dropped "for a long time", the tests do not run
>     for a long time with the default config
> - Use netstress -B and ssh -f for background processes
>   This implies using pgrep to get the pids of these processes.
> 
> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> ---
...
>  
> -TCID=ssh-stress
> -TST_TOTAL=3
>  TST_CLEANUP="cleanup"
> +TST_SETUP="setup"
> +TST_TESTFUNC="test"
> +TST_CNT=3
> +TST_NEEDS_ROOT=1
> +TST_NEEDS_TMPDIR=1
> +TST_NEEDS_CMDS="sshd ssh od pkill pgrep"
>  
> -TST_USE_LEGACY_API=1
>  . tst_net.sh
>  
> -# Temporary directory to store sshd setting or ssh key
> -# Note: ssh doesn't work when those directory is under /tmp.
> -TMPDIR="/root"
> +# SSH config file on the remote host
> +RHOST_SSH_CONF=
> +# SSH command to connect from the remote host to the test host
> +RHOST_SSH=
> +# Processes started on the remote host, killed at cleanup
> +RHOST_PIDS=
> +# Netstress process started on the test host, killed at cleanup
> +NETSTRESS_PID=
>  
>  cleanup()
>  {
> +	local pids
> +
>  	# Stop the ssh daemon
> -	test -s sshd.pid && kill $(cat sshd.pid)
> -	pkill 'netstress$'
> -	tst_rmdir
> -	[ "$rtmpdir" ] && tst_rhost_run -c "rm -rf $rtmpdir"
> -	TMPDIR=
> +	[ -s sshd.pid ] && kill $(cat sshd.pid)
> +	[ -n "$NETSTRESS_PID" ] && kill -2 $NETSTRESS_PID >/dev/null 2>&1
> +
> +	tst_rhost_run -c "kill $RHOST_PIDS"  >/dev/null 2>&1
> +
> +	# Kill all remaining ssh processes
> +	tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Perhaps we should check that $RHOST_SSH_CONF is set before running
pkill.


For the rest:
Reviewed-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>

  parent reply	other threads:[~2021-06-16 14:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  8:18 [LTP] [PATCH v3] ssh-stress: Convert to new api Joerg Vehlow
2021-06-16 11:16 ` Petr Vorel
2021-06-16 14:11 ` Alexey Kodanev [this message]
2021-06-16 14:36   ` Petr Vorel
2021-06-17  4:20     ` Joerg Vehlow
2021-06-17  5:14       ` Petr Vorel
2021-06-17  5:18 ` Petr Vorel
2021-06-17  6:56   ` Joerg Vehlow
2021-06-17 12:41     ` Petr Vorel

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=fb4b9d45-2cbb-5e5c-fefe-3ca429373a54@bell-sw.com \
    --to=aleksei.kodanev@bell-sw.com \
    --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.