Skip to contentSkip to conversation

coccicheck: Allow the user to give a V= (verbose) argument

PATCH In review Bernd Schubert 3 participants 5 messages Jan 29, 2013 – Feb 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 coccicheck: Allow the user to give a V= (verbose) argument

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.

CC Julia Lawall <[email protected]>
CC Nicolas Palix <[email protected]>
CC cocci at systeme.lip6.fr
CC Michal Marek <[email protected]>
---
 Documentation/coccinelle.txt |    4 ++++
 scripts/coccicheck           |   11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
Documentation/coccinelle.txt +4 -0
index cf44eb6..dffa2d6 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/coccicheck +10 -1
index 1a49d1c..f8f15a2 100755
@@ -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/||"`
 
maintainer Acked-by on v1 1/2
#1 lore raw
Quoted 9 lines · Bernd Schubert

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.

CC Julia Lawall <[email protected]>
CC Nicolas Palix <[email protected]>
Quoted 52 lines
CC cocci at systeme.lip6.fr
CC Michal Marek <[email protected]>
---
 Documentation/coccinelle.txt |    4 ++++
 scripts/coccicheck           |   11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
Documentation/coccinelle.txt +4 -0
index cf44eb6..dffa2d6 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/coccicheck +10 -1
index 1a49d1c..f8f15a2 100755
@@ -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/||"`
 
Signature · 1 line
Nicolas Palix
#2 lore raw

PATCH 2/2 coccicheck: Allow to show the executed command line

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.

CC Julia Lawall <[email protected]>
CC Nicolas Palix <[email protected]>
CC cocci at systeme.lip6.fr
CC Michal Marek <[email protected]>
---
 scripts/coccicheck |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)
scripts/coccicheck +21 -7
index f8f15a2..85d3189 100755
@@ -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
 
 }
maintainer Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2 2/2] coccicheck: Allow to show the executed command line

Quoted 8 lines · Bernd Schubert

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.

CC Julia Lawall <[email protected]>
CC Nicolas Palix <[email protected]>
Quoted 55 lines
CC cocci at systeme.lip6.fr
CC Michal Marek <[email protected]>
---
 scripts/coccicheck |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)
scripts/coccicheck +21 -7
index f8f15a2..85d3189 100755
@@ -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
 
 }
Signature · 1 line
Nicolas Palix
#4 lore raw
In reply to Bernd Schubert
Quoted 4 lines · Bernd Schubert

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.

Quoted 4 lines · Bernd Schubert

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