aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/test_lib.h
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2018-02-07 05:58:21 +0700
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-02-14 15:26:00 +0100
commitdaef4f155f4b677907f210d93839013204168d02 (patch)
treee404b6b670f8b8a70177d2ca6e193fe53df8e0de /tests/unittests/test_lib.h
parentfd0b70bbf1c1f3e939438c884360eb6f31f73252 (diff)
mtd: unittests: Decode arg size from ioctl request
Signed-off-by: Balint Reczey <balint.reczey@canonical.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/unittests/test_lib.h')
-rw-r--r--tests/unittests/test_lib.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/unittests/test_lib.h b/tests/unittests/test_lib.h
index f5f0f34..806a4bc 100644
--- a/tests/unittests/test_lib.h
+++ b/tests/unittests/test_lib.h
@@ -45,16 +45,15 @@ int __wrap_ioctl(int fd, unsigned long req, ...)
assert_true(fd > 0);
check_expected(req);
int retval = mock_type(int);
- void *expected_arg = mock_type(void*);
- size_t expected_len = mock_type(size_t);
+ char *expected_arg = mock_type(char*);
if (expected_arg == NULL)
return retval;
va_list ap;
va_start(ap, req);
- void *arg = va_arg(ap, void *);
+ char *arg = va_arg(ap, char *);
va_end(ap);
assert_non_null(arg);
- assert_memory_equal(expected_arg, arg, expected_len);
+ assert_memory_equal(expected_arg, arg, _IOC_SIZE(req));
return retval;
}
@@ -107,18 +106,16 @@ off_t __wrap_lseek(int fd, off_t seek, int whence)
will_return(__wrap_close, Y);\
} while(0);
-#define expect_ioctl(W,X,Y,Z) do { \
+#define expect_ioctl(W,X,Y) do { \
expect_value(__wrap_ioctl, req, W);\
will_return(__wrap_ioctl, X);\
will_return(__wrap_ioctl, Y);\
- will_return(__wrap_ioctl, Z);\
} while(0);
#define expect_ioctl_short(X,Y) do { \
expect_value(__wrap_ioctl, req, X);\
will_return(__wrap_ioctl, Y);\
will_return(__wrap_ioctl, NULL);\
- will_return(__wrap_ioctl, 0);\
} while(0);
#define expect_stat(X,Y) do { \