Skip to content

Commit

Permalink
scripts: coccicheck: Improve error feedback when coccicheck fails
Browse files Browse the repository at this point in the history
Currently, coccicheck fails with only the message "coccicheck failed"
and the error code for the failure. To obtain the error logs,
one needs to specify a debug file using the DEBUG_FILE option.

Modify coccicheck to display error logs when it crashes unless
DEBUG_FILE is set, in which case, the error logs are stored in
the specified debug file.

Signed-off-by: Sumera Priyadarsini <[email protected]>
Signed-off-by: Julia Lawall <[email protected]>
  • Loading branch information
Sylfrena authored and JuliaLawall committed Sep 13, 2020
1 parent 6519a5a commit a19d135
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/coccicheck
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,14 @@ run_cmd_parmap() {
if [ $VERBOSE -ne 0 ] ; then
echo "Running ($NPROC in parallel): $@"
fi
echo $@ >>$DEBUG_FILE
$@ 2>>$DEBUG_FILE
if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
echo $@>>$DEBUG_FILE
$@ 2>>$DEBUG_FILE
else
echo $@
$@ 2>&1
fi

err=$?
if [[ $err -ne 0 ]]; then
echo "coccicheck failed"
Expand Down

0 comments on commit a19d135

Please sign in to comment.