mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-18 21:36:27 +00:00
tests/gem_mmap: Convert to subtests
I wanted to write a testcase for gtt mmap access restriction checking and only noticed after conversion to subtests that this here is for cpu mmaps ;-) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
86f60ee593
commit
c2c0efc21a
@ -30,6 +30,7 @@ TESTS_progs_M = \
|
||||
gem_flink \
|
||||
gem_flink_race \
|
||||
gem_linear_blits \
|
||||
gem_mmap \
|
||||
gem_mmap_gtt \
|
||||
gem_partial_pwrite_pread \
|
||||
gem_pread \
|
||||
@ -75,7 +76,6 @@ TESTS_progs = \
|
||||
gem_hangcheck_forcewake \
|
||||
gem_largeobject \
|
||||
gem_lut_handle \
|
||||
gem_mmap \
|
||||
gem_mmap_offset_exhaustion \
|
||||
gem_pin \
|
||||
gem_pipe_control_store_loop \
|
||||
|
@ -40,30 +40,35 @@
|
||||
#include "drmtest.h"
|
||||
|
||||
#define OBJECT_SIZE 16384
|
||||
int fd;
|
||||
int handle;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
struct drm_i915_gem_mmap arg;
|
||||
uint8_t expected[OBJECT_SIZE];
|
||||
uint8_t buf[OBJECT_SIZE];
|
||||
uint8_t *addr;
|
||||
int ret;
|
||||
int handle;
|
||||
|
||||
igt_subtest_init(argc, argv);
|
||||
|
||||
igt_fixture
|
||||
fd = drm_open_any();
|
||||
|
||||
igt_subtest("bad-object") {
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
arg.handle = 0x10101010;
|
||||
arg.offset = 0;
|
||||
arg.size = 4096;
|
||||
printf("Testing mmaping of bad object.\n");
|
||||
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
|
||||
igt_assert(ret == -1 && errno == ENOENT);
|
||||
}
|
||||
|
||||
igt_fixture
|
||||
handle = gem_create(fd, OBJECT_SIZE);
|
||||
|
||||
printf("Testing mmaping of newly created object.\n");
|
||||
igt_subtest("new-object") {
|
||||
arg.handle = handle;
|
||||
arg.offset = 0;
|
||||
arg.size = OBJECT_SIZE;
|
||||
@ -88,7 +93,9 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("Testing unmapping\n");
|
||||
munmap(addr, OBJECT_SIZE);
|
||||
}
|
||||
|
||||
igt_fixture
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user