From: Daniel Vetter Subject: [PATCH 2/3] lib: add igt.cocci Date: Fri, 13 Jun 2014 11:18:08 +0200 Message-ID: <1402651089-4027-2-git-send-email-daniel.vetter@ffwll.ch> References: <1402651089-4027-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by gabe.freedesktop.org (Postfix) with ESMTP id A98976E9E6 for ; Fri, 13 Jun 2014 02:18:22 -0700 (PDT) Received: by mail-wi0-f180.google.com with SMTP id hi2so506678wib.7 for ; Fri, 13 Jun 2014 02:18:22 -0700 (PDT) In-Reply-To: <1402651089-4027-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Intel Graphics Development Cc: Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org 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 --- 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