public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jan Kara <jack@suse.cz>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] Make ./new work for non-root user
Date: Tue, 29 May 2018 11:39:14 +1000	[thread overview]
Message-ID: <20180529013914.GI23861@dastard> (raw)
In-Reply-To: <20180524183055.16031-1-jack@suse.cz>

Second go....

On Thu, May 24, 2018 at 08:30:55PM +0200, Jan Kara wrote:
> Currently 'new' script sources common/config which tries to find mkfs
> and fails if not found (which is likely for non-root user). This is
> inconvenient as development usually does not happen as root. In fact the
> vast majority of setup in common/config and common/rc is not necessary
> for 'new'. Split out the necessary bits into new common/config-base and
> use it in 'new'. Cleanup common/rc and common/config now that it's only
> used from 'check'.

FWIW, common/config is also called from setup.

> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  check              | 16 +++++-----------
>  common/config      | 16 ++--------------
>  common/config-base | 21 +++++++++++++++++++++
>  common/rc          | 27 ++-------------------------
>  new                |  2 +-
>  5 files changed, 31 insertions(+), 51 deletions(-)
>  create mode 100644 common/config-base
> 
> diff --git a/check b/check
> index 96198ac4714e..4c6e8285bc16 100755
> --- a/check
> +++ b/check
> @@ -331,10 +331,11 @@ while [ $# -gt 0 ]; do
>  	shift
>  done
>  
> -# we need common/config, source it after processing args, overlay needs FSTYP
> -# set before sourcing common/config
> -if ! . ./common/config; then
> -	echo "$iam: failed to source common/config"
> +# we need common/rc, that also sources common/config. We need to source it
> +# after processing args, overlay needs FSTYP set before sourcing common/config
> +if ! . ./common/rc
> +then
> +	echo "check: failed to source common/rc"
>  	exit 1
>  fi

Can we keep the existing formatting of "if foo ; then", please?

> diff --git a/common/config b/common/config
> index af360cefc804..fa07a6799824 100644
> --- a/common/config
> +++ b/common/config
> @@ -47,6 +47,8 @@
>  #   validity or mountedness.
>  #
>  
> +. common/config-base
> +
>  # all tests should use a common language setting to prevent golden
>  # output mismatches.
>  export LANG=C
> @@ -88,12 +90,6 @@ export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
>  
>  export RECREATE_TEST_DEV=false
>  
> -# $1 = prog to look for
> -set_prog_path()
> -{
> -	type -P $1
> -}

Can we just get rid of set_prog_path() and replace it with direct
calls to $(type -P foo) as an initial patch? This goes away at that
point, because new can then just use a locally coded version....

> --- /dev/null
> +++ b/common/config-base
> @@ -0,0 +1,21 @@
> +##/bin/bash
> +
> +# Valid test names start with 3 digits "NNN":
> +#  "[0-9]\{3\}"
> +# followed by an optional "-":
> +#  "-\?"
> +# followed by an optional combination of alphanumeric and "-" chars:
> +#  "[[:alnum:]-]*"
> +# e.g. 999-the-mark-of-fstests
> +#
> +VALID_TEST_ID="[0-9]\{3\}"
> +VALID_TEST_NAME="$VALID_TEST_ID-\?[[:alnum:]-]*"

This, then, is really the only thing shared between check and new,
right? So perhaps rename the file to common/test_names so it doesn't
get confused with stuff to do with configuration?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2018-05-29  1:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 18:30 [PATCH] Make ./new work for non-root user Jan Kara
2018-05-25  1:30 ` Dave Chinner
2018-05-28  9:37   ` Jan Kara
2018-05-29  1:16     ` Dave Chinner
2018-05-29  1:39 ` Dave Chinner [this message]
2018-05-29  2:01   ` Dave Chinner
2018-05-29 16:36   ` Jan Kara

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=20180529013914.GI23861@dastard \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=jack@suse.cz \
    /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