X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Fgem_readwrite.c;h=07dc853a0c24b929a095369dc5ddf7059178a666;hb=230389a0d7b712f8ad0bab6edaacd8988e64d76b;hp=54b25ea353b60b6a39e520d589cfd4f140c49607;hpb=5052e966ec7fe5146c2d73b90482003619add5da;p=platform%2Fupstream%2Flibdrm.git diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c index 54b25ea..07dc853 100644 --- a/tests/gem_readwrite.c +++ b/tests/gem_readwrite.c @@ -78,7 +78,11 @@ int main(int argc, char **argv) int ret; int handle; - fd = drm_open_any(); + fd = drm_open_matching("8086:*", 0); + if (fd < 0) { + fprintf(stderr, "failed to open intel drm device, skipping\n"); + return 0; + } memset(&create, 0, sizeof(create)); create.size = OBJECT_SIZE; @@ -94,6 +98,7 @@ int main(int argc, char **argv) printf("Testing read beyond end of buffer.\n"); ret = do_read(fd, handle, buf, OBJECT_SIZE / 2, OBJECT_SIZE); + printf("%d %d\n", ret, errno); assert(ret == -1 && errno == EINVAL); printf("Testing full write of buffer\n"); @@ -120,6 +125,14 @@ int main(int argc, char **argv) assert(ret == 0); assert(memcmp(buf, expected + 512, 1024) == 0); + printf("Testing read of bad buffer handle\n"); + ret = do_read(fd, 1234, buf, 0, 1024); + assert(ret == -1 && errno == ENOENT); + + printf("Testing write of bad buffer handle\n"); + ret = do_write(fd, 1234, buf, 0, 1024); + assert(ret == -1 && errno == ENOENT); + close(fd); return 0;