[PATCH 2/3] lib: add igt.cocci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 lib/igt.cocci | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 lib/igt.cocci

diff --git a/lib/igt.cocci b/lib/igt.cocci
new file mode 100644
index 000000000000..78ef9a5c0767
--- /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);
-- 
2.0.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux