summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-06-24 15:18:29 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-24 15:19:36 -0700
commit87df9aab246fc1e72362bafcf98e1a746fd94187 (patch)
treee5070990960f49e0abeb596aae38cbb8554e0ab3 /test/syscalls
parentb21b1db7003aea8615ab9e6a4f07b74c97a32c24 (diff)
Use correct statx syscall number for amd64.
The previous number was for the arm architecture. Also change the statx tests to force them to run on gVisor, which would have caught this issue. PiperOrigin-RevId: 254846831
Diffstat (limited to 'test/syscalls')
-rw-r--r--test/syscalls/linux/stat.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/syscalls/linux/stat.cc b/test/syscalls/linux/stat.cc
index 0e914215d..510f7bee5 100644
--- a/test/syscalls/linux/stat.cc
+++ b/test/syscalls/linux/stat.cc
@@ -558,7 +558,7 @@ TEST(SimpleStatTest, AnonDeviceAllocatesUniqueInodesAcrossSaveRestore) {
#ifndef SYS_statx
#if defined(__x86_64__)
-#define SYS_statx 397
+#define SYS_statx 332
#else
#error "Unknown architecture"
#endif
@@ -607,7 +607,8 @@ int statx(int dirfd, const char *pathname, int flags, unsigned int mask,
}
TEST_F(StatTest, StatxAbsPath) {
- SKIP_IF(statx(-1, nullptr, 0, 0, 0) < 0 && errno == ENOSYS);
+ SKIP_IF(!IsRunningOnGvisor() && statx(-1, nullptr, 0, 0, 0) < 0 &&
+ errno == ENOSYS);
struct kernel_statx stx;
EXPECT_THAT(statx(-1, test_file_name_.c_str(), 0, STATX_ALL, &stx),
@@ -616,7 +617,8 @@ TEST_F(StatTest, StatxAbsPath) {
}
TEST_F(StatTest, StatxRelPathDirFD) {
- SKIP_IF(statx(-1, nullptr, 0, 0, 0) < 0 && errno == ENOSYS);
+ SKIP_IF(!IsRunningOnGvisor() && statx(-1, nullptr, 0, 0, 0) < 0 &&
+ errno == ENOSYS);
struct kernel_statx stx;
auto const dirfd =
@@ -629,7 +631,8 @@ TEST_F(StatTest, StatxRelPathDirFD) {
}
TEST_F(StatTest, StatxRelPathCwd) {
- SKIP_IF(statx(-1, nullptr, 0, 0, 0) < 0 && errno == ENOSYS);
+ SKIP_IF(!IsRunningOnGvisor() && statx(-1, nullptr, 0, 0, 0) < 0 &&
+ errno == ENOSYS);
ASSERT_THAT(chdir(GetAbsoluteTestTmpdir().c_str()), SyscallSucceeds());
auto filename = std::string(Basename(test_file_name_));
@@ -640,7 +643,8 @@ TEST_F(StatTest, StatxRelPathCwd) {
}
TEST_F(StatTest, StatxEmptyPath) {
- SKIP_IF(statx(-1, nullptr, 0, 0, 0) < 0 && errno == ENOSYS);
+ SKIP_IF(!IsRunningOnGvisor() && statx(-1, nullptr, 0, 0, 0) < 0 &&
+ errno == ENOSYS);
const auto fd = ASSERT_NO_ERRNO_AND_VALUE(Open(test_file_name_, O_RDONLY));
struct kernel_statx stx;