Skip to contentSkip to conversation

Assert tests, atomic, multi-blob

PATCH Superseded Daniel Stone 1 participant 5 messages Oct 29, 2015

lore
Share & tools
lore
#0 lore raw

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

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

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
index 58ae36b..fe5df6e 100644
@@ -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

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

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
index 29c228f..49486ab 100644
@@ -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
index 9c285ed..e8701da 100644
@@ -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
index 1d2d787..3970fc6 100644
@@ -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
index f2b7cb6..179e991 100644
@@ -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
index 94245ce..b75800c 100644
@@ -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
index 62ba35f..f586bf1 100644
@@ -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
index e49d0f7..8da75c5 100644
@@ -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
index ef8890e..fe136d3 100644
@@ -100,7 +100,7 @@ static void copy(int fd, uint32_t src, uint32_t dst, void *buf, int len, int loo
 
 	while (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 len
 	gem_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
index 8fa70d0..79facc1 100644
@@ -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
index f45244b..b5849bc 100644
@@ -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
index 227ebde..67d54bd 100644
@@ -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
index a6316cc..65ac385 100644
@@ -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
index 10a84fa..dccf535 100644
@@ -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
index 6b44241..f8726e2 100644
@@ -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
index 9d66bda..bd727f0 100644
@@ -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
index 22e0388..74bc6f8 100644
@@ -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
index 4fb00ab..e7126ad 100644
@@ -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
index bc1d417..d24fb10 100644
@@ -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

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v7 3/4 tests/core_prop_blob: Add multiple blobs per connection

In reply to Daniel Stone

This 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
index df4f3ad..365d728 100644
@@ -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

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH v7 4/4 kms_atomic: Add basic atomic modesetting tests

In reply to Daniel Stone

Add 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
index 5f97466..97de58a 100644
@@ -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
index beda511..80af9a7 100644
@@ -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
index ac731f9..8fb2de8 100644
@@ -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

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel