mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-09 00:46:17 +00:00
And also pimp the spatch file itself with usage hints. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
77 lines
1.1 KiB
Plaintext
77 lines
1.1 KiB
Plaintext
// Semantic patch for common patters and their replacement by igt infrastructure
|
|
// and macros. Please run with
|
|
//
|
|
// spatch --sp-file lib/igt.cocci --in-place tests/*.c
|
|
//
|
|
// on your new testcase.
|
|
|
|
|
|
// Replace open-coded augmented igt_assert/skip/require with macro versions
|
|
@@
|
|
expression Ec;
|
|
expression list[n] Ep;
|
|
@@
|
|
- if (Ec) {
|
|
(
|
|
- igt_warn( Ep );
|
|
|
|
|
- igt_info( Ep );
|
|
|
|
|
- igt_debug( Ep );
|
|
)
|
|
- igt_fail(...);
|
|
- }
|
|
+ igt_fail_on_f(Ec, Ep);
|
|
@@
|
|
expression Ec;
|
|
@@
|
|
- if (Ec) {
|
|
- igt_fail(...);
|
|
- }
|
|
+ igt_fail_on(Ec);
|
|
@@
|
|
expression Ec;
|
|
expression list[n] Ep;
|
|
@@
|
|
- if (Ec) {
|
|
- igt_skip(Ep);
|
|
- }
|
|
+ igt_skip_on_f(Ec, Ep);
|
|
@@
|
|
expression Ec;
|
|
expression list[n] Ep;
|
|
@@
|
|
- if (Ec) {
|
|
- igt_warn(Ep);
|
|
- }
|
|
+ igt_warn_on_f(Ec, Ep);
|
|
|
|
// Enforce use of logging functions
|
|
@@
|
|
expression list[n] Ep;
|
|
@@
|
|
-fprintf(stderr, Ep);
|
|
+igt_warn(Ep);
|
|
@@
|
|
expression E;
|
|
@@
|
|
-perror(E);
|
|
+igt_warn(E);
|
|
@@
|
|
expression list[n] Ep;
|
|
@@
|
|
-fprintf(stdout, Ep);
|
|
+igt_info(Ep);
|
|
@@
|
|
expression list[n] Ep;
|
|
@@
|
|
-printf(Ep);
|
|
+igt_info(Ep);
|
|
|
|
// No abort for tests, really. Should only be used for internal library checks
|
|
// in lib/*
|
|
@@
|
|
@@
|
|
-abort();
|
|
+igt_fail(1);
|