dim: Avoid false positives with BUG detection
PATCH 1/1 dim: Avoid false positives with BUG detection
From: Tvrtko Ursulin <[email protected]>
Makes sure that the diff line adding the BUG is not immediately preceded by the diff line removing the BUG. Or in other words, avoids false positives when existing BUG is edited.
--- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
dim +2 -1
@@ -691,7 +691,8 @@ function shell_checkpatch local cmd=$1 $cmd | scripts/checkpatch.pl -q --strict - || true - if $cmd | grep '^\+.*\WBUG' > /dev/null; then + local bug_lines=$("$cmd" | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-]') + if test "$bug_lines" -eq 1; then warn_or_fail "New BUG macro added" fi $cmd | grep '^\+.*drm_i915_private_t' > /dev/null && echo "WARNING: New drm_i915_private_t added" || true
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 dim: Avoid false positives with BUG detection
From: Tvrtko Ursulin <[email protected]>
Makes sure that the diff line adding the BUG is not immediately preceded by the diff line removing the BUG. Or in other words, avoids false positives when existing BUG is edited.
v2: Sent the incomplete version out...
--- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
dim +2 -1
@@ -691,7 +691,8 @@ function shell_checkpatch local cmd=$1 $cmd | scripts/checkpatch.pl -q --strict - || true - if $cmd | grep '^\+.*\WBUG' > /dev/null; then + local bug_lines=$("$cmd" | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG') + if test "$bug_lines" -eq 1; then warn_or_fail "New BUG macro added" fi $cmd | grep '^\+.*drm_i915_private_t' > /dev/null && echo "WARNING: New drm_i915_private_t added" || true
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 19 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Makes sure that the diff line adding the BUG is not immediately preceded by the diff line removing the BUG. Or in other words, avoids false positives when existing BUG is edited.
v2: Sent the incomplete version out...
Signed-off-by Tvrtko Ursulin <[email protected]>--- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)dim +0
-0
dim function shell_checkpatch · line 698
Quoted 9 lines
dim +2
-1@@ -691,7 +691,8 @@ function shell_checkpatch local cmd=$1 $cmd | scripts/checkpatch.pl -q --strict - || true - if $cmd | grep '^\+.*\WBUG' > /dev/null; then + local bug_lines=$("$cmd" | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG') + if test "$bug_lines" -eq 1; then warn_or_fail "New BUG macro added" fi $cmd | grep '^\+.*drm_i915_private_t' > /dev/null && echo "WARNING: New drm_i915_private_t added" || true
Are we interested in this?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 24 lines · Tvrtko Ursulin
[ text/plain ]
Quoted 20 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Makes sure that the diff line adding the BUG is not immediately preceded by the diff line removing the BUG. Or in other words, avoids false positives when existing BUG is edited.
v2: Sent the incomplete version out...
Signed-off-by Tvrtko Ursulin <[email protected]>--- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)dim +0
-0@@ -691,7 +691,8 @@ function shell_checkpatch local cmd=$1
Quoted 10 lines
dim function shell_checkpatch · line 698
Quoted 8 lines
dim +2
-1$cmd | scripts/checkpatch.pl -q --strict - || true - if $cmd | grep '^\+.*\WBUG' > /dev/null; then + local bug_lines=$("$cmd" | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG') + if test "$bug_lines" -eq 1; then warn_or_fail "New BUG macro added" fi $cmd | grep '^\+.*drm_i915_private_t' > /dev/null && echo "WARNING: New drm_i915_private_t added" || trueAre we interested in this?
Yes. Sorry, I've updated these lines so you'll need to rebase, I'm afraid.
I'd also be fine with comparing the results of $(grep -c '^\+.*\WBUG) and $(grep -c '^\-.*\WBUG) and complaining if there are more +'s than -'s. But your stricter version is fine too.
BR,
Jani.
Quoted 4 lines
Regards,
Tvrtko
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 39 lines · Jani Nikula
Quoted 24 lines · Tvrtko Ursulin
[ text/plain ]
Quoted 20 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Makes sure that the diff line adding the BUG is not immediately preceded by the diff line removing the BUG. Or in other words, avoids false positives when existing BUG is edited.
v2: Sent the incomplete version out...
Signed-off-by Tvrtko Ursulin <[email protected]>--- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)dim +0
-0@@ -691,7 +691,8 @@ function shell_checkpatch local cmd=$1Quoted 10 lines
dim function shell_checkpatch · line 698
Quoted 8 lines
dim +2
-1$cmd | scripts/checkpatch.pl -q --strict - || true - if $cmd | grep '^\+.*\WBUG' > /dev/null; then + local bug_lines=$("$cmd" | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG') + if test "$bug_lines" -eq 1; then warn_or_fail "New BUG macro added" fi $cmd | grep '^\+.*drm_i915_private_t' > /dev/null && echo "WARNING: New drm_i915_private_t added" || trueAre we interested in this?
Yes. Sorry, I've updated these lines so you'll need to rebase, I'm afraid.
Quoted 6 lines
I'd also be fine with comparing the results of $(grep -c '^\+.*\WBUG) and $(grep -c '^\-.*\WBUG) and complaining if there are more +'s than -'s. But your stricter version is fine too.
BR,
Jani.
The version above doesn't really avoid all the issues, though; for example if the edited BUG spans multiple lines, or if the pattern spotted (first added line containing a word beginning with BUG) is in a comment or string, or what's actually happened is that some code has been moved from before an existing BUG() to after or vice-versa, but diff thinks you've deleted the old BUG() and added a new one :(
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx