Skip to contentSkip to conversation

scripts: coccicheck: Improve error feedback when coccicheck fails

RFC PATCH Applied Sumera Priyadarsini 2 participants 2 messages Sep 13, 2020 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 scripts: coccicheck: Improve error feedback when coccicheck fails

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.

---
 scripts/coccicheck | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/coccicheck +8 -2
index e04d328210ac..dbeafa21f359 100755
@@ -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"
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 7 lines · Sumera Priyadarsini

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.

Applied, thanks.

julia

Quoted 30 lines
---
 scripts/coccicheck | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/coccicheck +8 -3
index e04d328210ac..dbeafa21f359 100755
@@ -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"
--

2.25.1

Quoted 5 lines

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci