Assert tests, atomic, multi-blob
v7 cover Assert tests, atomic, multi-blob
Hi,
Following on from the previous few series, most of which have been merged ...
Add some self-tests for igt-assert_*() to make sure they do the right thing, including for fds. This is a bit gross, but does work.
Do a Cocci run through the tree. This doesn't actually pick up a lot of the changes for some reason, but I have not a clue why.
Add a new subtest to core_prop_blob which creates multiple blobs per connection, exercising a kernel bug.
Resubmit the atomic tests, with only minor changes this time.
Cheers,
Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v7 1/4 lib/tests: Add igt_assert_*() self-tests
Make sure our igt_assert variants are doing something that looks vaguely like the right thing.
--- lib/tests/Makefile.sources | 1 + lib/tests/igt_simple.c | 173 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 lib/tests/igt_simple.c
lib/tests/Makefile.sources +1 -0
@@ -10,6 +10,7 @@ check_PROGRAMS = \ igt_timeout \ igt_invalid_subtest_name \ igt_segfault \ + igt_simple \ $(NULL) check_SCRIPTS = \
lib/tests/igt_simple.c new file +173 -0
173 lines not on this page · raw message
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH igt v7 1/4] lib/tests: Add igt_assert_*() self-tests
Quoted 178 lines · Daniel Stone
Make sure our
igt_assertvariants are doing something that looks vaguely like the right thing.Signed-off-by Daniel Stone <[email protected]>--- lib/tests/Makefile.sources | 1 + lib/tests/igt_simple.c | 173 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 lib/tests/igt_simple.clib/tests/Makefile.sources +1
-0@@ -10,6 +10,7 @@ check_PROGRAMS = \ igt_timeout \ igt_invalid_subtest_name \ igt_segfault \ + igt_simple \ $(NULL) check_SCRIPTS = \lib/tests/igt_simple.c new file +150
-0@@ -0,0 +1,173 @@ +/* +* 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. +* +*/ + +#include <assert.h> +#include <errno.h> +#include <float.h> +#include <limits.h> +#include <math.h> +#include <signal.h> +#include <stdint.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> + +#include "igt_core.h" + +/* +* We need to hide assert from the cocci igt test refactor spatch. +* +* IMPORTANT: Test infrastructure tests are the only valid places where using +* assert is allowed. +*/ +#define internal_assert assert + +char test[] ="test" ; +char *argv_run[] = { test }; +void (*test_to_run)(void ) =NULL ; + +/* +* A really tedious way of making sure we execute every negative test, and that +* they all really fail. +*/ +#define CHECK_NEG (x) { \ + igt_subtest_f("XFAIL_simple_%d", __LINE__) { \ + (*exec_before)++; \ + x; \ + raise(SIGBUS); \ + } \ + exec_total++; \ +} + +static int do_fork (void ) +{ +int pid, status; +int argc; + +switch (pid =fork ()) { +case -1 : +internal_assert (0 ); +case 0 : + argc =1 ; +igt_simple_init (argc, argv_run); +test_to_run (); +igt_exit (); +default : +while (waitpid (pid, &status,0 ) ==-1 && + errno ==EINTR ) + ; + +if (WIFSIGNALED (status)) +return WTERMSIG (status) +128 ; + +return WEXITSTATUS (status); + } +} + +static void test_cmpint_negative (void ) +{ +int *exec_before =calloc (1 ,sizeof (int )); +int exec_total =0 ; + +CHECK_NEG (igt_assert_eq (INT_MIN ,INT_MAX )); + +CHECK_NEG (igt_assert_eq_u32 (0xfffffffeUL ,0xffffffffUL )); + +CHECK_NEG (igt_assert_eq_u64 (0xfffeffffffffffffULL ,0xffffffffffffffffULL )); +CHECK_NEG (igt_assert_eq_u64 (0xfffffffeffffffffULL ,0xffffffffffffffffULL )); +CHECK_NEG (igt_assert_eq_u64 (0xfffffffffffeffffULL ,0xffffffffffffffffULL )); + +CHECK_NEG (igt_assert_eq_double (0.0 ,DBL_MAX )); +CHECK_NEG (igt_assert_eq_double (DBL_MAX ,nexttoward (DBL_MAX ,0.0 ))); + +if (*exec_before != exec_total) +raise (SIGSEGV ); +} + +static void test_cmpint (void ) +{ +igt_assert_eq (0 ,0 ); +igt_assert_eq (INT_MAX ,INT_MAX ); +igt_assert_eq (INT_MAX ,INT_MAX ); +igt_assert_neq (INT_MIN ,INT_MAX ); + +igt_assert_eq_u32 (0 ,0 ); +igt_assert_eq_u32 (0xffffffffUL ,0xffffffffUL ); +igt_assert_neq_u32 (0xfffffffeUL ,0xffffffffUL ); + +igt_assert_eq_u64 (0 ,0 ); +igt_assert_eq_u64 (0xffffffffffffffffULL ,0xffffffffffffffffULL ); +igt_assert_neq_u64 (0xfffffffffffffffeULL ,0xffffffffffffffffULL ); + +igt_assert_eq_double (0.0 ,0.0 ); +igt_assert_eq_double (DBL_MAX ,DBL_MAX ); +igt_assert_neq_double (0.0 ,DBL_MAX ); +} + +static void test_fd_negative (void ) +{ +int *exec_before =calloc (1 ,sizeof (int )); +int exec_total =0 ; + +CHECK_NEG (igt_assert_fd (-1 )); +CHECK_NEG (igt_assert_fd (INT_MIN )); + +if (*exec_before != exec_total) +raise (SIGSEGV ); +} + +static void test_fd (void ) +{ +igt_assert_fd (0 ); +igt_assert_fd (1 ); +igt_assert_fd (INT_MAX ); +} + +igt_main +{ +int ret;
lib/tests/igt_simple.c line 160
Quoted 10 lines
lib/tests/igt_simple.c new file +10
-0+ + igt_subtest("igt_cmpint") +test_cmpint (); + +/* +* The awkward subtest dance here is because we really want to use +* subtests in our negative tests, to ensure we actually execute all +* the subtests. But we can't begin a subtest within a subtest, and +* we inherit the state from the parent, so ... +*/
That kind of awkwardness is why most other library tests set up the subtest machinery manually. Well it works ;-)
Quoted 20 lines
lib/tests/igt_simple.c new file +13
-0+ test_to_run = test_cmpint_negative; + ret =do_fork (); + igt_subtest("igt_cmpint_negative") +internal_assert (ret ==IGT_EXIT_FAILURE ); + + igt_subtest("igt_assert_fd") +test_fd (); + + test_to_run = test_fd_negative; + ret =do_fork (); + igt_subtest("igt_assert_fd_negative") +internal_assert (ret ==IGT_EXIT_FAILURE ); +}Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v7 2/4 tests: Run igt.cocci
In reply to Daniel Stone--- tests/drm_import_export.c | 2 +- tests/gem_bad_reloc.c | 8 ++---- tests/gem_concurrent_all.c | 6 ++-- tests/gem_ctx_exec.c | 9 ++---- tests/gem_ctx_param_basic.c | 4 +-- tests/gem_mmap_gtt.c | 8 ++---- tests/gem_pin.c | 4 +-- tests/gem_pwrite_pread.c | 12 ++++---- tests/gem_reg_read.c | 2 +- tests/gem_tiled_swapping.c | 4 +-- tests/gem_tiled_wb.c | 2 +- tests/gem_tiled_wc.c | 2 +- tests/kms_draw_crc.c | 6 ++-- tests/kms_frontbuffer_tracking.c | 60 ++++++++++++++++++++-------------------- tests/kms_panel_fitting.c | 2 +- tests/kms_pipe_b_c_ivb.c | 30 ++++++++++---------- tests/kms_plane_scaling.c | 2 +- tests/kms_rotation_crc.c | 4 +-- tests/pm_backlight.c | 20 +++++++------- 19 files changed, 88 insertions(+), 99 deletions(-)
tests/drm_import_export.c +1 -1
@@ -212,7 +212,7 @@ static void test_import_close_race(void)else {pthread_mutex_lock (&t_data.mutex);igt_assert_eq (drm_intel_bo_gem_export_to_prime (bo, &(t_data.prime_fd)),0 ); -igt_assert (t_data.prime_fd !=-1 ); +igt_assert_neq (t_data.prime_fd,-1 );pthread_mutex_unlock (&t_data.mutex); }
tests/gem_bad_reloc.c +2 -6
@@ -107,9 +107,7 @@ static int negative_reloc(int fd, unsigned flags) execbuf.buffer_count =2 ; execbuf.batch_len =8 ; -do_or_die (drmIoctl (fd, -DRM_IOCTL_I915_GEM_EXECBUFFER2 , - &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_close (fd, gem_exec[1 ].handle);igt_info ("Found offset %lld for 4k batch\n" , (long long )gem_exec[0 ].offset);
@@ -136,9 +134,7 @@ static int negative_reloc(int fd, unsigned flags) execbuf.buffer_count =1 ; execbuf.flags = flags &USE_LUT ; -do_or_die (drmIoctl (fd, -DRM_IOCTL_I915_GEM_EXECBUFFER2 , - &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);igt_info ("Batch is now at offset %lld\n" , (long long )gem_exec[0 ].offset);
tests/gem_concurrent_all.c +3 -3
@@ -298,8 +298,8 @@ gpu_set_bo(drm_intel_bo *bo, uint32_t val, int width, int height) gem_pwrite.offset =0 ; gem_pwrite.size = execbuf.batch_len; gem_pwrite.data_ptr = (uintptr_t )buf; -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite)); -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);drmIoctl (fd,DRM_IOCTL_GEM_CLOSE , &create.handle); }
@@ -868,7 +868,7 @@ static void bit17_require(void) arg.handle =gem_create (fd,4096 );gem_set_tiling (fd, arg.handle,I915_TILING_X ,512 ); -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_GET_TILING2 , &arg)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_GET_TILING2 , &arg);gem_close (fd, arg.handle);igt_require (arg.phys_swizzle_mode == arg.swizzle_mode); }
tests/gem_ctx_exec.c +3 -6
@@ -116,8 +116,7 @@ static void big_exec(int fd, uint32_t handle, int ring) execbuf.buffer_count =1 ;i915_execbuffer2_set_context_id (execbuf, ctx_id1); -igt_assert (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , - &execbuf) ==0 ); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);for (i =0 ; i < num_buffers; i++) {uint32_t tmp_handle =gem_create (fd,4096 );
@@ -141,12 +140,10 @@ static void big_exec(int fd, uint32_t handle, int ring) i - 1, num_buffers);/* double check that it works */ -igt_assert (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , - &execbuf) ==0 ); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);i915_execbuffer2_set_context_id (execbuf, ctx_id2); -igt_assert (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , - &execbuf) ==0 ); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_sync (fd, handle); }
tests/gem_ctx_param_basic.c +2 -2
@@ -40,9 +40,9 @@ int32_t ctx;#define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)#define TEST_SUCCESS (ioc) \ - igt_assert(drmIoctl(fd, (ioc), &ctx_param) == 0); + do_ioctl(fd, (ioc), &ctx_param);#define TEST_FAIL (ioc, exp_errno) \ - igt_assert(drmIoctl(fd, (ioc), &ctx_param) < 0 && errno == exp_errno); + do_ioctl_err(fd, (ioc), &ctx_param, exp_errno); igt_main {
tests/gem_mmap_gtt.c +2 -6
@@ -90,9 +90,7 @@ test_access(int fd)/* Check that fd1 can mmap. */ mmap_arg.handle = handle; -igt_assert (drmIoctl (fd, -DRM_IOCTL_I915_GEM_MMAP_GTT , - &mmap_arg) ==0 ); +do_ioctl (fd,DRM_IOCTL_I915_GEM_MMAP_GTT , &mmap_arg);igt_assert (mmap64 (0 ,OBJECT_SIZE ,PROT_READ |PROT_WRITE ,MAP_SHARED , fd, mmap_arg.offset));
@@ -122,9 +120,7 @@ test_short(int fd) mmap_arg.handle =gem_create (fd,OBJECT_SIZE );igt_assert (mmap_arg.handle); -igt_assert (drmIoctl (fd, -DRM_IOCTL_I915_GEM_MMAP_GTT , - &mmap_arg) ==0 ); +do_ioctl (fd,DRM_IOCTL_I915_GEM_MMAP_GTT , &mmap_arg);for (pages =1 ; pages <=OBJECT_SIZE /PAGE_SIZE ; pages <<=1 ) {uint8_t *r, *w;
tests/gem_pin.c +2 -2
@@ -80,7 +80,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)i915_execbuffer2_set_context_id (execbuf,0 ); execbuf.rsvd2 =0 ; -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);igt_assert (gem_exec[0 ].offset == offset); }
@@ -172,7 +172,7 @@ static void make_busy(int fd, uint32_t handle)gem_write (fd, handle,0 , batch, execbuf.batch_len);for (count =0 ; count <10 ; count++) -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_close (fd, tmp); }
tests/gem_pwrite_pread.c +6 -6
@@ -100,7 +100,7 @@ static void copy(int fd, uint32_t src, uint32_t dst, void *buf, int len, int loowhile (loops--) {gem_write (fd, src,0 , buf, len); -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_read (fd, dst,0 , buf, len); }
@@ -120,7 +120,7 @@ static void as_gtt_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);memcpy (src_ptr, buf, len); -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_set_domain (fd, dst,I915_GEM_DOMAIN_GTT ,0 );memcpy (buf, dst_ptr, len);
@@ -145,7 +145,7 @@ static void as_cpu_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);memcpy (src_ptr, buf, len); -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_set_domain (fd, dst,I915_GEM_DOMAIN_CPU ,0 );memcpy (buf, dst_ptr, len);
@@ -167,7 +167,7 @@ static void test_copy(int fd, uint32_t src, uint32_t dst, uint32_t *buf, int lengem_write (fd, src,0 , buf, len);memset (buf,0 , len); -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_read (fd, dst,0 , buf, len);gem_close (fd, exec[2 ].handle);
@@ -189,7 +189,7 @@ static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len)for (i =0 ; i < len/4 ; i++) src_ptr[i] = i; -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_close (fd, exec[2 ].handle);gem_set_domain (fd, dst,I915_GEM_DOMAIN_GTT ,0 );
@@ -213,7 +213,7 @@ static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len)for (i =0 ; i < len/4 ; i++) src_ptr[i] = i; -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf);gem_close (fd, exec[2 ].handle);gem_set_domain (fd, dst,I915_GEM_DOMAIN_CPU ,0 );
tests/gem_reg_read.c +1 -1
@@ -65,7 +65,7 @@ static bool check_kernel_x86_64(void)struct utsname uts; ret =uname (&uts); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );if (!strcmp (uts.machine,"x86_64" ))return true;
tests/gem_tiled_swapping.c +2 -2
@@ -157,8 +157,8 @@ static void thread_fini(struct thread *t)static void check_memory_layout (void ) { -if (igt_debugfs_search ("i915_swizzle_info" ,"L-shaped" )) -igt_skip ("L-shaped memory configuration detected\n" ); +igt_skip_on_f (igt_debugfs_search ("i915_swizzle_info" ,"L-shaped" ), +"L-shaped memory configuration detected\n" );igt_debug ("normal memory configuration detected, continuing\n" ); }
tests/gem_tiled_wb.c +1 -1
@@ -123,7 +123,7 @@ get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)memset (&arg,0 ,sizeof (arg)); arg.handle = handle; -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_GET_TILING2 , &arg)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_GET_TILING2 , &arg);igt_require (arg.phys_swizzle_mode == arg.swizzle_mode); *tiling = arg.tiling_mode;
tests/gem_tiled_wc.c +1 -1
@@ -118,7 +118,7 @@ get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)memset (&arg,0 ,sizeof (arg)); arg.handle = handle; -do_or_die (drmIoctl (fd,DRM_IOCTL_I915_GEM_GET_TILING2 , &arg)); +do_ioctl (fd,DRM_IOCTL_I915_GEM_GET_TILING2 , &arg);igt_require (arg.phys_swizzle_mode == arg.swizzle_mode); *tiling = arg.tiling_mode;
tests/kms_draw_crc.c +3 -3
@@ -138,7 +138,7 @@ static void get_method_crc(enum igt_draw_method method, uint32_t drm_format, rc =drmModeSetCrtc (drm_fd, ms.crtc_id, fb.fb_id,0 ,0 , &ms.connector_id,1 , ms.mode); -igt_assert (rc ==0 ); +igt_assert_eq (rc,0 );igt_pipe_crc_collect_crc (pipe_crc, crc);
@@ -181,7 +181,7 @@ static void get_fill_crc(uint64_t tiling, igt_crc_t *crc) rc =drmModeSetCrtc (drm_fd, ms.crtc_id, fb.fb_id,0 ,0 , &ms.connector_id,1 , ms.mode); -igt_assert (rc ==0 ); +igt_assert_eq (rc,0 );igt_pipe_crc_collect_crc (pipe_crc, crc);
@@ -207,7 +207,7 @@ static void fill_fb_subtest(void) rc =drmModeSetCrtc (drm_fd, ms.crtc_id, fb.fb_id,0 ,0 , &ms.connector_id,1 , ms.mode); -igt_assert (rc ==0 ); +igt_assert_eq (rc,0 );igt_pipe_crc_collect_crc (pipe_crc, &base_crc);
tests/kms_frontbuffer_tracking.c +30 -30
223 lines not on this page · raw message
tests/kms_panel_fitting.c +1 -1
@@ -122,7 +122,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, &output->id,1 , mode); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); }else {igt_display_commit2 (display, s); }
tests/kms_pipe_b_c_ivb.c +15 -15
@@ -94,7 +94,7 @@ set_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output) mode->hdisplay, mode->vdisplay,DRM_FORMAT_XRGB8888 ,I915_TILING_NONE , 1.0, 1.0, 1.0, &fb); -igt_assert (fb_id >=0 ); +igt_assert_lte (0 , fb_id);igt_plane_set_fb (primary, &fb);return igt_display_try_commit2 (&data->display,COMMIT_LEGACY );
@@ -150,12 +150,12 @@ test_dpms(data_t *data) kmstest_pipe_name(PIPE_C), igt_output_name(output2)); ret =set_big_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );kmstest_set_connector_dpms (data->drm_fd, output1->config.connector,DRM_MODE_DPMS_OFF ); ret =set_big_mode_on_pipe (data,PIPE_C , output2); -igt_assert (ret !=0 ); +igt_assert_neq (ret,0 ); } static void
@@ -172,13 +172,13 @@ test_lane_reduction(data_t *data) kmstest_pipe_name(PIPE_C), igt_output_name(output2)); ret =set_big_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =set_normal_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =set_normal_mode_on_pipe (data,PIPE_C , output2); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); } static void
@@ -195,16 +195,16 @@ test_disable_pipe_B(data_t *data) kmstest_pipe_name(PIPE_C), igt_output_name(output2)); ret =set_big_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =disable_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =set_normal_mode_on_pipe (data,PIPE_C , output2); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =set_normal_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); } static void
@@ -221,13 +221,13 @@ test_from_C_to_B_with_3_lanes(data_t *data) kmstest_pipe_name(PIPE_C), igt_output_name(output2)); ret =set_normal_mode_on_pipe (data,PIPE_C , output2); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =disable_pipe (data,PIPE_C , output2); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =set_big_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); } static void
@@ -244,10 +244,10 @@ test_fail_enable_pipe_C_while_B_has_3_lanes(data_t *data) kmstest_pipe_name(PIPE_C), igt_output_name(output2)); ret =set_big_mode_on_pipe (data,PIPE_B , output1); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); ret =set_normal_mode_on_pipe (data,PIPE_C , output2); -igt_assert (ret !=0 ); +igt_assert_neq (ret,0 ); }static data_t data;
tests/kms_plane_scaling.c +1 -1
@@ -124,7 +124,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, &output->id,1 , mode); -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 ); }else {igt_display_commit2 (display, s); }
tests/kms_rotation_crc.c +2 -2
@@ -268,9 +268,9 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)igt_plane_set_rotation (plane, data->rotation); ret =igt_display_try_commit2 (display, commit);if (data->override_fmt || data->override_tiling) { -igt_assert (ret == -EINVAL ); +igt_assert_eq (ret, -EINVAL ); }else { -igt_assert (ret ==0 ); +igt_assert_eq (ret,0 );igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output); igt_assert_crc_equal(&data->ref_crc,
tests/pm_backlight.c +10 -10
@@ -95,12 +95,12 @@ static void test_and_verify(int val) {int result; -igt_assert (backlight_write (val,"brightness" ) ==0 ); -igt_assert (backlight_read (&result,"brightness" ) ==0 ); +igt_assert_eq (backlight_write (val,"brightness" ),0 ); +igt_assert_eq (backlight_read (&result,"brightness" ),0 );/* Check that the exact value sticks */ -igt_assert (result == val); +igt_assert_eq (result, val); -igt_assert (backlight_read (&result,"actual_brightness" ) ==0 ); +igt_assert_eq (backlight_read (&result,"actual_brightness" ),0 );/* Some rounding may happen depending on hw. Just check that it's close enough. */ igt_assert (result <= val + val *TOLERANCE /100 && result >= val - val *TOLERANCE /100 ); }
@@ -118,15 +118,15 @@ static void test_bad_brightness(int max)/* First write some sane value */ backlight_write (max /2 ,"brightness" );/* Writing invalid values should fail and not change the value */ -igt_assert (backlight_write (-1 ,"brightness" ) <0 ); +igt_assert_lt (backlight_write (-1 ,"brightness" ),0 );backlight_read (&val,"brightness" ); -igt_assert (val == max /2 ); -igt_assert (backlight_write (max +1 ,"brightness" ) <0 ); +igt_assert_eq (val, max /2 ); +igt_assert_lt (backlight_write (max +1 ,"brightness" ),0 );backlight_read (&val,"brightness" ); -igt_assert (val == max /2 ); -igt_assert (backlight_write (INT_MAX ,"brightness" ) <0 ); +igt_assert_eq (val, max /2 ); +igt_assert_lt (backlight_write (INT_MAX ,"brightness" ),0 );backlight_read (&val,"brightness" ); -igt_assert (val == max /2 ); +igt_assert_eq (val, max /2 ); }static void test_fade (int max)
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v7 3/4 tests/core_prop_blob: Add multiple blobs per connection
In reply to Daniel StoneThis should hit the bug fixed in:
XXX FIXME INSERT SEANPAUL COMMIT CITE
which was introduced with the initial blob support in:
commit e2f5d2ea479b9b2619965d43db70939589afe43a
Author: Daniel Stone <[email protected]>
Date: Fri May 22 13:34:51 2015 +0100
drm/mode: Add user blob-creation ioctl
Add an ioctl which allows users to create blob properties from supplied data. Currently this only supports modes, creating a drm_display_mode from the userspace drm_mode_modeinfo.
v2: Removed size/type checks.
Rebased on new patches to allow error propagation from create_blob, as well as avoiding double-allocation.
--- tests/core_prop_blob.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
tests/core_prop_blob.c +40 -0
@@ -208,6 +208,43 @@ test_lifetime(int fd) }static void +test_multiple (int fd) +{ +uint32_t prop_ids[5 ]; +int fd2; +int i; + + fd2 =drm_open_driver (DRIVER_ANY ); +igt_assert_fd (fd2); + +/* Ensure destroying multiple properties explicitly works as needed. */ +for (i =0 ; i <ARRAY_SIZE (prop_ids); i++) { + prop_ids[i] =create_prop (fd2); +igt_assert_eq (validate_prop (fd, prop_ids[i]),0 ); +igt_assert_eq (validate_prop (fd2, prop_ids[i]),0 ); + } +for (i =0 ; i <ARRAY_SIZE (prop_ids); i++) { +igt_assert_eq (destroy_prop (fd2, prop_ids[i]),0 ); +igt_assert_eq (validate_prop (fd2, prop_ids[i]),ENOENT ); + } +igt_assert_eq (close (fd2),0 ); + + fd2 =drm_open_driver (DRIVER_ANY ); +igt_assert_fd (fd2); + +/* Ensure that multiple properties get cleaned up on fd close. */ +for (i =0 ; i <ARRAY_SIZE (prop_ids); i++) { + prop_ids[i] =create_prop (fd2); +igt_assert_eq (validate_prop (fd, prop_ids[i]),0 ); +igt_assert_eq (validate_prop (fd2, prop_ids[i]),0 ); + } +igt_assert_eq (close (fd2),0 ); + +for (i =0 ; i <ARRAY_SIZE (prop_ids); i++) +igt_assert_eq (validate_prop (fd, prop_ids[i]),ENOENT ); +} + +static void test_core (int fd) {uint32_t prop_id;
@@ -256,6 +293,9 @@ igt_main igt_subtest("blob-prop-lifetime")test_lifetime (fd); + igt_subtest("blob-multiple") +test_multiple (fd); +igt_fixture close (fd ); }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v7 4/4 kms_atomic: Add basic atomic modesetting tests
In reply to Daniel StoneAdd tests for KMS atomic modesetting, to exercise the basic interface and test failure/corner cases. Should ensure coherency between the legacy and atomic interfaces.
v2: New patch.
v3: Disable connector checking for now, as it was causing GPU hangs on
newer kernels.
v4: Rebase.
v5: Use do_ioctl or do_ioctl_err consistently. Use igt_assert_*()
helper macros rather than igt_assert() directly.
Move assertions into helper/check functions. Define atomic commit helper.
v6: Use do_ioctl_err, and define macros to move errors to
actual callsite, rather than helper functions.
v7: Fix RELAX_MODE thinko and refresh CRTC state in find_crtc.
--- configure.ac | 2 +- tests/.gitignore | 1 + tests/Makefile.sources | 1 + tests/kms_atomic.c | 1345 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1348 insertions(+), 1 deletion(-) create mode 100644 tests/kms_atomic.c
configure.ac +1 -1
@@ -85,7 +85,7 @@ if test "x$GCC" = "xyes"; then fi AC_SUBST(ASSEMBLER_WARN_CFLAGS) -PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.55 libdrm]) +PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.64 libdrm]) PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) PKG_CHECK_MODULES(OVERLAY_XVLIB, [xv x11 xext dri2proto >= 2.6], enable_overlay_xvlib=yes, enable_overlay_xvlib=no) PKG_CHECK_MODULES(OVERLAY_XLIB, [cairo-xlib dri2proto >= 2.6], enable_overlay_xlib=yes, enable_overlay_xlib=no)
tests/.gitignore +1 -0
@@ -126,6 +126,7 @@ gen3_render_tiledy_blits gen7_forcewake_mt kms_3d kms_addfb_basic +kms_atomic kms_crtc_background_color kms_cursor_crc kms_draw_crc
tests/Makefile.sources +1 -0
@@ -63,6 +63,7 @@ TESTS_progs_M = \ gem_userptr_blits \ gem_write_read_ring_switch \ kms_addfb_basic \ + kms_atomic \ kms_cursor_crc \ kms_draw_crc \ kms_fbc_crc \
tests/kms_atomic.c new file +1345 -0
1,345 lines not on this page · raw message
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx