summaryrefslogtreecommitdiffhomepage
path: root/test/util
diff options
context:
space:
mode:
Diffstat (limited to 'test/util')
-rw-r--r--test/util/mount_util.h6
-rw-r--r--test/util/multiprocess_util.cc2
-rw-r--r--test/util/multiprocess_util.h5
-rw-r--r--test/util/proc_util.cc2
-rw-r--r--test/util/temp_path.cc2
-rw-r--r--test/util/test_util.cc20
-rw-r--r--test/util/test_util.h12
-rw-r--r--test/util/test_util_test.cc4
8 files changed, 27 insertions, 26 deletions
diff --git a/test/util/mount_util.h b/test/util/mount_util.h
index 51119f22f..23eea51a2 100644
--- a/test/util/mount_util.h
+++ b/test/util/mount_util.h
@@ -33,9 +33,9 @@ namespace testing {
// destroyed.
inline PosixErrorOr<Cleanup> Mount(const std::string &source,
const std::string &target,
- const std::string &fstype, uint64 mountflags,
- const std::string &data,
- uint64 umountflags) {
+ const std::string &fstype,
+ uint64_t mountflags, const std::string &data,
+ uint64_t umountflags) {
if (mount(source.c_str(), target.c_str(), fstype.c_str(), mountflags,
data.c_str()) == -1) {
return PosixError(errno, "mount failed");
diff --git a/test/util/multiprocess_util.cc b/test/util/multiprocess_util.cc
index ba601f300..8b676751b 100644
--- a/test/util/multiprocess_util.cc
+++ b/test/util/multiprocess_util.cc
@@ -135,7 +135,7 @@ PosixErrorOr<Cleanup> ForkAndExec(const std::string& filename,
return ForkAndExecHelper(exec_fn, fn, child, execve_errno);
}
-PosixErrorOr<Cleanup> ForkAndExecveat(const int32 dirfd,
+PosixErrorOr<Cleanup> ForkAndExecveat(const int32_t dirfd,
const std::string& pathname,
const ExecveArray& argv,
const ExecveArray& envv, const int flags,
diff --git a/test/util/multiprocess_util.h b/test/util/multiprocess_util.h
index 342e73a52..3e736261b 100644
--- a/test/util/multiprocess_util.h
+++ b/test/util/multiprocess_util.h
@@ -103,13 +103,14 @@ inline PosixErrorOr<Cleanup> ForkAndExec(const std::string& filename,
}
// Equivalent to ForkAndExec, except using dirfd and flags with execveat.
-PosixErrorOr<Cleanup> ForkAndExecveat(int32 dirfd, const std::string& pathname,
+PosixErrorOr<Cleanup> ForkAndExecveat(int32_t dirfd,
+ const std::string& pathname,
const ExecveArray& argv,
const ExecveArray& envv, int flags,
const std::function<void()>& fn,
pid_t* child, int* execve_errno);
-inline PosixErrorOr<Cleanup> ForkAndExecveat(int32 dirfd,
+inline PosixErrorOr<Cleanup> ForkAndExecveat(int32_t dirfd,
const std::string& pathname,
const ExecveArray& argv,
const ExecveArray& envv, int flags,
diff --git a/test/util/proc_util.cc b/test/util/proc_util.cc
index c81f363ef..34d636ba9 100644
--- a/test/util/proc_util.cc
+++ b/test/util/proc_util.cc
@@ -72,7 +72,7 @@ PosixErrorOr<ProcMapsEntry> ParseProcMapsLine(absl::string_view line) {
ASSIGN_OR_RETURN_ERRNO(map_entry.major, AtoiBase(device[0], 16));
ASSIGN_OR_RETURN_ERRNO(map_entry.minor, AtoiBase(device[1], 16));
- ASSIGN_OR_RETURN_ERRNO(map_entry.inode, Atoi<int64>(parts[4]));
+ ASSIGN_OR_RETURN_ERRNO(map_entry.inode, Atoi<int64_t>(parts[4]));
if (parts.size() == 6) {
// A filename is present. However, absl::StrSplit retained the whitespace
// between the inode number and the filename.
diff --git a/test/util/temp_path.cc b/test/util/temp_path.cc
index f5096dd53..35aacb172 100644
--- a/test/util/temp_path.cc
+++ b/test/util/temp_path.cc
@@ -32,7 +32,7 @@ namespace testing {
namespace {
-std::atomic<uint64> global_temp_file_number = ATOMIC_VAR_INIT(1);
+std::atomic<uint64_t> global_temp_file_number = ATOMIC_VAR_INIT(1);
// Return a new temp filename, intended to be unique system-wide.
//
diff --git a/test/util/test_util.cc b/test/util/test_util.cc
index 51f4b4539..848504c88 100644
--- a/test/util/test_util.cc
+++ b/test/util/test_util.cc
@@ -79,7 +79,7 @@ bool IsRunningWithHostinet() {
#endif // defined(__x86_64__)
CPUVendor GetCPUVendor() {
- uint32 eax, ebx, ecx, edx;
+ uint32_t eax, ebx, ecx, edx;
std::string vendor_str;
// Get vendor string (issue CPUID with eax = 0)
GETCPUID(eax, ebx, ecx, edx, 0, 0);
@@ -179,36 +179,36 @@ PosixErrorOr<std::vector<OpenFd>> GetOpenFDs() {
return ret_fds;
}
-PosixErrorOr<uint64> Links(const std::string& path) {
+PosixErrorOr<uint64_t> Links(const std::string& path) {
struct stat st;
if (stat(path.c_str(), &st)) {
return PosixError(errno, absl::StrCat("Failed to stat ", path));
}
- return static_cast<uint64>(st.st_nlink);
+ return static_cast<uint64_t>(st.st_nlink);
}
void RandomizeBuffer(void* buffer, size_t len) {
struct timespec ts = {};
clock_gettime(CLOCK_MONOTONIC, &ts);
- uint32 seed = static_cast<uint32>(ts.tv_nsec);
+ uint32_t seed = static_cast<uint32_t>(ts.tv_nsec);
char* const buf = static_cast<char*>(buffer);
for (size_t i = 0; i < len; i++) {
buf[i] = rand_r(&seed) % 255;
}
}
-std::vector<std::vector<struct iovec>> GenerateIovecs(uint64 total_size,
+std::vector<std::vector<struct iovec>> GenerateIovecs(uint64_t total_size,
void* buf,
size_t buflen) {
std::vector<std::vector<struct iovec>> result;
- for (uint64 offset = 0; offset < total_size;) {
+ for (uint64_t offset = 0; offset < total_size;) {
auto& iovec_array = *result.emplace(result.end());
for (; offset < total_size && iovec_array.size() < IOV_MAX;
offset += buflen) {
struct iovec iov = {};
iov.iov_base = buf;
- iov.iov_len = std::min<uint64>(total_size - offset, buflen);
+ iov.iov_len = std::min<uint64_t>(total_size - offset, buflen);
iovec_array.push_back(iov);
}
}
@@ -216,15 +216,15 @@ std::vector<std::vector<struct iovec>> GenerateIovecs(uint64 total_size,
return result;
}
-uint64 Megabytes(uint64 n) {
+uint64_t Megabytes(uint64_t n) {
// Overflow check, upper 20 bits in n shouldn't be set.
TEST_CHECK(!(0xfffff00000000000 & n));
return n << 20;
}
-bool Equivalent(uint64 current, uint64 target, double tolerance) {
+bool Equivalent(uint64_t current, uint64_t target, double tolerance) {
auto abs_diff = target > current ? target - current : current - target;
- return abs_diff <= static_cast<uint64>(tolerance * target);
+ return abs_diff <= static_cast<uint64_t>(tolerance * target);
}
} // namespace testing
diff --git a/test/util/test_util.h b/test/util/test_util.h
index 6eb46ac76..b3235c7e3 100644
--- a/test/util/test_util.h
+++ b/test/util/test_util.h
@@ -264,7 +264,7 @@ std::ostream& operator<<(std::ostream& out, OpenFd const& ofd);
PosixErrorOr<std::vector<OpenFd>> GetOpenFDs();
// Returns the number of hard links to a path.
-PosixErrorOr<uint64> Links(const std::string& path);
+PosixErrorOr<uint64_t> Links(const std::string& path);
namespace internal {
@@ -706,7 +706,7 @@ inline PosixErrorOr<T> Atoi(absl::string_view str) {
return ret;
}
-inline PosixErrorOr<uint64> AtoiBase(absl::string_view str, int base) {
+inline PosixErrorOr<uint64_t> AtoiBase(absl::string_view str, int base) {
if (base > 255 || base < 2) {
return PosixError(EINVAL, "Invalid Base");
}
@@ -737,16 +737,16 @@ inline PosixErrorOr<float> Atof(absl::string_view str) {
// Return the smallest number of iovec arrays that can be used to write
// "total_bytes" number of bytes, each iovec writing one "buf".
-std::vector<std::vector<struct iovec>> GenerateIovecs(uint64 total_size,
+std::vector<std::vector<struct iovec>> GenerateIovecs(uint64_t total_size,
void* buf, size_t buflen);
// Returns bytes in 'n' megabytes. Used for readability.
-uint64 Megabytes(uint64 n);
+uint64_t Megabytes(uint64_t n);
// Predicate for checking that a value is within some tolerance of another
// value. Returns true iff current is in the range [target * (1 - tolerance),
// target * (1 + tolerance)].
-bool Equivalent(uint64 current, uint64 target, double tolerance);
+bool Equivalent(uint64_t current, uint64_t target, double tolerance);
// Matcher wrapping the Equivalent predicate.
MATCHER_P2(EquivalentWithin, target, tolerance,
@@ -756,7 +756,7 @@ MATCHER_P2(EquivalentWithin, target, tolerance,
if (target == 0) {
*result_listener << ::absl::StreamFormat("difference of infinity%%");
} else {
- int64 delta = static_cast<int64>(arg) - static_cast<int64>(target);
+ int64_t delta = static_cast<int64_t>(arg) - static_cast<int64_t>(target);
double delta_percent =
static_cast<double>(delta) / static_cast<double>(target) * 100;
*result_listener << ::absl::StreamFormat("difference of %.2f%%",
diff --git a/test/util/test_util_test.cc b/test/util/test_util_test.cc
index 024304535..f42100374 100644
--- a/test/util/test_util_test.cc
+++ b/test/util/test_util_test.cc
@@ -171,7 +171,7 @@ MATCHER_P(IovecsListEq, expected, "") {
return false;
}
- for (uint64 i = 0; i < expected.size(); ++i) {
+ for (uint64_t i = 0; i < expected.size(); ++i) {
const std::vector<struct iovec>& actual_iovecs = arg[i];
const std::vector<struct iovec>& expected_iovecs = expected[i];
if (actual_iovecs.size() != expected_iovecs.size()) {
@@ -181,7 +181,7 @@ MATCHER_P(IovecsListEq, expected, "") {
return false;
}
- for (uint64 j = 0; j < expected_iovecs.size(); ++j) {
+ for (uint64_t j = 0; j < expected_iovecs.size(); ++j) {
const struct iovec& actual_iov = actual_iovecs[j];
const struct iovec& expected_iov = expected_iovecs[j];
if (actual_iov.iov_base != expected_iov.iov_base) {