Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/syscalls/linux/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,6 @@ cc_binary(
"//test/util:file_descriptor",
"//test/util:signal_util",
"//test/util:socket_util",
"//test/util:temp_path",
"//test/util:test_main",
"//test/util:test_util",
],
Expand Down
49 changes: 0 additions & 49 deletions test/syscalls/linux/ioctl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <net/if.h>
#include <netdb.h>
#include <signal.h>
Expand All @@ -31,7 +30,6 @@
#include "test/util/file_descriptor.h"
#include "test/util/signal_util.h"
#include "test/util/socket_util.h"
#include "test/util/temp_path.h"
#include "test/util/test_util.h"

namespace gvisor {
Expand Down Expand Up @@ -424,53 +422,6 @@ std::vector<SocketKind> IoctlSocketTypes() {
INSTANTIATE_TEST_SUITE_P(IoctlTest, IoctlTestSIOCGIFCONF,
::testing::ValuesIn(IoctlSocketTypes()));

// FICLONE/FICLONERANGE/FIDEDUPERANGE should return EOPNOTSUPP on
// filesystems that do not support reflink (e.g. tmpfs).
TEST_F(IoctlTest, FicloneReturnsEopnotsupp) {
auto src = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
auto dst = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
const FileDescriptor src_fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(src.path(), O_RDONLY));
const FileDescriptor dst_fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(dst.path(), O_WRONLY));

EXPECT_THAT(ioctl(dst_fd.get(), FICLONE, src_fd.get()),
SyscallFailsWithErrno(EOPNOTSUPP));
}

TEST_F(IoctlTest, FiclonerangeReturnsEopnotsupp) {
auto src = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
auto dst = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
const FileDescriptor src_fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(src.path(), O_RDONLY));
const FileDescriptor dst_fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(dst.path(), O_WRONLY));

struct file_clone_range range = {};
range.src_fd = src_fd.get();
EXPECT_THAT(ioctl(dst_fd.get(), FICLONERANGE, &range),
SyscallFailsWithErrno(EOPNOTSUPP));
}

TEST_F(IoctlTest, FideduperangeReturnsEopnotsupp) {
auto src = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
auto dst = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
const FileDescriptor src_fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(src.path(), O_RDONLY));
const FileDescriptor dst_fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(dst.path(), O_RDWR));

struct file_dedupe_range* range = static_cast<struct file_dedupe_range*>(
calloc(1, sizeof(*range) + sizeof(struct file_dedupe_range_info)));
ASSERT_NE(range, nullptr);
range->src_length = 0;
range->dest_count = 1;
range->info[0].dest_fd = dst_fd.get();
EXPECT_THAT(ioctl(src_fd.get(), FIDEDUPERANGE, range),
SyscallFailsWithErrno(EOPNOTSUPP));
free(range);
}

} // namespace

TEST_F(IoctlTest, FIOGETOWNSucceeds) {
Expand Down