summaryrefslogtreecommitdiff
path: root/lib/igt.cocci
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-06-13 11:16:28 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-06-13 11:17:22 +0200
commit66b31b6e196bdb869a7bd3e29d86dd9712606601 (patch)
tree91ab4766d611b69c3e70ae30a270a189ca988aae /lib/igt.cocci
parent3448b5ad4b2536c1eca3ecc5060739ea8dbec1e5 (diff)
lib: add igt.cocci
Small start but useful to collect refactorings/simplifications for common igt patterns. Please add more if you stumble over some so that we can occasionally run this to clean up the tests. I haven't figured out yet how to do the assert_cmpint->assert_eq transformation. Run this with spatch --sp-file lib/igt.cocci --in-place tests/*.c Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/igt.cocci')
-rw-r--r--lib/igt.cocci17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/igt.cocci b/lib/igt.cocci
new file mode 100644
index 00000000..78ef9a5c
--- /dev/null
+++ b/lib/igt.cocci
@@ -0,0 +1,17 @@
+@@
+expression Ec;
+expression list[n] Ep;
+@@
+- if (Ec) {
+- fprintf( stderr, Ep );
+- igt_fail(...);
+- }
++ igt_assert_f(Ec, Ep);
+@@
+expression Ec;
+expression list[n] Ep;
+@@
+- if (Ec) {
+- igt_skip(Ep);
+- }
++ igt_skip_on_f(Ec, Ep);