diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-11-07 13:54:01 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-11-07 13:54:01 +0100 |
commit | 5dbc2630363d1111fd8081d0e3bcb1084cfba7f4 (patch) | |
tree | def2f82713a16335082897b65940d6b2c5815c1c /tests/gem_reloc_overflow.c | |
parent | 4cf1d089ebc83ca21abbc9714bcebecf8a759714 (diff) | |
download | intel-gpu-tools-5dbc2630363d1111fd8081d0e3bcb1084cfba7f4.tar.gz intel-gpu-tools-5dbc2630363d1111fd8081d0e3bcb1084cfba7f4.tar.bz2 intel-gpu-tools-5dbc2630363d1111fd8081d0e3bcb1084cfba7f4.zip |
tests/gem_overflow_reloc: Rework subtest enumeration
Subtest names must be stable across all platforms for easier tracking.
Hence move the gen8+ check into the subtests, using igt_require. This
will auto-skip the tests on platforms where a given test doesn't apply.
Also move the assignment of the relocation_type var outside of the
fixture block. Fixtures aren't run when enumerating subtests (so that
subtests can be enumerated on any platform, even without an intel gpu).
So gcc has indeed been right with it's "potentially uninitialized" var
warning after all ...
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/gem_reloc_overflow.c')
-rw-r--r-- | tests/gem_reloc_overflow.c | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/tests/gem_reloc_overflow.c b/tests/gem_reloc_overflow.c index 537e32ba..fa7baab5 100644 --- a/tests/gem_reloc_overflow.c +++ b/tests/gem_reloc_overflow.c @@ -65,7 +65,12 @@ static void source_offset_tests(int devid, bool reloc_gtt) { struct drm_i915_gem_relocation_entry single_reloc; void *dst_gtt; - const char *relocation_type = ""; + const char *relocation_type; + + if (reloc_gtt) + relocation_type = "reloc-gtt"; + else + relocation_type = "reloc-cpu"; igt_fixture { handle = gem_create(fd, 8192); @@ -91,53 +96,57 @@ static void source_offset_tests(int devid, bool reloc_gtt) } } - if (intel_gen(devid) >= 8) { - igt_subtest_f("source-offset-page-stradle-gen8+-%s", relocation_type) { - single_reloc.offset = 4096 - 4; - single_reloc.delta = 0; - single_reloc.target_handle = handle; - single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; - single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; - single_reloc.presumed_offset = 0; - - igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); - single_reloc.delta = 1024; - igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); - } + /* Special tests for 64b relocs. */ + igt_subtest_f("source-offset-page-stradle-gen8-%s", relocation_type) { + igt_require(intel_gen(devid) >= 8); + single_reloc.offset = 4096 - 4; + single_reloc.delta = 0; + single_reloc.target_handle = handle; + single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; + single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; + single_reloc.presumed_offset = 0; - igt_subtest_f("source-offset-end-gen8+-%s", relocation_type) { - single_reloc.offset = 8192 - 8; - single_reloc.delta = 0; - single_reloc.target_handle = handle; - single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; - single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; - single_reloc.presumed_offset = 0; + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); + single_reloc.delta = 1024; + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); + } - igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); - } + igt_subtest_f("source-offset-end-gen8-%s", relocation_type) { + igt_require(intel_gen(devid) >= 8); + single_reloc.offset = 8192 - 8; + single_reloc.delta = 0; + single_reloc.target_handle = handle; + single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; + single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; + single_reloc.presumed_offset = 0; - igt_subtest_f("source-offset-overflow-gen8+-%s", relocation_type) { - single_reloc.offset = 8192 - 4; - single_reloc.delta = 0; - single_reloc.target_handle = handle; - single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; - single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; - single_reloc.presumed_offset = 0; + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); + } - igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) != 0); - igt_assert(errno == EINVAL); - } - } else { - igt_subtest_f("source-offset-end-%s", relocation_type) { - single_reloc.offset = 8192 - 4; - single_reloc.delta = 0; - single_reloc.target_handle = handle; - single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; - single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; - single_reloc.presumed_offset = 0; - - igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); - } + igt_subtest_f("source-offset-overflow-gen8-%s", relocation_type) { + igt_require(intel_gen(devid) >= 8); + single_reloc.offset = 8192 - 4; + single_reloc.delta = 0; + single_reloc.target_handle = handle; + single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; + single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; + single_reloc.presumed_offset = 0; + + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) != 0); + igt_assert(errno == EINVAL); + } + + /* Tests for old 4byte relocs on pre-gen8. */ + igt_subtest_f("source-offset-end-%s", relocation_type) { + igt_require(intel_gen(devid) < 8); + single_reloc.offset = 8192 - 4; + single_reloc.delta = 0; + single_reloc.target_handle = handle; + single_reloc.read_domains = I915_GEM_DOMAIN_RENDER; + single_reloc.write_domain = I915_GEM_DOMAIN_RENDER; + single_reloc.presumed_offset = 0; + + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0); } igt_subtest_f("source-offset-big-%s", relocation_type) { |