Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Elliott Hughes | ca3f8e4 | 2019-10-28 15:59:38 -0700 | [diff] [blame] | 17 | #pragma once |
Elliott Hughes | 33697a0 | 2016-01-26 13:04:57 -0800 | [diff] [blame] | 18 | |
Tom Cherry | fd7216c | 2019-11-05 11:31:42 -0800 | [diff] [blame] | 19 | #include <dirent.h> |
Elliott Hughes | 966d8a3 | 2017-08-29 11:29:28 -0700 | [diff] [blame] | 20 | #include <dlfcn.h> |
Elliott Hughes | a7f1294 | 2017-12-15 13:55:53 -0800 | [diff] [blame] | 21 | #include <fcntl.h> |
Mitch Phillips | 9634c36 | 2022-06-23 11:07:00 -0700 | [diff] [blame] | 22 | #include <gtest/gtest.h> |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 23 | #include <inttypes.h> |
| 24 | #include <sys/mman.h> |
Evgenii Stepanov | 53df1f3 | 2021-07-12 14:44:02 -0700 | [diff] [blame] | 25 | #include <sys/prctl.h> |
Elliott Hughes | 33697a0 | 2016-01-26 13:04:57 -0800 | [diff] [blame] | 26 | #include <sys/types.h> |
| 27 | #include <sys/wait.h> |
Yabin Cui | 76144aa | 2015-11-19 13:52:16 -0800 | [diff] [blame] | 28 | #include <unistd.h> |
| 29 | |
Martin Stjernholm | a276343 | 2020-04-23 16:47:19 +0100 | [diff] [blame] | 30 | #if defined(__BIONIC__) |
Evgeny Eltsin | b56d118 | 2020-06-08 21:12:56 +0200 | [diff] [blame] | 31 | #include <sys/system_properties.h> |
| 32 | #endif |
| 33 | |
| 34 | #if defined(__BIONIC__) |
Peter Collingbourne | 2528dab | 2020-03-12 18:29:52 -0700 | [diff] [blame] | 35 | #include <bionic/macros.h> |
Martin Stjernholm | a276343 | 2020-04-23 16:47:19 +0100 | [diff] [blame] | 36 | #else |
| 37 | #define untag_address(p) p |
| 38 | #endif |
Peter Collingbourne | 2528dab | 2020-03-12 18:29:52 -0700 | [diff] [blame] | 39 | |
Yabin Cui | 76144aa | 2015-11-19 13:52:16 -0800 | [diff] [blame] | 40 | #include <atomic> |
Elliott Hughes | abbec33 | 2024-05-20 13:12:09 +0000 | [diff] [blame] | 41 | #include <iomanip> |
Yabin Cui | 76144aa | 2015-11-19 13:52:16 -0800 | [diff] [blame] | 42 | #include <string> |
| 43 | #include <regex> |
| 44 | |
Elliott Hughes | 939a7e0 | 2015-12-04 15:27:46 -0800 | [diff] [blame] | 45 | #include <android-base/file.h> |
Elliott Hughes | 4af70b4 | 2017-11-28 18:02:16 -0800 | [diff] [blame] | 46 | #include <android-base/macros.h> |
Tom Cherry | b8ab618 | 2017-04-05 16:20:29 -0700 | [diff] [blame] | 47 | #include <android-base/scopeguard.h> |
Elliott Hughes | 939a7e0 | 2015-12-04 15:27:46 -0800 | [diff] [blame] | 48 | #include <android-base/stringprintf.h> |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 49 | |
Dimitry Ivanov | 35c8e3b | 2017-02-27 12:17:47 -0800 | [diff] [blame] | 50 | #if defined(__LP64__) |
| 51 | #define PATH_TO_SYSTEM_LIB "/system/lib64/" |
| 52 | #else |
| 53 | #define PATH_TO_SYSTEM_LIB "/system/lib/" |
| 54 | #endif |
| 55 | |
Elliott Hughes | 14e3ff9 | 2017-10-06 16:58:36 -0700 | [diff] [blame] | 56 | #if defined(__GLIBC__) |
| 57 | #define BIN_DIR "/bin/" |
| 58 | #else |
| 59 | #define BIN_DIR "/system/bin/" |
| 60 | #endif |
| 61 | |
Josh Gao | 2f06e10 | 2017-01-10 13:00:37 -0800 | [diff] [blame] | 62 | #if defined(__BIONIC__) |
| 63 | #define KNOWN_FAILURE_ON_BIONIC(x) xfail_ ## x |
| 64 | #else |
| 65 | #define KNOWN_FAILURE_ON_BIONIC(x) x |
| 66 | #endif |
| 67 | |
Elliott Hughes | 966d8a3 | 2017-08-29 11:29:28 -0700 | [diff] [blame] | 68 | // bionic's dlsym doesn't work in static binaries, so we can't access icu, |
| 69 | // so any unicode test case will fail. |
| 70 | static inline bool have_dl() { |
| 71 | return (dlopen("libc.so", 0) != nullptr); |
| 72 | } |
| 73 | |
Evgeny Eltsin | b56d118 | 2020-06-08 21:12:56 +0200 | [diff] [blame] | 74 | static inline bool running_with_native_bridge() { |
| 75 | #if defined(__BIONIC__) |
Lev Rumyantsev | 37c5ed3 | 2020-09-18 15:09:01 -0700 | [diff] [blame] | 76 | static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa." ABI_STRING); |
Evgeny Eltsin | b56d118 | 2020-06-08 21:12:56 +0200 | [diff] [blame] | 77 | return pi != nullptr; |
Evgeny Eltsin | b56d118 | 2020-06-08 21:12:56 +0200 | [diff] [blame] | 78 | #endif |
| 79 | return false; |
| 80 | } |
| 81 | |
| 82 | #define SKIP_WITH_NATIVE_BRIDGE if (running_with_native_bridge()) GTEST_SKIP() |
| 83 | |
Elliott Hughes | ffbb0f8 | 2016-10-10 18:34:27 -0700 | [diff] [blame] | 84 | #if defined(__linux__) |
| 85 | |
Elliott Hughes | 3fa758f | 2017-05-17 17:36:08 -0700 | [diff] [blame] | 86 | #include <sys/sysmacros.h> |
| 87 | |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 88 | struct map_record { |
| 89 | uintptr_t addr_start; |
| 90 | uintptr_t addr_end; |
| 91 | |
| 92 | int perms; |
| 93 | |
| 94 | size_t offset; |
| 95 | |
| 96 | dev_t device; |
| 97 | ino_t inode; |
| 98 | |
| 99 | std::string pathname; |
| 100 | }; |
| 101 | |
| 102 | class Maps { |
| 103 | public: |
| 104 | static bool parse_maps(std::vector<map_record>* maps) { |
Elliott Hughes | a838490 | 2017-10-03 10:18:58 -0700 | [diff] [blame] | 105 | maps->clear(); |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 106 | |
Elliott Hughes | a838490 | 2017-10-03 10:18:58 -0700 | [diff] [blame] | 107 | std::unique_ptr<FILE, decltype(&fclose)> fp(fopen("/proc/self/maps", "re"), fclose); |
| 108 | if (!fp) return false; |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 109 | |
| 110 | char line[BUFSIZ]; |
Elliott Hughes | a838490 | 2017-10-03 10:18:58 -0700 | [diff] [blame] | 111 | while (fgets(line, sizeof(line), fp.get()) != nullptr) { |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 112 | map_record record; |
Dmitriy Ivanov | 1dce3ed | 2015-04-06 19:05:58 -0700 | [diff] [blame] | 113 | uint32_t dev_major, dev_minor; |
Elliott Hughes | 15dfd63 | 2015-09-22 16:40:14 -0700 | [diff] [blame] | 114 | int path_offset; |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 115 | char prot[5]; // sizeof("rwxp") |
Elliott Hughes | 15dfd63 | 2015-09-22 16:40:14 -0700 | [diff] [blame] | 116 | if (sscanf(line, "%" SCNxPTR "-%" SCNxPTR " %4s %" SCNxPTR " %x:%x %lu %n", |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 117 | &record.addr_start, &record.addr_end, prot, &record.offset, |
Elliott Hughes | 15dfd63 | 2015-09-22 16:40:14 -0700 | [diff] [blame] | 118 | &dev_major, &dev_minor, &record.inode, &path_offset) == 7) { |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 119 | record.perms = 0; |
| 120 | if (prot[0] == 'r') { |
| 121 | record.perms |= PROT_READ; |
| 122 | } |
| 123 | if (prot[1] == 'w') { |
| 124 | record.perms |= PROT_WRITE; |
| 125 | } |
| 126 | if (prot[2] == 'x') { |
| 127 | record.perms |= PROT_EXEC; |
| 128 | } |
| 129 | |
| 130 | // TODO: parse shared/private? |
| 131 | |
| 132 | record.device = makedev(dev_major, dev_minor); |
Elliott Hughes | 15dfd63 | 2015-09-22 16:40:14 -0700 | [diff] [blame] | 133 | record.pathname = line + path_offset; |
| 134 | if (!record.pathname.empty() && record.pathname.back() == '\n') { |
| 135 | record.pathname.pop_back(); |
| 136 | } |
Dmitriy Ivanov | aae859c | 2015-03-31 11:14:03 -0700 | [diff] [blame] | 137 | maps->push_back(record); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | return true; |
| 142 | } |
| 143 | }; |
| 144 | |
Yabin Cui | 76144aa | 2015-11-19 13:52:16 -0800 | [diff] [blame] | 145 | extern "C" pid_t gettid(); |
| 146 | |
Elliott Hughes | ffbb0f8 | 2016-10-10 18:34:27 -0700 | [diff] [blame] | 147 | #endif |
| 148 | |
Yabin Cui | 76144aa | 2015-11-19 13:52:16 -0800 | [diff] [blame] | 149 | static inline void WaitUntilThreadSleep(std::atomic<pid_t>& tid) { |
| 150 | while (tid == 0) { |
| 151 | usleep(1000); |
| 152 | } |
| 153 | std::string filename = android::base::StringPrintf("/proc/%d/stat", tid.load()); |
| 154 | std::regex regex {R"(\s+S\s+)"}; |
| 155 | |
| 156 | while (true) { |
| 157 | std::string content; |
| 158 | ASSERT_TRUE(android::base::ReadFileToString(filename, &content)); |
| 159 | if (std::regex_search(content, regex)) { |
| 160 | break; |
| 161 | } |
| 162 | usleep(1000); |
| 163 | } |
| 164 | } |
| 165 | |
Christopher Ferris | d6a1dc2 | 2018-02-07 18:42:14 -0800 | [diff] [blame] | 166 | static inline void AssertChildExited(int pid, int expected_exit_status, |
| 167 | const std::string* error_msg = nullptr) { |
Elliott Hughes | 33697a0 | 2016-01-26 13:04:57 -0800 | [diff] [blame] | 168 | int status; |
Christopher Ferris | d6a1dc2 | 2018-02-07 18:42:14 -0800 | [diff] [blame] | 169 | std::string error; |
| 170 | if (error_msg == nullptr) { |
| 171 | error_msg = &error; |
| 172 | } |
| 173 | ASSERT_EQ(pid, TEMP_FAILURE_RETRY(waitpid(pid, &status, 0))) << *error_msg; |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 174 | if (expected_exit_status >= 0) { |
Christopher Ferris | d6a1dc2 | 2018-02-07 18:42:14 -0800 | [diff] [blame] | 175 | ASSERT_TRUE(WIFEXITED(status)) << *error_msg; |
| 176 | ASSERT_EQ(expected_exit_status, WEXITSTATUS(status)) << *error_msg; |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 177 | } else { |
Christopher Ferris | d6a1dc2 | 2018-02-07 18:42:14 -0800 | [diff] [blame] | 178 | ASSERT_TRUE(WIFSIGNALED(status)) << *error_msg; |
| 179 | ASSERT_EQ(-expected_exit_status, WTERMSIG(status)) << *error_msg; |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 180 | } |
Elliott Hughes | 33697a0 | 2016-01-26 13:04:57 -0800 | [diff] [blame] | 181 | } |
| 182 | |
Elliott Hughes | f9cfecf | 2021-02-04 16:58:13 -0800 | [diff] [blame] | 183 | static inline bool CloseOnExec(int fd) { |
Elliott Hughes | a7f1294 | 2017-12-15 13:55:53 -0800 | [diff] [blame] | 184 | int flags = fcntl(fd, F_GETFD); |
Elliott Hughes | f9cfecf | 2021-02-04 16:58:13 -0800 | [diff] [blame] | 185 | // This isn't ideal, but the alternatives are worse: |
| 186 | // * If we return void and use ASSERT_NE here, we get failures at utils.h:191 |
| 187 | // rather than in the relevant test. |
| 188 | // * If we ignore failures of fcntl(), well, that's obviously a bad idea. |
| 189 | if (flags == -1) abort(); |
| 190 | return flags & FD_CLOEXEC; |
Elliott Hughes | a7f1294 | 2017-12-15 13:55:53 -0800 | [diff] [blame] | 191 | } |
| 192 | |
Dimitry Ivanov | 2ba1cf3 | 2016-05-17 13:29:37 -0700 | [diff] [blame] | 193 | // The absolute path to the executable |
| 194 | const std::string& get_executable_path(); |
Dimitry Ivanov | d17a377 | 2016-03-01 13:11:28 -0800 | [diff] [blame] | 195 | |
Dimitry Ivanov | 5543746 | 2016-07-20 15:33:07 -0700 | [diff] [blame] | 196 | // Access to argc/argv/envp |
| 197 | int get_argc(); |
| 198 | char** get_argv(); |
| 199 | char** get_envp(); |
| 200 | |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 201 | // ExecTestHelper is only used in bionic and glibc tests. |
| 202 | #ifndef __APPLE__ |
| 203 | class ExecTestHelper { |
| 204 | public: |
| 205 | char** GetArgs() { |
| 206 | return const_cast<char**>(args_.data()); |
| 207 | } |
Elliott Hughes | 14e3ff9 | 2017-10-06 16:58:36 -0700 | [diff] [blame] | 208 | const char* GetArg0() { |
| 209 | return args_[0]; |
| 210 | } |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 211 | char** GetEnv() { |
| 212 | return const_cast<char**>(env_.data()); |
| 213 | } |
Ryan Prichard | 8f639a4 | 2018-10-01 23:10:05 -0700 | [diff] [blame] | 214 | const std::string& GetOutput() { |
| 215 | return output_; |
| 216 | } |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 217 | |
Elliott Hughes | 5cec377 | 2018-01-19 15:45:23 -0800 | [diff] [blame] | 218 | void SetArgs(const std::vector<const char*>& args) { |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 219 | args_ = args; |
| 220 | } |
Elliott Hughes | 5cec377 | 2018-01-19 15:45:23 -0800 | [diff] [blame] | 221 | void SetEnv(const std::vector<const char*>& env) { |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 222 | env_ = env; |
| 223 | } |
| 224 | |
| 225 | void Run(const std::function<void()>& child_fn, int expected_exit_status, |
Elliott Hughes | 419554e | 2021-10-01 10:12:15 -0700 | [diff] [blame] | 226 | const char* expected_output_regex) { |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 227 | int fds[2]; |
| 228 | ASSERT_NE(pipe(fds), -1); |
| 229 | |
| 230 | pid_t pid = fork(); |
| 231 | ASSERT_NE(pid, -1); |
| 232 | |
| 233 | if (pid == 0) { |
| 234 | // Child. |
| 235 | close(fds[0]); |
| 236 | dup2(fds[1], STDOUT_FILENO); |
| 237 | dup2(fds[1], STDERR_FILENO); |
| 238 | if (fds[1] != STDOUT_FILENO && fds[1] != STDERR_FILENO) close(fds[1]); |
| 239 | child_fn(); |
| 240 | FAIL(); |
| 241 | } |
| 242 | |
| 243 | // Parent. |
| 244 | close(fds[1]); |
Ryan Prichard | 8f639a4 | 2018-10-01 23:10:05 -0700 | [diff] [blame] | 245 | output_.clear(); |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 246 | char buf[BUFSIZ]; |
| 247 | ssize_t bytes_read; |
| 248 | while ((bytes_read = TEMP_FAILURE_RETRY(read(fds[0], buf, sizeof(buf)))) > 0) { |
Ryan Prichard | 8f639a4 | 2018-10-01 23:10:05 -0700 | [diff] [blame] | 249 | output_.append(buf, bytes_read); |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 250 | } |
| 251 | close(fds[0]); |
| 252 | |
Ryan Prichard | 8f639a4 | 2018-10-01 23:10:05 -0700 | [diff] [blame] | 253 | std::string error_msg("Test output:\n" + output_); |
Christopher Ferris | d6a1dc2 | 2018-02-07 18:42:14 -0800 | [diff] [blame] | 254 | AssertChildExited(pid, expected_exit_status, &error_msg); |
Elliott Hughes | 419554e | 2021-10-01 10:12:15 -0700 | [diff] [blame] | 255 | if (expected_output_regex != nullptr) { |
Steven Moreland | 4ef83d6 | 2021-10-07 00:19:18 +0000 | [diff] [blame] | 256 | if (!std::regex_search(output_, std::regex(expected_output_regex))) { |
Elliott Hughes | abbec33 | 2024-05-20 13:12:09 +0000 | [diff] [blame] | 257 | FAIL() << "regex " << std::quoted(expected_output_regex) << " didn't match " << std::quoted(output_); |
Steven Moreland | 4ef83d6 | 2021-10-07 00:19:18 +0000 | [diff] [blame] | 258 | } |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 259 | } |
| 260 | } |
| 261 | |
| 262 | private: |
| 263 | std::vector<const char*> args_; |
| 264 | std::vector<const char*> env_; |
Ryan Prichard | 8f639a4 | 2018-10-01 23:10:05 -0700 | [diff] [blame] | 265 | std::string output_; |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 266 | }; |
Mitch Phillips | e6997d5 | 2020-11-30 15:04:14 -0800 | [diff] [blame] | 267 | |
| 268 | void RunGwpAsanTest(const char* test_name); |
Mitch Phillips | 9634c36 | 2022-06-23 11:07:00 -0700 | [diff] [blame] | 269 | void RunSubtestNoEnv(const char* test_name); |
Evgenii Stepanov | 68ecec1 | 2017-01-31 13:19:30 -0800 | [diff] [blame] | 270 | #endif |
Tom Cherry | fd7216c | 2019-11-05 11:31:42 -0800 | [diff] [blame] | 271 | |
| 272 | class FdLeakChecker { |
| 273 | public: |
| 274 | FdLeakChecker() { |
| 275 | } |
| 276 | |
| 277 | ~FdLeakChecker() { |
| 278 | size_t end_count = CountOpenFds(); |
| 279 | EXPECT_EQ(start_count_, end_count); |
| 280 | } |
| 281 | |
| 282 | private: |
| 283 | static size_t CountOpenFds() { |
| 284 | auto fd_dir = std::unique_ptr<DIR, decltype(&closedir)>{ opendir("/proc/self/fd"), closedir }; |
| 285 | size_t count = 0; |
| 286 | dirent* de = nullptr; |
| 287 | while ((de = readdir(fd_dir.get())) != nullptr) { |
| 288 | if (de->d_type == DT_LNK) { |
| 289 | ++count; |
| 290 | } |
| 291 | } |
| 292 | return count; |
| 293 | } |
| 294 | |
| 295 | size_t start_count_ = CountOpenFds(); |
| 296 | }; |
Elliott Hughes | 7cda75f | 2020-10-22 13:22:35 -0700 | [diff] [blame] | 297 | |
Liana Kazanova | f5d5f83 | 2024-09-30 19:20:35 +0000 | [diff] [blame^] | 298 | // From <benchmark/benchmark.h>. |
| 299 | template <class Tp> |
| 300 | static inline void DoNotOptimize(Tp const& value) { |
| 301 | asm volatile("" : : "r,m"(value) : "memory"); |
| 302 | } |
| 303 | template <class Tp> |
| 304 | static inline void DoNotOptimize(Tp& value) { |
| 305 | asm volatile("" : "+r,m"(value) : : "memory"); |
| 306 | } |
| 307 | |
Evgenii Stepanov | 53df1f3 | 2021-07-12 14:44:02 -0700 | [diff] [blame] | 308 | static inline bool running_with_mte() { |
| 309 | #ifdef __aarch64__ |
| 310 | int level = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0); |
| 311 | return level >= 0 && (level & PR_TAGGED_ADDR_ENABLE) && |
| 312 | (level & PR_MTE_TCF_MASK) != PR_MTE_TCF_NONE; |
| 313 | #else |
| 314 | return false; |
| 315 | #endif |
| 316 | } |
Christopher Ferris | 02b6bbc | 2022-06-02 15:20:23 -0700 | [diff] [blame] | 317 | |
| 318 | bool IsLowRamDevice(); |
Elliott Hughes | 95646e6 | 2023-09-21 14:11:19 -0700 | [diff] [blame] | 319 | |
Nate Myren | 0ab0615 | 2023-10-19 16:50:59 -0700 | [diff] [blame] | 320 | int64_t NanoTime(); |
| 321 | |
Elliott Hughes | 95646e6 | 2023-09-21 14:11:19 -0700 | [diff] [blame] | 322 | class Errno { |
| 323 | public: |
| 324 | Errno(int e) : errno_(e) {} |
| 325 | int errno_; |
| 326 | }; |
| 327 | void PrintTo(const Errno& e, std::ostream* os); |
| 328 | bool operator==(const Errno& lhs, const Errno& rhs); |
| 329 | #define ASSERT_ERRNO(expected_errno) ASSERT_EQ(Errno(expected_errno), Errno(errno)) |
| 330 | #define EXPECT_ERRNO(expected_errno) EXPECT_EQ(Errno(expected_errno), Errno(errno)) |