[PATCH i-g-t 20/33] cocci: Split out assert() rules

Lyude lyude at redhat.com
Mon Jun 10 15:03:08 UTC 2019


From: Lyude Paul <lyude at redhat.com>

Signed-off-by: Lyude Paul <lyude at redhat.com>
---
 scripts/cocci/igt.cocci           | 17 -----------------
 scripts/cocci/igt_no_assert.cocci | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 17 deletions(-)
 create mode 100644 scripts/cocci/igt_no_assert.cocci

diff --git a/scripts/cocci/igt.cocci b/scripts/cocci/igt.cocci
index 4628e3ab..84df03ca 100644
--- a/scripts/cocci/igt.cocci
+++ b/scripts/cocci/igt.cocci
@@ -31,23 +31,6 @@ def warn_cmp_macro(p, type_prefix, op, e1, e2):
     msg = 'WARNING: igt_assert_%s%s(%s, %s) should be used instead' % args
     coccilib.report.print_report(p[0], msg)
 
-// Tests and test libraries really shouldn't use plain assert!
- at depends on report && file in "tests/"@
-expression E;
-@@
-- assert(E);
-+ igt_assert(E);
-
- at no_assert_report depends on report && file in "tests/"@
-position p;
-@@
-assert at p(...);
-
- at script:python depends on report@
-p << no_assert_report.p;
-@@
-coccilib.report.print_report(p[0], "ERROR: plain assert() calls are not allowed")
-
 // Replace open-coded igt_swap()
 @depends on patch@
 type T;
diff --git a/scripts/cocci/igt_no_assert.cocci b/scripts/cocci/igt_no_assert.cocci
new file mode 100644
index 00000000..6f4f876a
--- /dev/null
+++ b/scripts/cocci/igt_no_assert.cocci
@@ -0,0 +1,20 @@
+// Tests and test libraries really shouldn't use plain assert!
+
+virtual patch
+virtual report
+
+ at depends on report && file in "tests/"@
+expression E;
+@@
+- assert(E);
++ igt_assert(E);
+
+ at no_assert_report depends on report && file in "tests/"@
+position p;
+@@
+assert at p(...);
+
+ at script:python depends on report@
+p << no_assert_report.p;
+@@
+coccilib.report.print_report(p[0], "ERROR: plain assert() calls are not allowed")
-- 
2.21.0



More information about the Intel-gfx-trybot mailing list