Skip to content

Commit

Permalink
Coccinelle: make DEBUG_FILE option more useful
Browse files Browse the repository at this point in the history
Make coccicheck checked for the existence of DEBUG_FILE on each semantic
patch, and bailed if it already existed.  This meant that DEBUG_FILE was
useless for checking more than one semantic patch at a time.  Now the check
is moved to the start of make coccicheck, and the 2> is changed to a 2>> to
append to the file on each semantic patch.  Furthermore, the spatch command
that is run for each semantic patch is also added to the DEBUG_FILE, to
make clear what each stdout trace corresponds to.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
  • Loading branch information
Julia Lawall authored and Masahiro Yamada committed Nov 14, 2017
1 parent a44b866 commit 9ed07ad
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/coccicheck
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,8 @@ run_cmd_parmap() {
if [ $VERBOSE -ne 0 ] ; then
echo "Running ($NPROC in parallel): $@"
fi
if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
if [ -f $DEBUG_FILE ]; then
echo "Debug file $DEBUG_FILE exists, bailing"
exit
fi
else
DEBUG_FILE="/dev/null"
fi
$@ 2>$DEBUG_FILE
echo $@ >>$DEBUG_FILE
$@ 2>>$DEBUG_FILE
if [[ $? -ne 0 ]]; then
echo "coccicheck failed"
exit $?
Expand Down Expand Up @@ -246,6 +239,15 @@ coccinelle () {

}

if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
if [ -f $DEBUG_FILE ]; then
echo "Debug file $DEBUG_FILE exists, bailing"
exit
fi
else
DEBUG_FILE="/dev/null"
fi

if [ "$COCCI" = "" ] ; then
for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
coccinelle $f
Expand Down

0 comments on commit 9ed07ad

Please sign in to comment.