mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 11:19:14 +02:00
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.
This commit is contained in:
parent
63a2180b40
commit
8cc4de5fc9
2 changed files with 9 additions and 2 deletions
|
|
@ -42,7 +42,6 @@
|
||||||
#include "linux/input.h"
|
#include "linux/input.h"
|
||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/sendfile.h>
|
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -1229,7 +1228,7 @@ litest_copy_file(const char *dest, const char *src, const char *header)
|
||||||
src,
|
src,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
/* lazy, just check for error and empty file copy */
|
/* 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(out);
|
||||||
close(in);
|
close(in);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1077,6 +1077,14 @@ litest_touchpad_is_external(struct litest_device *dev)
|
||||||
return is_external;
|
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_eq
|
||||||
#undef ck_assert_double_ne
|
#undef ck_assert_double_ne
|
||||||
#undef ck_assert_double_lt
|
#undef ck_assert_double_lt
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue