summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinay Belgaumkar <vinay.belgaumkar@intel.com>2017-09-14 11:09:58 -0700
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2017-09-22 13:31:43 +0300
commit3a01e58858e6068f75356e798fd90c80cccb37d6 (patch)
tree6107ab580ef3e6f61117a4d01d5bf6164fb8d683
parent4323d1bab091c2202ab1bd6786b178c23977112c (diff)
tests/gem_flink_basic: Add documentation for subtests
Added the missing IGT_TEST_DESCRIPTION and some subtest descriptions. v2: Removed duplication, addressed comments, cc'd test author v3: Only comment abstract code, change some igt_info to igt_debug. Changed description to reflect this is a patch, not an RFC. Cc: MichaƂ Winiarski <michal.winiarski@intel.com> Cc: Eric Anholt <eric@anholt.net> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Reviewed-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
-rw-r--r--tests/gem_flink_basic.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/gem_flink_basic.c b/tests/gem_flink_basic.c
index 26ae7d63..48b0b8b1 100644
--- a/tests/gem_flink_basic.c
+++ b/tests/gem_flink_basic.c
@@ -36,6 +36,8 @@
#include <sys/ioctl.h>
#include "drm.h"
+IGT_TEST_DESCRIPTION("Tests for flink - a way to export a gem object by name");
+
static void
test_flink(int fd)
{
@@ -44,7 +46,7 @@ test_flink(int fd)
struct drm_gem_open open_struct;
int ret;
- igt_info("Testing flink and open.\n");
+ igt_debug("Testing flink and open.\n");
memset(&create, 0, sizeof(create));
create.size = 16 * 1024;
@@ -69,7 +71,7 @@ test_double_flink(int fd)
struct drm_gem_flink flink2;
int ret;
- igt_info("Testing repeated flink.\n");
+ igt_debug("Testing repeated flink.\n");
memset(&create, 0, sizeof(create));
create.size = 16 * 1024;
@@ -83,6 +85,8 @@ test_double_flink(int fd)
flink2.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink2);
igt_assert_eq(ret, 0);
+
+ /* flinks for same gem object share the same name */
igt_assert(flink2.name == flink.name);
}
@@ -92,7 +96,7 @@ test_bad_flink(int fd)
struct drm_gem_flink flink;
int ret;
- igt_info("Testing error return on bad flink ioctl.\n");
+ igt_debug("Testing error return on bad flink ioctl.\n");
flink.handle = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
@@ -105,7 +109,7 @@ test_bad_open(int fd)
struct drm_gem_open open_struct;
int ret;
- igt_info("Testing error return on bad open ioctl.\n");
+ igt_debug("Testing error return on bad open ioctl.\n");
open_struct.name = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
@@ -121,7 +125,7 @@ test_flink_lifetime(int fd)
struct drm_gem_open open_struct;
int ret, fd2;
- igt_info("Testing flink lifetime.\n");
+ igt_debug("Testing flink lifetime.\n");
fd2 = drm_open_driver(DRIVER_INTEL);
@@ -134,6 +138,7 @@ test_flink_lifetime(int fd)
ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink);
igt_assert_eq(ret, 0);
+ /* Open a second reference to the gem object with different fd */
open_struct.name = flink.name;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
igt_assert_eq(ret, 0);
@@ -142,6 +147,7 @@ test_flink_lifetime(int fd)
close(fd2);
fd2 = drm_open_driver(DRIVER_INTEL);
+ /* Flink name remains valid due to the second reference */
open_struct.name = flink.name;
ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct);
igt_assert_eq(ret, 0);
@@ -163,6 +169,8 @@ igt_main
test_bad_flink(fd);
igt_subtest("bad-open")
test_bad_open(fd);
+
+ /* Flink lifetime is limited to that of the gem object it points to */
igt_subtest("flink-lifetime")
test_flink_lifetime(fd);
}