[v2,1/1] devtools: rename build test verbosity variables

Message ID 20201117103826.585604-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2,1/1] devtools: rename build test verbosity variables |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing warning Testing issues
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Thomas Monjalon Nov. 17, 2020, 10:38 a.m. UTC
  The verbosity was meant to be set with options -v and -vv,
or possibly with the environment variables TEST_MESON_BUILD_VERBOSE
and TEST_MESON_BUILD_VERY_VERBOSE.

It is decided to keep only the options -v and -vv,
so the variables are renamed with lower case, marking them as privates.

The handling of the verbosity level is also moved upper in the script,
closer to other initializations.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: make the variables private to the script
---
 devtools/test-meson-builds.sh | 38 ++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 18 deletions(-)
  

Comments

David Marchand Nov. 18, 2020, 10:56 a.m. UTC | #1
On Tue, Nov 17, 2020 at 11:38 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The verbosity was meant to be set with options -v and -vv,
> or possibly with the environment variables TEST_MESON_BUILD_VERBOSE
> and TEST_MESON_BUILD_VERY_VERBOSE.
>
> It is decided to keep only the options -v and -vv,
> so the variables are renamed with lower case, marking them as privates.
>
> The handling of the verbosity level is also moved upper in the script,
> closer to other initializations.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> v2: make the variables private to the script
> ---
>  devtools/test-meson-builds.sh | 38 ++++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 3ce49368cf..7280b7a93d 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -43,6 +43,24 @@ default_cflags=$CFLAGS
>  default_ldflags=$LDFLAGS
>  default_meson_options=$DPDK_MESON_OPTIONS
>
> +opt_verbose=
> +opt_vverbose=
> +if [ "$1" = "-v" ] ; then
> +       opt_verbose=y
> +elif [ "$1" = "-vv" ] ; then
> +       opt_verbose=y
> +       opt_vverbose=y
> +fi
> +# we can't use plain verbose when we don't have pipefail option so up-level
> +if [ -z "$PIPEFAIL" -a -n "$opt_verbose" ] ; then
> +       echo "# Missing pipefail shell option, changing VERBOSE to VERY_VERBOSE"
> +       opt_vverbose=y
> +fi
> +[ -n "$opt_verbose" ] && exec 8>&1 || exec 8>/dev/null
> +verbose=8
> +[ -n "$opt_vverbose" ] && exec 9>&1 || exec 9>/dev/null
> +veryverbose=9
> +
>  check_cc_flags () # <flag to check> <flag2> ...
>  {
>         echo 'int main(void) { return 0; }' |
> @@ -108,11 +126,11 @@ config () # <dir> <builddir> <meson options>
>  compile () # <builddir>
>  {
>         builddir=$1
> -       if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
> +       if [ -n "$opt_vverbose" ] ; then
>                 # for full output from ninja use "-v"
>                 echo "$ninja_cmd -v -C $builddir"
>                 $ninja_cmd -v -C $builddir
> -       elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
> +       elif [ -n "$opt_verbose" ] ; then
>                 # for keeping the history of short cmds, pipe through cat
>                 echo "$ninja_cmd -C $builddir | cat"
>                 $ninja_cmd -C $builddir | cat
> @@ -180,22 +198,6 @@ build () # <directory> <target compiler | cross file> <meson options>
>         fi
>  }
>
> -if [ "$1" = "-vv" ] ; then
> -       TEST_MESON_BUILD_VERY_VERBOSE=1
> -       TEST_MESON_BUILD_VERBOSE=1
> -elif [ "$1" = "-v" ] ; then
> -       TEST_MESON_BUILD_VERBOSE=1
> -fi
> -# we can't use plain verbose when we don't have pipefail option so up-level
> -if [ -z "$PIPEFAIL" -a -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
> -       echo "# Missing pipefail shell option, changing VERBOSE to VERY_VERBOSE"
> -       TEST_MESON_BUILD_VERY_VERBOSE=1
> -fi
> -[ -n "$TEST_MESON_BUILD_VERBOSE" ] && exec 8>&1 || exec 8>/dev/null
> -verbose=8
> -[ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] && exec 9>&1 || exec 9>/dev/null
> -veryverbose=9
> -
>  # shared and static linked builds with gcc and clang
>  for c in gcc clang ; do
>         command -v $c >/dev/null 2>&1 || continue
> --
> 2.28.0
>

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
David Marchand Nov. 20, 2020, 3:13 p.m. UTC | #2
On Wed, Nov 18, 2020 at 11:56 AM David Marchand
<david.marchand@redhat.com> wrote:
> On Tue, Nov 17, 2020 at 11:38 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > The verbosity was meant to be set with options -v and -vv,
> > or possibly with the environment variables TEST_MESON_BUILD_VERBOSE
> > and TEST_MESON_BUILD_VERY_VERBOSE.
> >
> > It is decided to keep only the options -v and -vv,
> > so the variables are renamed with lower case, marking them as privates.
> >
> > The handling of the verbosity level is also moved upper in the script,
> > closer to other initializations.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 3ce49368cf..7280b7a93d 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -43,6 +43,24 @@  default_cflags=$CFLAGS
 default_ldflags=$LDFLAGS
 default_meson_options=$DPDK_MESON_OPTIONS
 
+opt_verbose=
+opt_vverbose=
+if [ "$1" = "-v" ] ; then
+	opt_verbose=y
+elif [ "$1" = "-vv" ] ; then
+	opt_verbose=y
+	opt_vverbose=y
+fi
+# we can't use plain verbose when we don't have pipefail option so up-level
+if [ -z "$PIPEFAIL" -a -n "$opt_verbose" ] ; then
+	echo "# Missing pipefail shell option, changing VERBOSE to VERY_VERBOSE"
+	opt_vverbose=y
+fi
+[ -n "$opt_verbose" ] && exec 8>&1 || exec 8>/dev/null
+verbose=8
+[ -n "$opt_vverbose" ] && exec 9>&1 || exec 9>/dev/null
+veryverbose=9
+
 check_cc_flags () # <flag to check> <flag2> ...
 {
 	echo 'int main(void) { return 0; }' |
@@ -108,11 +126,11 @@  config () # <dir> <builddir> <meson options>
 compile () # <builddir>
 {
 	builddir=$1
-	if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
+	if [ -n "$opt_vverbose" ] ; then
 		# for full output from ninja use "-v"
 		echo "$ninja_cmd -v -C $builddir"
 		$ninja_cmd -v -C $builddir
-	elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
+	elif [ -n "$opt_verbose" ] ; then
 		# for keeping the history of short cmds, pipe through cat
 		echo "$ninja_cmd -C $builddir | cat"
 		$ninja_cmd -C $builddir | cat
@@ -180,22 +198,6 @@  build () # <directory> <target compiler | cross file> <meson options>
 	fi
 }
 
-if [ "$1" = "-vv" ] ; then
-	TEST_MESON_BUILD_VERY_VERBOSE=1
-	TEST_MESON_BUILD_VERBOSE=1
-elif [ "$1" = "-v" ] ; then
-	TEST_MESON_BUILD_VERBOSE=1
-fi
-# we can't use plain verbose when we don't have pipefail option so up-level
-if [ -z "$PIPEFAIL" -a -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
-	echo "# Missing pipefail shell option, changing VERBOSE to VERY_VERBOSE"
-	TEST_MESON_BUILD_VERY_VERBOSE=1
-fi
-[ -n "$TEST_MESON_BUILD_VERBOSE" ] && exec 8>&1 || exec 8>/dev/null
-verbose=8
-[ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] && exec 9>&1 || exec 9>/dev/null
-veryverbose=9
-
 # shared and static linked builds with gcc and clang
 for c in gcc clang ; do
 	command -v $c >/dev/null 2>&1 || continue