public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument
@ 2013-01-29 16:03 ` Bernd Schubert
  2013-02-01  9:05   ` Nicolas Palix
  2013-02-22 10:41   ` Michal Marek
  0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schubert @ 2013-01-29 16:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michal Marek, Julia Lawall, Nicolas Palix, cocci

Do not run with verbosity on/off depending on the ONLINE variable,
which gets set with C=1 or C=2, but allow the user to set the
verbosity using kernel default make V= paramemter.
Verbosity is off by default now.


Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
CC: Julia Lawall <Julia.Lawall@lip6.fr>
CC: Nicolas Palix <nicolas.palix@imag.fr>
CC: cocci@systeme.lip6.fr
CC: Michal Marek <mmarek@suse.cz>
---
 Documentation/coccinelle.txt |    4 ++++
 scripts/coccicheck           |   11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt
index cf44eb6..dffa2d6 100644
--- a/Documentation/coccinelle.txt
+++ b/Documentation/coccinelle.txt
@@ -87,6 +87,10 @@ As any static code analyzer, Coccinelle produces false
 positives. Thus, reports must be carefully checked, and patches
 reviewed.
 
+To enable verbose messages set the V= variable, for example:
+
+   make coccicheck MODE=report V=1
+
 
  Using Coccinelle with a single semantic patch
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 1a49d1c..f8f15a2 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -2,6 +2,15 @@
 
 SPATCH="`which ${SPATCH:=spatch}`"
 
+# The verbosity may be set by the environmental parameter V=
+# as for example with 'make V=1 coccicheck'
+
+if [ -n "$V" -a "$V" != "0" ]; then
+	VERBOSE=1
+else
+	VERBOSE=0
+fi
+
 if [ "$C" = "1" -o "$C" = "2" ]; then
     ONLINE=1
 
@@ -55,7 +64,7 @@ coccinelle () {
 #
 #    $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
 
-    if [ "$ONLINE" = "0" ] ; then
+    if [ $VERBOSE -ne 0 ] ; then
 
 	FILE=`echo $COCCI | sed "s|$srctree/||"`
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2 2/2] coccicheck: Allow to show the executed command line
@ 2013-01-29 16:03 Bernd Schubert
  2013-01-29 16:03 ` [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument Bernd Schubert
  2013-02-01  9:07 ` [PATCH 2 2/2] coccicheck: Allow to show the executed command line Nicolas Palix
  0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schubert @ 2013-01-29 16:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michal Marek, Julia Lawall, Nicolas Palix, cocci

On my system one of the tests failed with
"Fatal error: exception Failure("No OCaml compiler found! Install either ocamlopt or ocamlopt.opt")".

Investigating such issues is easier if the executed command line is being shown.

Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
CC: Julia Lawall <Julia.Lawall@lip6.fr>
CC: Nicolas Palix <nicolas.palix@imag.fr>
CC: cocci@systeme.lip6.fr
CC: Michal Marek <mmarek@suse.cz>
---
 scripts/coccicheck |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index f8f15a2..85d3189 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -55,6 +55,14 @@ if [ "$ONLINE" = "0" ] ; then
     echo ''
 fi
 
+run_cmd() {
+	if [ $VERBOSE -ne 0 ] ; then
+		echo "Running: $@"
+	fi
+	eval $@
+}
+
+
 coccinelle () {
     COCCI="$1"
 
@@ -100,15 +108,21 @@ coccinelle () {
     fi
 
     if [ "$MODE" = "chain" ] ; then
-	$SPATCH -D patch   $FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
-	$SPATCH -D report  $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
-	$SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
-	$SPATCH -D org     $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
+	run_cmd $SPATCH -D patch   \
+		$FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
+	run_cmd $SPATCH -D report  \
+		$FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
+	run_cmd $SPATCH -D context \
+		$FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
+	run_cmd $SPATCH -D org     \
+		$FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
     elif [ "$MODE" = "rep+ctxt" ] ; then
-	$SPATCH -D report  $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \
-	$SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
+	run_cmd $SPATCH -D report  \
+		$FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \
+	run_cmd $SPATCH -D context \
+		$FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
     else
-	$SPATCH -D $MODE   $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
+	run_cmd $SPATCH -D $MODE   $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
     fi
 
 }


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument
  2013-01-29 16:03 ` [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument Bernd Schubert
@ 2013-02-01  9:05   ` Nicolas Palix
  2013-02-22 10:41   ` Michal Marek
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Palix @ 2013-02-01  9:05 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: linux-kernel, Michal Marek, Julia Lawall, cocci

On Tue, Jan 29, 2013 at 5:03 PM, Bernd Schubert
<bernd.schubert@itwm.fraunhofer.de> wrote:
> Do not run with verbosity on/off depending on the ONLINE variable,
> which gets set with C=1 or C=2, but allow the user to set the
> verbosity using kernel default make V= paramemter.
> Verbosity is off by default now.
>
>
> Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
> CC: Julia Lawall <Julia.Lawall@lip6.fr>
> CC: Nicolas Palix <nicolas.palix@imag.fr>
Acked-by: Nicolas Palix <nicolas.palix@imag.fr>

> CC: cocci@systeme.lip6.fr
> CC: Michal Marek <mmarek@suse.cz>
> ---
>  Documentation/coccinelle.txt |    4 ++++
>  scripts/coccicheck           |   11 ++++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt
> index cf44eb6..dffa2d6 100644
> --- a/Documentation/coccinelle.txt
> +++ b/Documentation/coccinelle.txt
> @@ -87,6 +87,10 @@ As any static code analyzer, Coccinelle produces false
>  positives. Thus, reports must be carefully checked, and patches
>  reviewed.
>
> +To enable verbose messages set the V= variable, for example:
> +
> +   make coccicheck MODE=report V=1
> +
>
>   Using Coccinelle with a single semantic patch
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 1a49d1c..f8f15a2 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -2,6 +2,15 @@
>
>  SPATCH="`which ${SPATCH:=spatch}`"
>
> +# The verbosity may be set by the environmental parameter V=
> +# as for example with 'make V=1 coccicheck'
> +
> +if [ -n "$V" -a "$V" != "0" ]; then
> +       VERBOSE=1
> +else
> +       VERBOSE=0
> +fi
> +
>  if [ "$C" = "1" -o "$C" = "2" ]; then
>      ONLINE=1
>
> @@ -55,7 +64,7 @@ coccinelle () {
>  #
>  #    $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
>
> -    if [ "$ONLINE" = "0" ] ; then
> +    if [ $VERBOSE -ne 0 ] ; then
>
>         FILE=`echo $COCCI | sed "s|$srctree/||"`
>
>



-- 
Nicolas Palix

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2 2/2] coccicheck: Allow to show the executed command line
  2013-01-29 16:03 [PATCH 2 2/2] coccicheck: Allow to show the executed command line Bernd Schubert
  2013-01-29 16:03 ` [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument Bernd Schubert
@ 2013-02-01  9:07 ` Nicolas Palix
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Palix @ 2013-02-01  9:07 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: linux-kernel, Michal Marek, Julia Lawall, cocci

On Tue, Jan 29, 2013 at 5:03 PM, Bernd Schubert
<bernd.schubert@itwm.fraunhofer.de> wrote:
> On my system one of the tests failed with
> "Fatal error: exception Failure("No OCaml compiler found! Install either ocamlopt or ocamlopt.opt")".
>
> Investigating such issues is easier if the executed command line is being shown.
>
> Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
> CC: Julia Lawall <Julia.Lawall@lip6.fr>
> CC: Nicolas Palix <nicolas.palix@imag.fr>

Acked-by: Nicolas Palix <nicolas.palix@imag.fr>

> CC: cocci@systeme.lip6.fr
> CC: Michal Marek <mmarek@suse.cz>
> ---
>  scripts/coccicheck |   28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index f8f15a2..85d3189 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -55,6 +55,14 @@ if [ "$ONLINE" = "0" ] ; then
>      echo ''
>  fi
>
> +run_cmd() {
> +       if [ $VERBOSE -ne 0 ] ; then
> +               echo "Running: $@"
> +       fi
> +       eval $@
> +}
> +
> +
>  coccinelle () {
>      COCCI="$1"
>
> @@ -100,15 +108,21 @@ coccinelle () {
>      fi
>
>      if [ "$MODE" = "chain" ] ; then
> -       $SPATCH -D patch   $FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
> -       $SPATCH -D report  $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
> -       $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
> -       $SPATCH -D org     $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
> +       run_cmd $SPATCH -D patch   \
> +               $FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
> +       run_cmd $SPATCH -D report  \
> +               $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
> +       run_cmd $SPATCH -D context \
> +               $FLAGS -sp_file $COCCI $OPT $OPTIONS               || \
> +       run_cmd $SPATCH -D org     \
> +               $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
>      elif [ "$MODE" = "rep+ctxt" ] ; then
> -       $SPATCH -D report  $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \
> -       $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
> +       run_cmd $SPATCH -D report  \
> +               $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \
> +       run_cmd $SPATCH -D context \
> +               $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
>      else
> -       $SPATCH -D $MODE   $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
> +       run_cmd $SPATCH -D $MODE   $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
>      fi
>
>  }
>



-- 
Nicolas Palix

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument
  2013-01-29 16:03 ` [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument Bernd Schubert
  2013-02-01  9:05   ` Nicolas Palix
@ 2013-02-22 10:41   ` Michal Marek
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Marek @ 2013-02-22 10:41 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: linux-kernel, Julia Lawall, Nicolas Palix, cocci

On Tue, Jan 29, 2013 at 05:03:37PM +0100, Bernd Schubert wrote:
> Do not run with verbosity on/off depending on the ONLINE variable,
> which gets set with C=1 or C=2, but allow the user to set the
> verbosity using kernel default make V= paramemter.
> Verbosity is off by default now.

On Tue, Jan 29, 2013 at 05:03:42PM +0100, Bernd Schubert wrote:
> On my system one of the tests failed with
> "Fatal error: exception Failure("No OCaml compiler found! Install either ocamlopt or ocamlopt.opt")".
> 
> Investigating such issues is easier if the executed command line is being shown.

I applied both patches to kbuild.git#misc, thanks.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-22 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29 16:03 [PATCH 2 2/2] coccicheck: Allow to show the executed command line Bernd Schubert
2013-01-29 16:03 ` [PATCH 2 1/2] coccicheck: Allow the user to give a V= (verbose) argument Bernd Schubert
2013-02-01  9:05   ` Nicolas Palix
2013-02-22 10:41   ` Michal Marek
2013-02-01  9:07 ` [PATCH 2 2/2] coccicheck: Allow to show the executed command line Nicolas Palix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox