From: Greg V Date: Tue, 10 Jul 2018 10:57:12 +0000 (+0300) Subject: test: use simple portable sendfile X-Git-Tag: 1.11.901~41^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cc4de5fc90fbcf5675f7f5bba9a87cba19b368b;p=platform%2Fupstream%2Flibinput.git test: use simple portable sendfile There's no need for high performance in these little tests, so instead of supporting various platform-specific sendfile() implementations, just use a local read-write function. --- diff --git a/test/litest.c b/test/litest.c index 7c9cf00..ae4c160 100644 --- a/test/litest.c +++ b/test/litest.c @@ -42,7 +42,6 @@ #include "linux/input.h" #include #include -#include #include #include #include @@ -1229,7 +1228,7 @@ litest_copy_file(const char *dest, const char *src, const char *header) src, strerror(errno)); /* lazy, just check for error and empty file copy */ - litest_assert_int_gt(sendfile(out, in, NULL, 40960), 0); + litest_assert_int_gt(litest_send_file(out, in), 0); close(out); close(in); diff --git a/test/litest.h b/test/litest.h index 9c42c03..6d332f6 100644 --- a/test/litest.h +++ b/test/litest.h @@ -1077,6 +1077,14 @@ litest_touchpad_is_external(struct litest_device *dev) return is_external; } +static inline int +litest_send_file(int sock, int fd) +{ + char buf[40960]; + int n = read(fd, buf, 40960); + return write(sock, buf, n); +} + #undef ck_assert_double_eq #undef ck_assert_double_ne #undef ck_assert_double_lt