summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/stat.cc
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2020-03-25 14:54:10 -0700
committergVisor bot <gvisor-bot@google.com>2020-03-25 14:59:15 -0700
commite541ebec2fdb5b29209cb3fc8235b77edcaebb6a (patch)
treedd7bf29bd8b447a7b23c38cacfb596771b068ae1 /test/syscalls/linux/stat.cc
parentc7f5673529af758c9f7c95523535174c7929dab5 (diff)
Misc fixes to make stat_test pass (almost)
The only test failing now requires socket which is not available in VFS2 yet. Updates #1198 PiperOrigin-RevId: 302976572
Diffstat (limited to 'test/syscalls/linux/stat.cc')
-rw-r--r--test/syscalls/linux/stat.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/syscalls/linux/stat.cc b/test/syscalls/linux/stat.cc
index 513b9cd1c..2503960f3 100644
--- a/test/syscalls/linux/stat.cc
+++ b/test/syscalls/linux/stat.cc
@@ -34,6 +34,13 @@
#include "test/util/temp_path.h"
#include "test/util/test_util.h"
+#ifndef AT_STATX_FORCE_SYNC
+#define AT_STATX_FORCE_SYNC 0x2000
+#endif
+#ifndef AT_STATX_DONT_SYNC
+#define AT_STATX_DONT_SYNC 0x4000
+#endif
+
namespace gvisor {
namespace testing {
@@ -700,8 +707,10 @@ TEST_F(StatTest, StatxInvalidFlags) {
struct kernel_statx stx;
EXPECT_THAT(statx(AT_FDCWD, test_file_name_.c_str(), 12345, 0, &stx),
SyscallFailsWithErrno(EINVAL));
+
+ // Sync flags are mutually exclusive.
EXPECT_THAT(statx(AT_FDCWD, test_file_name_.c_str(),
- 0x6000 /* AT_STATX_SYNC_TYPE */, 0, &stx),
+ AT_STATX_FORCE_SYNC | AT_STATX_DONT_SYNC, 0, &stx),
SyscallFailsWithErrno(EINVAL));
}