summaryrefslogtreecommitdiffhomepage
path: root/test/util/fs_util.h
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-10-18 15:00:07 -0700
committergVisor bot <gvisor-bot@google.com>2019-10-18 15:01:40 -0700
commit8ae70f864d7ab9ca6aa2b47d144d1a2671857603 (patch)
tree1d70c2f2a59b0abe09c04b9f53619cb57ed81789 /test/util/fs_util.h
parent4e6f3a0c71e4107efb5c9446508876f942b30ec7 (diff)
test/perf: optimize the getdents test
* Use mknod instead of open&close to create an empty file. * Limit a number of files to (1<<16) instead of 100K. In this case, a test set is (1, 8, 64, 512, 4K, 32K, 64K) instead of (1, 8, 64, 512, 4K, 32K, 98K). I think it is easier to compare results for 32K and 64K than 32K and 98K. And results for 98K doesn't give us more information than for 54K. PiperOrigin-RevId: 275552507
Diffstat (limited to 'test/util/fs_util.h')
-rw-r--r--test/util/fs_util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/util/fs_util.h b/test/util/fs_util.h
index e5b555891..ee1b341d7 100644
--- a/test/util/fs_util.h
+++ b/test/util/fs_util.h
@@ -21,6 +21,7 @@
#include <unistd.h>
#include "absl/strings/string_view.h"
+#include "test/util/file_descriptor.h"
#include "test/util/posix_error.h"
namespace gvisor {
@@ -44,6 +45,14 @@ PosixError Delete(absl::string_view path);
// Changes the mode of a file or returns an error.
PosixError Chmod(absl::string_view path, int mode);
+// Create a special or ordinary file.
+PosixError MknodAt(const FileDescriptor& dfd, absl::string_view path, int mode,
+ dev_t dev);
+
+// Unlink the file.
+PosixError UnlinkAt(const FileDescriptor& dfd, absl::string_view path,
+ int flags);
+
// Truncates a file to the given length or returns an error.
PosixError Truncate(absl::string_view path, int length);