lib: add some defines to help spatch parsing
PATCH 1/2 lib: add some defines to help spatch parsing
Add simple definitions for various macros to help spatch parse the special igt control flow blocks and other macros correctly.
Signed-off-by Thomas Wood <[email protected]>
--- lib/igt-spatch.h | 41 +++++++++++++++++++++++++++++++++++++++++ lib/igt.cocci | 6 +++--- 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 lib/igt-spatch.h
lib/igt-spatch.h new file +41 -0
@@ -0,0 +1,41 @@ +/* +* Copyright © 2015 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +*/ + +/* various macros to help spatch parsing */ + +#error This header should only be used with spatch + +/* define igt control flow blocks as ordinary code blocks */ +#define igt_fixture +#define igt_subtest (name) +#define igt_subtest_f(f...) +#define igt_fork (child, num_children) +#define igt_fork_helper (proc) + +#define igt_main int main(int argc, char *argv) +#define igt_simple_main int main(int argc, char *argv) + +/* the third parameter of timercmp is an operator, so needs to be defined as a +* macro to be parsed correctly */ +#define timercmp (a, b,CMP ) (1)
lib/igt.cocci +3 -3
@@ -1,7 +1,7 @@ -// Semantic patch for common patters and their replacement by igt infrastructure -// and macros. Please run with +// Semantic patch for common patterns and their replacement by igt +// infrastructure and macros. Please run with // -// spatch --sp-file lib/igt.cocci --in-place tests/*.c +// spatch --sp-file lib/igt.cocci --macro-file lib/igt-spatch.h --in-place tests/*.c // // on your new testcase.
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 tests: apply igt.cocci
Signed-off-by Thomas Wood <[email protected]>
--- tests/core_getclient.c | 2 +- tests/core_getstats.c | 2 +- tests/drm_import_export.c | 2 -- tests/eviction_common.c | 7 ++++--- tests/gem_close_race.c | 2 +- tests/gem_cs_prefetch.c | 2 +- tests/gem_ctx_bad_exec.c | 8 ++++---- tests/gem_ctx_create.c | 4 ++-- tests/gem_ctx_exec.c | 12 +++++++----- tests/gem_exec_bad_domains.c | 14 +++++++------- tests/gem_fence_thrash.c | 38 +++++++++++++++++++++++++------------- tests/gem_fenced_exec_thrash.c | 4 ++-- tests/gem_mmap.c | 4 ++-- tests/gem_readwrite.c | 12 ++++++------ tests/gem_threaded_access_tiled.c | 1 - tests/gem_unfence_active_buffers.c | 2 +- tests/gem_userptr_blits.c | 1 - tests/gem_workarounds.c | 8 ++++---- tests/kms_3d.c | 8 ++++---- tests/kms_flip.c | 29 +++++++++++++++++------------ tests/pm_rc6_residency.c | 8 ++++---- tests/pm_rps.c | 4 ++-- tests/prime_nv_test.c | 2 +- tests/prime_udl.c | 6 +++--- 24 files changed, 99 insertions(+), 83 deletions(-)
tests/core_getclient.c +1 -1
@@ -47,7 +47,7 @@ igt_simple_main*/ client.idx =0 ; ret =ioctl (fd,DRM_IOCTL_GET_CLIENT , &client); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );/* Look for some absurd client index and make sure it's invalid. * The DRM drivers currently always return data, so the user has
tests/core_getstats.c +1 -1
@@ -51,7 +51,7 @@ igt_simple_main fd =drm_open_any (); ret =ioctl (fd,DRM_IOCTL_GET_STATS , &stats); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );close (fd); }
tests/drm_import_export.c +0 -2
@@ -139,14 +139,12 @@ pthread_t test_thread_id4; igt_main { igt_fixture { fd1 =drm_open_any (); -igt_assert (fd1 >=0 ); bufmgr1 =drm_intel_bufmgr_gem_init (fd1,8 *1024 );igt_assert (bufmgr1);drm_intel_bufmgr_gem_enable_reuse (bufmgr1); fd =drm_open_any (); -igt_assert (fd >=0 ); bufmgr =drm_intel_bufmgr_gem_init (fd,8 *1024 );igt_assert (bufmgr);
tests/eviction_common.c +4 -3
@@ -200,18 +200,19 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops, ops->close (fd, bo[n]); out: -write (result[1 ], &ret,sizeof (ret)); +igt_assert_eq (write (result[1 ], &ret,sizeof (ret)), +sizeof (ret)); }igt_waitchildren ();fcntl (result[0 ],F_SETFL ,fcntl (result[0 ],F_GETFL ) |O_NONBLOCK ); -read (result[0 ], &ret,sizeof (ret)); +igt_assert_eq (read (result[0 ], &ret,sizeof (ret)),sizeof (ret));close (result[0 ]);close (result[1 ]); errno = ret; -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); } static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops,
tests/gem_close_race.c +1 -1
@@ -232,7 +232,7 @@ igt_mainsprintf (device,"/dev/dri/card%d" ,drm_get_card ()); fd =open (device,O_RDWR ); -igt_assert (fd !=-1 ); +igt_assert_neq (fd,-1 ); devid =intel_get_drm_devid (fd); has_64bit_relocations =intel_gen (devid) >=8 ;close (fd);
tests/gem_cs_prefetch.c +1 -1
@@ -109,7 +109,7 @@ igt_simple_mainigt_assert (sample_batch_bo); ret =drm_intel_bo_subdata (sample_batch_bo,4096 -sizeof (batch_end),sizeof (batch_end), batch_end); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );/* fill the entire gart with batches and run them */ for (i =0 ; i < count; i++) {
tests/gem_ctx_bad_exec.c +4 -4
@@ -102,15 +102,15 @@ igt_main } igt_subtest("render") -igt_assert (exec (fd, handle,I915_EXEC_RENDER , ctx_id) ==0 ); +igt_assert_eq (exec (fd, handle,I915_EXEC_RENDER , ctx_id),0 ); igt_subtest("bsd") -igt_assert (exec (fd, handle,I915_EXEC_BSD , ctx_id) !=0 ); +igt_assert_neq (exec (fd, handle,I915_EXEC_BSD , ctx_id),0 ); igt_subtest("blt") -igt_assert (exec (fd, handle,I915_EXEC_BLT , ctx_id) !=0 ); +igt_assert_neq (exec (fd, handle,I915_EXEC_BLT , ctx_id),0 );#ifdef I915_EXEC_VEBOX igt_fixture igt_require (gem_has_vebox (fd )); igt_subtest("vebox") -igt_assert (exec (fd, handle,I915_EXEC_VEBOX , ctx_id) !=0 ); +igt_assert_neq (exec (fd, handle,I915_EXEC_VEBOX , ctx_id),0 );#endif }
tests/gem_ctx_create.c +2 -2
@@ -47,7 +47,7 @@ igt_main ret =drmIoctl (fd,DRM_IOCTL_I915_GEM_CONTEXT_CREATE , &create);igt_skip_on (ret !=0 && (errno ==ENODEV || errno ==EINVAL )); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );igt_assert (create.ctx_id !=0 ); }
@@ -57,7 +57,7 @@ igt_main ret =drmIoctl (fd,DRM_IOCTL_I915_GEM_CONTEXT_CREATE , &create);igt_skip_on (ret !=0 && (errno ==ENODEV || errno ==EINVAL )); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );igt_assert (create.ctx_id !=0 ); create.pad =1 ;
tests/gem_ctx_exec.c +7 -5
@@ -175,16 +175,16 @@ igt_main igt_subtest("basic") { ctx_id =gem_context_create (fd); -igt_assert (exec (fd, handle,I915_EXEC_RENDER , ctx_id) ==0 ); +igt_assert_eq (exec (fd, handle,I915_EXEC_RENDER , ctx_id),0 );gem_sync (fd, handle);gem_context_destroy (fd, ctx_id); ctx_id =gem_context_create (fd); -igt_assert (exec (fd, handle,I915_EXEC_RENDER , ctx_id) ==0 ); +igt_assert_eq (exec (fd, handle,I915_EXEC_RENDER , ctx_id),0 );gem_sync (fd, handle);gem_context_destroy (fd, ctx_id); -igt_assert (exec (fd, handle,I915_EXEC_RENDER , ctx_id) <0 ); +igt_assert_lt (exec (fd, handle,I915_EXEC_RENDER , ctx_id),0 );gem_sync (fd, handle); }
@@ -208,8 +208,10 @@ igt_main*/ for (i =0 ; i <20 ; i++) {igt_set_stop_rings (STOP_RING_DEFAULTS ); -igt_assert (exec (fd, handle,I915_EXEC_RENDER ,0 ) ==0 ); -igt_assert (exec (fd, handle,I915_EXEC_RENDER , ctx_id) ==0 ); +igt_assert_eq (exec (fd, handle,I915_EXEC_RENDER ,0 ), +0 ); +igt_assert_eq (exec (fd, handle,I915_EXEC_RENDER , ctx_id), +0 );gem_sync (fd, handle); }
tests/gem_exec_bad_domains.c +7 -7
@@ -170,13 +170,13 @@ igt_mainOUT_BATCH (0 );OUT_RELOC (tmp,I915_GEM_DOMAIN_CPU ,0 ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () == -EINVAL ); +igt_assert_eq (run_batch (), -EINVAL );BEGIN_BATCH (2 ,1 );OUT_BATCH (0 );OUT_RELOC (tmp,I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () == -EINVAL ); +igt_assert_eq (run_batch (), -EINVAL ); } igt_subtest("gtt-domain") {
@@ -184,13 +184,13 @@ igt_mainOUT_BATCH (0 );OUT_RELOC (tmp,I915_GEM_DOMAIN_GTT ,0 ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () == -EINVAL ); +igt_assert_eq (run_batch (), -EINVAL );BEGIN_BATCH (2 ,1 );OUT_BATCH (0 );OUT_RELOC (tmp,I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () == -EINVAL ); +igt_assert_eq (run_batch (), -EINVAL ); }/* Note: Older kernels disallow this. Punt on the skip check though
@@ -204,7 +204,7 @@ igt_mainOUT_RELOC (tmp,I915_GEM_DOMAIN_INSTRUCTION ,I915_GEM_DOMAIN_INSTRUCTION ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () ==0 ); +igt_assert_eq (run_batch (),0 ); }igt_subtest ("double-write-domain" )
@@ -216,14 +216,14 @@ igt_mainOUT_RELOC (tmp, ~(I915_GEM_GPU_DOMAINS |I915_GEM_DOMAIN_GTT |I915_GEM_DOMAIN_CPU ),0 ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () == -EINVAL ); +igt_assert_eq (run_batch (), -EINVAL );BEGIN_BATCH (2 ,1 );OUT_BATCH (0 );OUT_RELOC (tmp,I915_GEM_DOMAIN_GTT <<1 ,I915_GEM_DOMAIN_GTT <<1 ,0 );ADVANCE_BATCH (); -igt_assert (run_batch () == -EINVAL ); +igt_assert_eq (run_batch (), -EINVAL ); } igt_fixture {
tests/gem_fence_thrash.c +25 -13
@@ -203,31 +203,43 @@ igt_mainigt_skip_on_simulation (); igt_subtest("bo-write-verify-none") -igt_assert (run_test (0 , bo_write_verify,I915_TILING_NONE ,80 ) ==0 ); +igt_assert_eq (run_test (0 , bo_write_verify,I915_TILING_NONE ,80 ), +0 ); igt_subtest("bo-write-verify-x") -igt_assert (run_test (0 , bo_write_verify,I915_TILING_X ,80 ) ==0 ); +igt_assert_eq (run_test (0 , bo_write_verify,I915_TILING_X ,80 ), +0 ); igt_subtest("bo-write-verify-y") -igt_assert (run_test (0 , bo_write_verify,I915_TILING_Y ,80 ) ==0 ); +igt_assert_eq (run_test (0 , bo_write_verify,I915_TILING_Y ,80 ), +0 ); igt_subtest("bo-write-verify-threaded-none") -igt_assert (run_test (5 , bo_write_verify,I915_TILING_NONE ,2 ) ==0 ); +igt_assert_eq (run_test (5 , bo_write_verify,I915_TILING_NONE ,2 ), +0 ); igt_subtest("bo-write-verify-threaded-x") { -igt_assert (run_test (2 , bo_write_verify,I915_TILING_X ,2 ) ==0 ); -igt_assert (run_test (5 , bo_write_verify,I915_TILING_X ,2 ) ==0 ); -igt_assert (run_test (10 , bo_write_verify,I915_TILING_X ,2 ) ==0 ); -igt_assert (run_test (20 , bo_write_verify,I915_TILING_X ,2 ) ==0 ); +igt_assert_eq (run_test (2 , bo_write_verify,I915_TILING_X ,2 ), +0 ); +igt_assert_eq (run_test (5 , bo_write_verify,I915_TILING_X ,2 ), +0 ); +igt_assert_eq (run_test (10 , bo_write_verify,I915_TILING_X ,2 ), +0 ); +igt_assert_eq (run_test (20 , bo_write_verify,I915_TILING_X ,2 ), +0 ); } igt_subtest("bo-write-verify-threaded-y") { -igt_assert (run_test (2 , bo_write_verify,I915_TILING_Y ,2 ) ==0 ); -igt_assert (run_test (5 , bo_write_verify,I915_TILING_Y ,2 ) ==0 ); -igt_assert (run_test (10 , bo_write_verify,I915_TILING_Y ,2 ) ==0 ); -igt_assert (run_test (20 , bo_write_verify,I915_TILING_Y ,2 ) ==0 ); +igt_assert_eq (run_test (2 , bo_write_verify,I915_TILING_Y ,2 ), +0 ); +igt_assert_eq (run_test (5 , bo_write_verify,I915_TILING_Y ,2 ), +0 ); +igt_assert_eq (run_test (10 , bo_write_verify,I915_TILING_Y ,2 ), +0 ); +igt_assert_eq (run_test (20 , bo_write_verify,I915_TILING_Y ,2 ), +0 ); } igt_subtest("bo-copy") -igt_assert (run_test (1 , bo_copy,I915_TILING_X ,1 ) ==0 ); +igt_assert_eq (run_test (1 , bo_copy,I915_TILING_X ,1 ),0 ); }
tests/gem_fenced_exec_thrash.c +2 -2
@@ -227,10 +227,10 @@ igt_main igt_fixture { fd =drm_open_any (); num_fences =gem_available_fences (fd); -igt_assert (num_fences >4 ); +igt_assert_lt (4 , num_fences); devid =intel_get_drm_devid (fd); -igt_assert (num_fences <=MAX_FENCES ); +igt_assert_lte (num_fences,MAX_FENCES ); }igt_subtest ("2-spare-fences" )
tests/gem_mmap.c +2 -2
@@ -68,7 +68,7 @@ igt_main arg.offset =0 ; arg.size =OBJECT_SIZE ; ret =ioctl (fd,DRM_IOCTL_I915_GEM_MMAP , &arg); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); addr = (uint8_t *)(uintptr_t )arg.addr_ptr;igt_info ("Testing contents of newly created object.\n" );
@@ -91,7 +91,7 @@ igt_main } igt_subtest("short-mmap") { -igt_assert (OBJECT_SIZE >4096 ); +igt_assert_lt (4096 ,OBJECT_SIZE ); handle =gem_create (fd,OBJECT_SIZE ); addr =gem_mmap__cpu (fd, handle,0 ,4096 ,PROT_WRITE );memset (addr,0 ,4096 );
tests/gem_readwrite.c +6 -6
@@ -93,7 +93,7 @@ igt_main igt_subtest("new-obj") {igt_info ("Testing contents of newly created object.\n" ); ret =do_read (fd, handle, buf,0 ,OBJECT_SIZE ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );memset (&expected,0 ,sizeof (expected));igt_assert (memcmp (expected, buf,sizeof (expected)) ==0 ); }
@@ -110,23 +110,23 @@ igt_mainmemset (buf +1024 ,0x01 ,1024 );memset (expected +1024 ,0x01 ,1024 ); ret =do_write (fd, handle, buf,0 ,OBJECT_SIZE ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =do_read (fd, handle, buf,0 ,OBJECT_SIZE ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );igt_assert (memcmp (buf, expected,sizeof (buf)) ==0 );igt_info ("Testing partial write of buffer\n" );memset (buf +4096 ,0x02 ,1024 );memset (expected +4096 ,0x02 ,1024 ); ret =do_write (fd, handle, buf +4096 ,4096 ,1024 ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =do_read (fd, handle, buf,0 ,OBJECT_SIZE ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );igt_assert (memcmp (buf, expected,sizeof (buf)) ==0 );igt_info ("Testing partial read of buffer\n" ); ret =do_read (fd, handle, buf,512 ,1024 ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );igt_assert (memcmp (buf, expected +512 ,1024 ) ==0 ); }
tests/gem_threaded_access_tiled.c +0 -1
@@ -99,7 +99,6 @@ igt_simple_mainigt_skip_on_simulation (); fd =drm_open_any (); -igt_assert (fd >=0 ); bufmgr =drm_intel_bufmgr_gem_init (fd,4096 );igt_assert (bufmgr);
tests/gem_unfence_active_buffers.c +1 -1
@@ -117,7 +117,7 @@ igt_simple_main test_bo =drm_intel_bo_alloc (bufmgr,"test_bo" ,TEST_SIZE ,4096 ); ret =drm_intel_bo_set_tiling (test_bo, &tiling,TEST_STRIDE ); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );drm_intel_bo_disable_reuse (test_bo);
tests/gem_userptr_blits.c +0 -1
@@ -1322,7 +1322,6 @@ int main(int argc, char **argv)int ret; fd =drm_open_any (); -igt_assert (fd >=0 ); ret =has_userptr (fd); igt_skip_on_f(ret == 0, "No userptr support - %s (%d)\n",
tests/gem_workarounds.c +4 -4
@@ -195,20 +195,20 @@ igt_main batch =intel_batchbuffer_alloc (bufmgr, devid); fd =igt_debugfs_open ("i915_wa_registers" ,O_RDONLY ); -igt_assert (fd >=0 ); +igt_assert_lte (0 , fd); file =fdopen (fd,"r" );igt_assert (file >0 ); ret =getline (&line, &line_size, file); -igt_assert (ret >0 ); +igt_assert_lt (0 , ret);sscanf (line,"Workarounds applied: %d" , &num_wa_regs);if (IS_BROADWELL (devid) ||IS_CHERRYVIEW (devid)) -igt_assert (num_wa_regs >0 ); +igt_assert_lt (0 , num_wa_regs);else -igt_assert (num_wa_regs >=0 ); +igt_assert_lte (0 , num_wa_regs); wa_regs =malloc (num_wa_regs *sizeof (*wa_regs));
tests/kms_3d.c +4 -4
@@ -61,8 +61,8 @@ igt_simple_main &length);kmstest_force_edid (drm_fd, connector, edid, length); -if (!kmstest_force_connector (drm_fd, connector,FORCE_CONNECTOR_ON )) -igt_skip ("Could not force connector on\n" ); +igt_skip_on_f (!kmstest_force_connector (drm_fd, connector,FORCE_CONNECTOR_ON ), +"Could not force connector on\n" ); connector_id = connector->connector_id;
@@ -74,7 +74,7 @@ igt_simple_main mode_count++; } -igt_assert (mode_count ==15 ); +igt_assert_eq (mode_count,15 );/* set 3D modes */ igt_info ("Testing:\n" );
@@ -109,7 +109,7 @@ igt_simple_main &connector->connector_id,1 , &connector->modes[i]); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); }kmstest_force_connector (drm_fd, connector,FORCE_CONNECTOR_UNSPECIFIED );
tests/kms_flip.c +17 -12
@@ -916,19 +916,20 @@ static unsigned int run_test_step(struct test_output *o)if (o->flags &TEST_ENOENT ) {/* hope that fb 0xfffffff0 does not exist */ -igt_assert (do_page_flip (o,0xfffffff0 , false) == -ENOENT ); -igt_assert (set_mode (o,0xfffffff0 ,0 ,0 ) == -ENOENT ); +igt_assert_eq (do_page_flip (o,0xfffffff0 , false), -ENOENT ); +igt_assert_eq (set_mode (o,0xfffffff0 ,0 ,0 ), -ENOENT ); }if (do_flip && (o->flags &TEST_EINVAL ) && o->flip_state.count >0 ) -igt_assert (do_page_flip (o, new_fb_id, true) == expected_einval); +igt_assert_eq (do_page_flip (o, new_fb_id, true), + expected_einval);if (o->flags &TEST_FB_BAD_TILING ) new_fb_id = o->fb_ids[o->current_fb_id];if (do_vblank && (o->flags &TEST_EINVAL ) && o->vblank_state.count >0 ) -igt_assert (do_wait_for_vblank (o, o->pipe, target_seq, &vbl_reply) - == -EINVAL ); +igt_assert_eq (do_wait_for_vblank (o, o->pipe, target_seq, &vbl_reply), + -EINVAL );if (o->flags &TEST_VBLANK_RACE ) {spawn_vblank_wait_thread (o);
@@ -943,7 +944,8 @@ static unsigned int run_test_step(struct test_output *o)set_dpms (o,DRM_MODE_DPMS_OFF );if (o->flags &TEST_MODESET ) -igt_assert (set_mode (o, o->fb_ids[o->current_fb_id],0 ,0 ) ==0 ); +igt_assert_eq (set_mode (o, o->fb_ids[o->current_fb_id],0 ,0 ), +0 );if (o->flags &TEST_DPMS )set_dpms (o,DRM_MODE_DPMS_ON );
@@ -954,7 +956,8 @@ static unsigned int run_test_step(struct test_output *o)/* modeset/DPMS is done, vblank wait should work normally now */ start =gettime_us (); -igt_assert (__wait_for_vblank (TEST_VBLANK_BLOCK , o->pipe,2 ,0 , &reply) ==0 ); +igt_assert_eq (__wait_for_vblank (TEST_VBLANK_BLOCK , o->pipe,2 ,0 , &reply), +0 ); end =gettime_us ();/* * we waited for two vblanks, so verify that
@@ -977,7 +980,8 @@ static unsigned int run_test_step(struct test_output *o)/* try to make sure we can issue two flips during the same frame */ if (do_flip && (o->flags &TEST_EBUSY )) {struct vblank_reply reply; -igt_assert (__wait_for_vblank (TEST_VBLANK_BLOCK , o->pipe,1 ,0 , &reply) ==0 ); +igt_assert_eq (__wait_for_vblank (TEST_VBLANK_BLOCK , o->pipe,1 ,0 , &reply), +0 ); }if (do_flip)
@@ -998,7 +1002,7 @@ static unsigned int run_test_step(struct test_output *o) }if (do_flip && (o->flags &TEST_EBUSY )) -igt_assert (do_page_flip (o, new_fb_id, true) == -EBUSY ); +igt_assert_eq (do_page_flip (o, new_fb_id, true), -EBUSY );if (do_flip && (o->flags &TEST_RMFB ))recreate_fb (o);
@@ -1038,11 +1042,12 @@ static unsigned int run_test_step(struct test_output *o)igt_system_suspend_autoresume ();if (do_vblank && (o->flags &TEST_EINVAL ) && o->vblank_state.count >0 ) -igt_assert (do_wait_for_vblank (o, o->pipe, target_seq, &vbl_reply) - == -EINVAL ); +igt_assert_eq (do_wait_for_vblank (o, o->pipe, target_seq, &vbl_reply), + -EINVAL );if (do_flip && (o->flags &TEST_EINVAL ) && !(o->flags &TEST_FB_BAD_TILING )) -igt_assert (do_page_flip (o, new_fb_id, true) == expected_einval); +igt_assert_eq (do_page_flip (o, new_fb_id, true), + expected_einval);if (hang)unhang_gpu (drm_fd, hang);
tests/pm_rc6_residency.c +4 -4
@@ -161,13 +161,13 @@ igt_mainif (IS_VALLEYVIEW (devid) ||IS_CHERRYVIEW (devid))residency_accuracy (media,"media_rc6" ); igt_subtest("rc6p-accuracy") { -if (!IS_GEN6 (devid) && !IS_IVYBRIDGE (devid)) -igt_skip ("This platform doesn't support RC6p\n" ); +igt_skip_on_f (!IS_GEN6 (devid) && !IS_IVYBRIDGE (devid), +"This platform doesn't support RC6p\n" );residency_accuracy (rc6p,"rc6p" ); } igt_subtest("rc6pp-accuracy") { -if (!IS_GEN6 (devid) && !IS_IVYBRIDGE (devid)) -igt_skip ("This platform doesn't support RC6pp\n" ); +igt_skip_on_f (!IS_GEN6 (devid) && !IS_IVYBRIDGE (devid), +"This platform doesn't support RC6pp\n" );residency_accuracy (rc6pp,"rc6pp" ); } }
tests/pm_rps.c +2 -2
@@ -673,13 +673,13 @@ igt_mainint val =-1 ;char *path; ret =asprintf (&path, sysfs_base_path, device, junk->name); -igt_assert (ret !=-1 ); +igt_assert_neq (ret,-1 ); junk->filp =fopen (path, junk->mode);igt_require (junk->filp);setbuf (junk->filp,NULL ); val =readval (junk->filp); -igt_assert (val >=0 ); +igt_assert_lte (0 , val); junk++; }while (junk->name !=NULL );
tests/prime_nv_test.c +1 -1
@@ -358,7 +358,7 @@ static void test_i915_blt_fill_nv_read(void)igt_main { igt_fixture { -igt_assert (find_and_open_devices () ==0 ); +igt_assert_eq (find_and_open_devices (),0 );igt_require (nouveau_fd !=-1 );igt_require (intel_fd !=-1 );
tests/prime_udl.c +3 -3
@@ -153,7 +153,7 @@ igt_simple_main {igt_skip_on_simulation (); -igt_assert (find_and_open_devices () >=0 ); +igt_assert_lte (0 ,find_and_open_devices ());igt_skip_on (udl_fd ==-1 );igt_skip_on (intel_fd ==-1 );
@@ -167,9 +167,9 @@ igt_simple_main intel_batch =intel_batchbuffer_alloc (bufmgr, devid);/* create an object on the i915 */ -igt_assert (test1 () ==0 ); +igt_assert_eq (test1 (),0 ); -igt_assert (test2 () ==0 ); +igt_assert_eq (test2 (),0 );intel_batchbuffer_free (intel_batch);
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/2] tests: apply igt.cocci
Quoted 8 lines · Thomas Wood
tests/eviction_common.c +0
-0@@ -200,18 +200,19 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops, ops->close (fd, bo[n]); out:
tests/eviction_common.c static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops, · line 210
Quoted 10 lines
tests/eviction_common.c +3
-2-write (result[1 ], &ret,sizeof (ret)); +igt_assert_eq (write (result[1 ], &ret,sizeof (ret)), +sizeof (ret)); }igt_waitchildren ();fcntl (result[0 ],F_SETFL ,fcntl (result[0 ],F_GETFL ) |O_NONBLOCK ); -read (result[0 ], &ret,sizeof (ret)); +igt_assert_eq (read (result[0 ], &ret,sizeof (ret)),sizeof (ret));
No. This read() may return -1 (with ret then being == -1 due to the earlier initialisation) if the child is killed by a sigbus....
Hah, and now I realise my overcomplication, if we just get the status back via igt_waitchildren passing the result back via a pipe is silly. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx