summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-06-27 11:07:09 -0700
committerBen Widawsky <ben@bwidawsk.net>2012-06-27 11:07:09 -0700
commit1136f61298979912e7edfa94a56437f7c9c5499b (patch)
tree24801bbfd4e33e04d200050f77d9f560a6274370
parent76b53ef68d39063c4b0203aa8db2b32dcce1e3b4 (diff)
ctx_bad_destroy: a little more description is nice
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r--tests/gem_ctx_bad_destroy.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/gem_ctx_bad_destroy.c b/tests/gem_ctx_bad_destroy.c
index a054190f..788e6a2e 100644
--- a/tests/gem_ctx_bad_destroy.c
+++ b/tests/gem_ctx_bad_destroy.c
@@ -61,14 +61,15 @@ static uint32_t context_create(int fd)
return create.ctx_id;
}
-static void handle_bad(int ret, int lerrno, int expected)
+static void handle_bad(int ret, int lerrno, int expected, const char *desc)
{
if (ret != 0 && lerrno != expected) {
- fprintf(stderr, "errno was %d, but should have been %d\n",
- lerrno, expected);
+ fprintf(stderr, "%s - errno was %d, but should have been %d\n",
+ desc, lerrno, expected);
exit(EXIT_FAILURE);
} else if (ret == 0) {
- fprintf(stderr, "Command succeeded, but should have failed\n");
+ fprintf(stderr, "%s - Command succeeded, but should have failed\n",
+ desc);
exit(EXIT_FAILURE);
}
}
@@ -90,17 +91,17 @@ int main(int argc, char *argv[])
/* try double destroy */
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
- handle_bad(ret, errno, EINVAL);
+ handle_bad(ret, errno, EINVAL, "double destroy");
/* destroy something random */
destroy.ctx_id = 2;
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
- handle_bad(ret, errno, EINVAL);
+ handle_bad(ret, errno, EINVAL, "random destroy");
/* Try to destroy the default context */
destroy.ctx_id = 0;
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
- handle_bad(ret, errno, EINVAL);
+ handle_bad(ret, errno, EINVAL, "default destroy");
close(fd);