[18/33] cocci: Split out abort() rules

Submitted by Lyude Paul on June 10, 2019, 3:03 p.m.

Details

Message ID 20190610150321.512-18-lyude@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in IGT - Trybot

Not browsing as part of any series.

Commit Message

Lyude Paul June 10, 2019, 3:03 p.m.
From: Lyude Paul <lyude@redhat.com>

Signed-off-by: Lyude Paul <lyude@redhat.com>
---
 scripts/cocci/igt_no_abort.cocci | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 scripts/cocci/igt_no_abort.cocci

Patch hide | download patch | download mbox

diff --git a/scripts/cocci/igt_no_abort.cocci b/scripts/cocci/igt_no_abort.cocci
new file mode 100644
index 00000000..d927ee35
--- /dev/null
+++ b/scripts/cocci/igt_no_abort.cocci
@@ -0,0 +1,27 @@ 
+// No abort for tests, really. Should only be used for internal library checks
+// in lib/*
+
+virtual report
+virtual patch
+
+@ignore_internal_abort depends on file in "tests/"@
+position p;
+@@
+void __igt_fail_assert(...) { <... abort@p(); ...> }
+
+@depends on patch && file in "tests/"@
+position p != ignore_internal_abort.p;
+@@
+-abort@p();
++igt_fail(IGT_EXIT_FAILURE);
+
+@abort_report depends on report && file in "tests/"@
+position p != ignore_internal_abort.p;
+@@
+abort@p();
+
+@script:python depends on report@
+p << abort_report.p;
+@@
+msg="WARNING: abort() is not allowed, use igt_fail(IGT_EXIT_FAILURE) instead"
+coccilib.report.print_report(p[0], msg)