diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-02-22 01:12:47 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-02-22 01:12:47 -0300 |
commit | 6d461a4fe7896faa1aec5a5417888cf179e46b9f (patch) | |
tree | 2e0f1a0b7a5418189c8d53592d33a44d0b356fc9 /tools/testing/selftests/kdbus/test-free.c | |
parent | 5c545e1fb127a4b11ddc5f1a5ed066b853dd1a1a (diff) |
Linux-libre 4.4.2-gnupck-4.4.2-gnu
Diffstat (limited to 'tools/testing/selftests/kdbus/test-free.c')
-rw-r--r-- | tools/testing/selftests/kdbus/test-free.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/tools/testing/selftests/kdbus/test-free.c b/tools/testing/selftests/kdbus/test-free.c deleted file mode 100644 index f666da3e8..000000000 --- a/tools/testing/selftests/kdbus/test-free.c +++ /dev/null @@ -1,64 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <stdlib.h> -#include <stddef.h> -#include <unistd.h> -#include <stdint.h> -#include <errno.h> -#include <assert.h> -#include <stdbool.h> - -#include "kdbus-api.h" -#include "kdbus-util.h" -#include "kdbus-enum.h" -#include "kdbus-test.h" - -static int sample_ioctl_call(struct kdbus_test_env *env) -{ - int ret; - struct kdbus_cmd_list cmd_list = { - .flags = KDBUS_LIST_QUEUED, - .size = sizeof(cmd_list), - }; - - ret = kdbus_cmd_list(env->conn->fd, &cmd_list); - ASSERT_RETURN(ret == 0); - - /* DON'T FREE THIS SLICE OF MEMORY! */ - - return TEST_OK; -} - -int kdbus_test_free(struct kdbus_test_env *env) -{ - int ret; - struct kdbus_cmd_free cmd_free = {}; - - /* free an unallocated buffer */ - cmd_free.size = sizeof(cmd_free); - cmd_free.flags = 0; - cmd_free.offset = 0; - ret = kdbus_cmd_free(env->conn->fd, &cmd_free); - ASSERT_RETURN(ret == -ENXIO); - - /* free a buffer out of the pool's bounds */ - cmd_free.size = sizeof(cmd_free); - cmd_free.offset = POOL_SIZE + 1; - ret = kdbus_cmd_free(env->conn->fd, &cmd_free); - ASSERT_RETURN(ret == -ENXIO); - - /* - * The user application is responsible for freeing the allocated - * memory with the KDBUS_CMD_FREE ioctl, so let's test what happens - * if we forget about it. - */ - - ret = sample_ioctl_call(env); - ASSERT_RETURN(ret == 0); - - ret = sample_ioctl_call(env); - ASSERT_RETURN(ret == 0); - - return TEST_OK; -} |