Skip to contentSkip to conversation

tests/i915/gen_mmap: fix no-op loops

PATCH In review Simon Ser 3 participants 5 messages May 31, 2019 – Jun 6, 2019

lore
Share & tools
lore

Simon Ser

author
#0 lore raw

PATCH v2 1/2 tests/i915/gen_mmap: fix no-op loops

The loop condition is never satisfied, since after filling the array i > 0. For this reason the loop is always a no-op.

Use a more conventional loop instead.

Fixes 964e39159c64 ("tests/i915/gem_mmap: Add invalid parameters tests")
---
 tests/i915/gem_mmap.c     | 7 ++++---
 tests/i915/gem_mmap_gtt.c | 7 ++++---
 tests/i915/gem_mmap_wc.c  | 7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)
tests/i915/gem_mmap.c +4 -3
index d1b10013a1b8..c96aa2c0a7a5 100644
@@ -158,14 +158,15 @@ igt_main
 	igt_subtest("bad-object") {
 		uint32_t real_handle = gem_create(fd, 4096);
 		uint32_t handles[20];
-		int i = 0;
+		size_t i = 0, len;
 
 		handles[i++] = 0xdeadbeef;
 		for(int bit = 0; bit < 16; bit++)
 			handles[i++] = real_handle | (1 << (bit + 16));
-		handles[i] = real_handle + 1;
+		handles[i++] = real_handle + 1;
+		len = i;
 
-		for (; i < 0; i--) {
+		for (i = 0; i < len; ++i) {
 			struct drm_i915_gem_mmap arg = {
 				.handle = handles[i],
 				.size = 4096,
tests/i915/gem_mmap_gtt.c +4 -3
index 9a670f030149..034658e64990 100644
@@ -886,14 +886,15 @@ igt_main
 	igt_subtest("bad-object") {
 		uint32_t real_handle = gem_create(fd, 4096);
 		uint32_t handles[20];
-		int i = 0;
+		size_t i = 0, len;
 
 		handles[i++] = 0xdeadbeef;
 		for(int bit = 0; bit < 16; bit++)
 			handles[i++] = real_handle | (1 << (bit + 16));
-		handles[i] = real_handle + 1;
+		handles[i++] = real_handle + 1;
+		len = i;
 
-		for (; i < 0; i--) {
+		for (i = 0; i < len; ++i) {
 			struct drm_i915_gem_mmap_gtt arg = {
 				.handle = handles[i],
 			};
tests/i915/gem_mmap_wc.c +4 -3
index 159eedbf4cfb..63538f791aae 100644
@@ -496,14 +496,15 @@ igt_main
 	igt_subtest("bad-object") {
 		uint32_t real_handle = gem_create(fd, 4096);
 		uint32_t handles[20];
-		int i = 0;
+		size_t i = 0, len;
 
 		handles[i++] = 0xdeadbeef;
 		for(int bit = 0; bit < 16; bit++)
 			handles[i++] = real_handle | (1 << (bit + 16));
-		handles[i] = real_handle + 1;
+		handles[i++] = real_handle + 1;
+		len = i;
 
-		for (; i < 0; i--) {
+		for (i = 0; i < len; ++i) {
 			struct drm_i915_gem_mmap arg = {
 				.handle = handles[i],
 				.size = 4096,
Signature · 6 lines
2.21.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
author
#1 lore raw

PATCH v2 2/2 tests/i915/gem_mmap: fix bad-object tests error value

These tests checked for EINVAL, but the correct error value is ENOENT, as pointed out by Chris Wilson:

commit bf79cb914dbfe848add8bb76cbb8ff89110d29ff

Author: Chris Wilson <[email protected]>
Date:   Wed Aug 4 14:19:46 2010 +0100

drm: Use ENOENT consistently for the error return for an unmatched handle.

This is consistent with trying to access a filename that not exist within a directory which is a good analogy here. The main reason for the change is that it is easy to confuse the error code of EBADF as an performing an ioctl on an invalid file descriptor (rather than an unknown object).

This commit fixes the two bad tests (the gem_mmap_gtt test already checks for ENOENT).

Cc Chris Wilson <[email protected]>
---
 tests/i915/gem_mmap.c    | 2 +-
 tests/i915/gem_mmap_wc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/i915/gem_mmap.c +1 -1
index c96aa2c0a7a5..f8cf052e3cc5 100644
@@ -173,7 +173,7 @@ igt_main
 			};
 
 			igt_debug("Trying MMAP IOCTL with handle %x\n", handles[i]);
-			igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL);
+			igt_assert_eq(mmap_ioctl(fd, &arg), -ENOENT);
 		}
 
 		gem_close(fd, real_handle);
tests/i915/gem_mmap_wc.c +1 -1
index 63538f791aae..c9e5bf23b868 100644
@@ -510,7 +510,7 @@ igt_main
 				.size = 4096,
 				.flags = I915_MMAP_WC,
 			};
-			igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL);
+			igt_assert_eq(mmap_ioctl(fd, &arg), -ENOENT);
 		}
 
 		gem_close(fd, real_handle);
Signature · 6 lines
2.21.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v2 2/2
#2 lore raw

Re: [igt-dev] [PATCH i-g-t v2 2/2] tests/i915/gem_mmap: fix bad-object tests error value

Quoted 15 lines · Simon Ser

These tests checked for EINVAL, but the correct error value is ENOENT, as pointed out by Chris Wilson:

commit bf79cb914dbfe848add8bb76cbb8ff89110d29ff

Author: Chris Wilson <[email protected]>
Date:   Wed Aug 4 14:19:46 2010 +0100

drm: Use ENOENT consistently for the error return for an unmatched handle.

This is consistent with trying to access a filename that not exist within a directory which is a good analogy here. The main reason for the change is that it is easy to confuse the error code of EBADF as an performing an ioctl on an invalid file descriptor (rather than an unknown object).

Quoted 8 lines

This commit fixes the two bad tests (the gem_mmap_gtt test already checks for ENOENT).

Cc Chris Wilson <[email protected]>

for both patches
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] tests/i915/gen_mmap: fix no-op loops

In reply to Simon Ser
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,v2,1/2] tests/i915/gen_mmap: fix no-op loops
URL : https://patchwork.freedesktop.org/series/61426/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6175 -> IGTPW_3091
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/61426/revisions/1/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_3091:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* {igt@i915_selftest@live_mman}:
- fi-icl-u3: NOTRUN -> [TIMEOUT][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-u3/igt@i915_selftest@live_mman.html

Known issues
------------

Here are the changes found in IGTPW_3091 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: [PASS][2] -> [INCOMPLETE][3] ([fdo#107718])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-blb-e6850/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-blb-e6850/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- fi-icl-u3: [PASS][4] -> [DMESG-WARN][5] ([fdo#107724])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-icl-u3/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-u3/igt@[email protected]

* igt@prime_self_import@basic-with_one_bo:
- fi-icl-dsi: [PASS][6] -> [INCOMPLETE][7] ([fdo#107713])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-icl-dsi/igt@prime_self_import@basic-with_one_bo.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-dsi/igt@prime_self_import@basic-with_one_bo.html

#### Possible fixes ####

* igt@gem_exec_fence@basic-busy-default:
- {fi-icl-guc}: [INCOMPLETE][8] ([fdo#107713]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-icl-guc/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-guc/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-icl-u3: [INCOMPLETE][10] ([fdo#107713] / [fdo#108840]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-icl-u3/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-u3/igt@[email protected]

* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: [DMESG-FAIL][12] ([fdo#110235]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html

* {igt@i915_selftest@live_mman}:
- fi-icl-y: [TIMEOUT][14] -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-icl-y/igt@i915_selftest@live_mman.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-y/igt@i915_selftest@live_mman.html

* igt@kms_addfb_basic@invalid-get-prop-any:
- fi-icl-u3: [DMESG-WARN][16] ([fdo#107724]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/fi-icl-u3/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/fi-icl-u3/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235

Participating hosts (54 -> 47)
------------------------------

Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-kbl-7560u fi-byt-clapper fi-bdw-samus

Build changes
-------------

* IGT: IGT_5026 -> IGTPW_3091

CI_DRM_6175: 0ebe1e37a70176b84d4e2d489f03c3533e0fcd1a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3091: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/
IGT_5026: 4108c74c3b15460de25ab989f4e2031594559dfc @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v2,1/2] tests/i915/gen_mmap: fix no-op loops

In reply to Simon Ser
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,v2,1/2] tests/i915/gen_mmap: fix no-op loops
URL : https://patchwork.freedesktop.org/series/61426/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6175_full -> IGTPW_3091_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/61426/revisions/1/mbox/

Known issues
------------

Here are the changes found in IGTPW_3091_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rps@reset:
- shard-glk: [PASS][1] -> [FAIL][2] ([fdo#102250])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-glk9/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-glk9/igt@[email protected]

* igt@i915_suspend@debugfs-reader:
- shard-apl: [PASS][3] -> [DMESG-WARN][4] ([fdo#108566]) +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-apl7/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-apl4/igt@[email protected]

* igt@kms_flip@dpms-vs-vblank-race:
- shard-apl: [PASS][5] -> [FAIL][6] ([fdo#103060])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-apl1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-apl8/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-iclb: [PASS][7] -> [INCOMPLETE][8] ([fdo#107713] / [fdo#109507])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb2/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb7/igt@[email protected]
- shard-apl: [PASS][9] -> [INCOMPLETE][10] ([fdo#103927])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-apl4/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-apl5/igt@[email protected]
- shard-hsw: [PASS][11] -> [INCOMPLETE][12] ([fdo#103540])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-hsw5/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-hsw5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-shrfb-scaledprimary:
- shard-glk: [PASS][13] -> [INCOMPLETE][14] ([fdo#103359] / [k.org#198133])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-glk1/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-glk8/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb3/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#103166])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb3/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb4/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109441])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb6/igt@kms_psr@psr2_sprite_plane_move.html

#### Possible fixes ####

* igt@gem_eio@in-flight-suspend:
- shard-glk: [FAIL][21] ([fdo#110667]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-glk5/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-glk2/igt@[email protected]

* igt@gem_mmap_gtt@forked-medium-copy-xy:
- shard-iclb: [INCOMPLETE][23] ([fdo#107713] / [fdo#109100]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb3/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb5/igt@[email protected]

* igt@gem_persistent_relocs@forked:
- shard-iclb: [INCOMPLETE][25] ([fdo#107713]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb7/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb7/igt@[email protected]

* igt@gem_softpin@softpin:
- shard-glk: [INCOMPLETE][27] ([fdo#103359] / [k.org#198133]) -> [PASS][28] +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-glk4/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-glk6/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-kbl: [FAIL][29] ([fdo#108686]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-kbl7/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-kbl1/igt@[email protected]

* igt@i915_suspend@fence-restore-untiled:
- shard-apl: [DMESG-WARN][31] ([fdo#108566]) -> [PASS][32] +3 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-apl7/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-apl4/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-iclb: [FAIL][33] ([fdo#103167]) -> [PASS][34] +2 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-iclb1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-iclb6/igt@[email protected]

* igt@perf_pmu@rc6-runtime-pm-long:
- shard-glk: [FAIL][35] ([fdo#105010]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6175/shard-glk1/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/shard-glk8/igt@[email protected]

[fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#110667]: https://bugs.freedesktop.org/show_bug.cgi?id=110667
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (10 -> 6)
------------------------------

Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005

Build changes
-------------

* IGT: IGT_5026 -> IGTPW_3091
* Piglit: piglit_4509 -> None

CI_DRM_6175: 0ebe1e37a70176b84d4e2d489f03c3533e0fcd1a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3091: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/
IGT_5026: 4108c74c3b15460de25ab989f4e2031594559dfc @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3091/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev