Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142723647
D45055.id138004.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D45055.id138004.diff
View Options
diff --git a/tests/sys/kern/sendfile_helper.c b/tests/sys/kern/sendfile_helper.c
--- a/tests/sys/kern/sendfile_helper.c
+++ b/tests/sys/kern/sendfile_helper.c
@@ -121,26 +121,47 @@
return NULL;
}
+static void
+usage(void)
+{
+ errx(1, "usage: %s [-u] <file> <start> <len> <flags>", getprogname());
+}
+
int
main(int argc, char **argv)
{
pthread_t pt;
off_t start;
- int fd, ss[2], flags, error;
+ int ch, fd, ss[2], flags, error;
+ bool pf_unix = false;
+
+ while ((ch = getopt(argc, argv, "u")) != -1)
+ switch (ch) {
+ case 'u':
+ pf_unix = true;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
- if (argc != 5)
- errx(1, "usage: %s <file> <start> <len> <flags>",
- getprogname());
+ if (argc != 4)
+ usage();
- start = strtoull(argv[2], NULL, 0);
- readlen = strtoull(argv[3], NULL, 0);
- flags = strtoul(argv[4], NULL, 0);
+ start = strtoull(argv[1], NULL, 0);
+ readlen = strtoull(argv[2], NULL, 0);
+ flags = strtoul(argv[3], NULL, 0);
- fd = open(argv[1], O_RDONLY);
+ fd = open(argv[0], O_RDONLY);
if (fd < 0)
err(1, "open");
- tcp_socketpair(ss);
+ if (pf_unix) {
+ if (socketpair(PF_LOCAL, SOCK_STREAM, 0, ss) != 0)
+ err(1, "socketpair");
+ } else
+ tcp_socketpair(ss);
error = pthread_create(&pt, NULL, receiver, &ss[1]);
if (error)
diff --git a/tests/sys/kern/sendfile_test.sh b/tests/sys/kern/sendfile_test.sh
--- a/tests/sys/kern/sendfile_test.sh
+++ b/tests/sys/kern/sendfile_test.sh
@@ -112,12 +112,36 @@
common_cleanup
}
+atf_test_case unix_success cleanup
+unix_success_head()
+{
+ atf_set "descr" "sendfile via unix(4) where all disk I/O succeeds"
+ atf_set "require.user" "root"
+ atf_set "timeout" 15
+}
+unix_success_body()
+{
+ if [ "$(atf_config_get qemu false)" = "true" ]; then
+ atf_skip "Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"
+ fi
+
+ alloc_md md
+ common_body_setup $md
+
+ atf_check $HELPER -u $FILE 0 0x10000 0x10000
+}
+unix_success_cleanup()
+{
+ common_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case io_success
atf_add_test_case io_fail_sync
atf_add_test_case io_fail_async
+ atf_add_test_case unix_success
}
alloc_md()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 5:16 PM (13 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27887976
Default Alt Text
D45055.id138004.diff (2 KB)
Attached To
Mode
D45055: tests/sendfile: test operation on unix/stream socket
Attached
Detach File
Event Timeline
Log In to Comment