File: unit_test_util.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (557 lines) | stat: -rw-r--r-- 20,487 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/updater/test/unit_test_util.h"

#include <cstdint>
#include <memory>
#include <optional>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#include "base/base_paths.h"
#include "base/check.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/functional/function_ref.h"
#include "base/i18n/time_formatting.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/path_service.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/process/process_iterator.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/version.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/policy/manager.h"
#include "chrome/updater/policy/service.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/tag.h"
#include "chrome/updater/test/test_scope.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util/util.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_WIN)
#include <shlobj.h>

#include "base/win/scoped_handle.h"
#include "chrome/test/base/process_inspector_win.h"
#include "chrome/updater/util/win_util.h"
#include "chrome/updater/win/test/test_executables.h"
#endif

namespace updater::test {

namespace {

// CustomLogPrinter intercepts test part results and prints them using
// Chromium logging, so that assertion failures are tagged with process IDs
// and timestamps.
class CustomLogPrinter : public testing::TestEventListener {
 public:
  // Takes ownership of impl.
  explicit CustomLogPrinter(testing::TestEventListener* impl) : impl_(impl) {}
  CustomLogPrinter(const CustomLogPrinter&) = delete;
  CustomLogPrinter& operator=(const CustomLogPrinter&) = delete;

  // testing::TestEventListener
  void OnTestProgramStart(const testing::UnitTest& unit_test) override {
    impl_->OnTestProgramStart(unit_test);
  }

  void OnTestIterationStart(const testing::UnitTest& unit_test,
                            int iteration) override {
    impl_->OnTestIterationStart(unit_test, iteration);
  }

  void OnEnvironmentsSetUpStart(const testing::UnitTest& unit_test) override {
    impl_->OnEnvironmentsSetUpStart(unit_test);
  }

  void OnEnvironmentsSetUpEnd(const testing::UnitTest& unit_test) override {
    impl_->OnEnvironmentsSetUpEnd(unit_test);
  }

  void OnTestStart(const testing::TestInfo& test_info) override {
    impl_->OnTestStart(test_info);
  }

  // Use Chromium's logging format, so that the process ID and timestamp of the
  // result can be recorded and compared to other lines in the log files.
  void OnTestPartResult(const testing::TestPartResult& result) override {
    if (result.type() == testing::TestPartResult::kSuccess) {
      return;
    }
    logging::LogMessage(result.file_name(), result.line_number(),
                        logging::LOGGING_ERROR)
            .stream()
        << result.message();
  }

  void OnTestEnd(const testing::TestInfo& test_info) override {
    impl_->OnTestEnd(test_info);
  }

  void OnEnvironmentsTearDownStart(
      const testing::UnitTest& unit_test) override {
    impl_->OnEnvironmentsTearDownStart(unit_test);
  }

  void OnEnvironmentsTearDownEnd(const testing::UnitTest& unit_test) override {
    impl_->OnEnvironmentsTearDownEnd(unit_test);
  }

  void OnTestIterationEnd(const testing::UnitTest& unit_test,
                          int iteration) override {
    impl_->OnTestIterationEnd(unit_test, iteration);
  }

  void OnTestProgramEnd(const testing::UnitTest& unit_test) override {
    impl_->OnTestProgramEnd(unit_test);
  }

 private:
  std::unique_ptr<testing::TestEventListener> impl_;
};

// Creates Prefs with the fake updater version set as active.
void SetupFakeUpdaterPrefs(UpdaterScope scope, const base::Version& version) {
  scoped_refptr<GlobalPrefs> global_prefs = CreateGlobalPrefs(scope);
  ASSERT_TRUE(global_prefs) << "No global prefs.";
  global_prefs->SetActiveVersion(version.GetString());
  global_prefs->SetSwapping(false);
  PrefsCommitPendingWrites(global_prefs->GetPrefService());
  ASSERT_EQ(version.GetString(), global_prefs->GetActiveVersion());
}

// Creates an install folder on the system with the fake updater version.
void SetupFakeUpdaterInstallFolder(UpdaterScope scope,
                                   const base::Version& version,
                                   bool should_create_updater_executable) {
  std::optional<base::FilePath> folder_path =
      GetVersionedInstallDirectory(scope, version);
  ASSERT_TRUE(folder_path);
  const base::FilePath updater_executable_path(
      folder_path->Append(GetExecutableRelativePath()));
  ASSERT_TRUE(base::CreateDirectory(updater_executable_path.DirName()));

  if (should_create_updater_executable) {
    // Create a fake `updater.exe` inside the install folder.
    ASSERT_TRUE(base::CopyFile(folder_path->DirName().AppendUTF8("prefs.json"),
                               updater_executable_path));
  }
}

void SetupFakeUpdater(UpdaterScope scope,
                      const base::Version& version,
                      bool should_create_updater_executable) {
  SetupFakeUpdaterPrefs(scope, version);
  SetupFakeUpdaterInstallFolder(scope, version,
                                should_create_updater_executable);
}

}  // namespace

bool IsProcessRunning(const base::FilePath::StringType& executable_name,
                      const base::ProcessFilter* filter) {
  return base::GetProcessCount(executable_name, filter) != 0;
}

bool WaitForProcessesToExit(const base::FilePath::StringType& executable_name,
                            base::TimeDelta wait,
                            const base::ProcessFilter* filter) {
  return base::WaitForProcessesToExit(executable_name, wait, filter);
}

bool KillProcesses(const base::FilePath::StringType& executable_name,
                   int exit_code,
                   const base::ProcessFilter* filter) {
  bool result = true;
  for (const base::ProcessEntry& entry :
       base::NamedProcessIterator(executable_name, filter).Snapshot()) {
    base::Process process = base::Process::Open(entry.pid());
    if (!process.IsValid()) {
      PLOG(ERROR) << "Process invalid for PID: " << executable_name << ": "
                  << entry.pid();
      result = false;
      continue;
    }

    const bool process_terminated = process.Terminate(exit_code, true);

#if BUILDFLAG(IS_WIN)
    PLOG_IF(ERROR, !process_terminated &&
                       !::TerminateProcess(process.Handle(),
                                           static_cast<UINT>(exit_code)))
        << "::TerminateProcess failed: " << executable_name << ": "
        << entry.pid();
#endif  // BUILDFLAG(IS_WIN)

    result &= process_terminated;
  }
  return result;
}

scoped_refptr<PolicyService> CreateTestPolicyService() {
  return base::MakeRefCounted<PolicyService>(
      /*external_constants=*/nullptr,
      /*persisted_data=*/nullptr);
}

std::string GetTestName() {
  const ::testing::TestInfo* test_info =
      ::testing::UnitTest::GetInstance()->current_test_info();
  return test_info ? base::StrCat(
                         {test_info->test_suite_name(), ".", test_info->name()})
                   : "?.?";
}

bool DeleteFileAndEmptyParentDirectories(
    std::optional<base::FilePath> file_path) {
  struct Local {
    // Deletes recursively `dir` and its parents up, if dir is empty
    // and until one non-empty parent directory is found.
    static bool DeleteDirsIfEmpty(const base::FilePath& dir) {
      if (!base::DirectoryExists(dir) || !base::IsDirectoryEmpty(dir)) {
        return true;
      }
      if (!base::DeleteFile(dir)) {
        return false;
      }
      return DeleteDirsIfEmpty(dir.DirName());
    }
  };

  if (!file_path || !base::DeleteFile(*file_path)) {
    return false;
  }
  return Local::DeleteDirsIfEmpty(file_path->DirName());
}

base::FilePath GetLogDestinationDir() {
  const char* var = std::getenv("ISOLATED_OUTDIR");
  return var ? base::FilePath::FromUTF8Unsafe(var) : base::FilePath();
}

void InitLoggingForUnitTest(const base::FilePath& log_base_path) {
  const std::optional<base::FilePath> log_file_path = [&log_base_path] {
    const base::FilePath dest_dir = GetLogDestinationDir();
    return dest_dir.empty()
               ? std::nullopt
               : std::make_optional(dest_dir.Append(log_base_path));
  }();
  if (log_file_path) {
    logging::LoggingSettings settings;
    settings.log_file_path = (*log_file_path).value().c_str();
    settings.logging_dest = logging::LOG_TO_ALL;
    logging::InitLogging(settings);
    base::FilePath file_exe;
    const bool succeeded = base::PathService::Get(base::FILE_EXE, &file_exe);
    VLOG_IF(0, succeeded) << "Log initialized for " << file_exe.value()
                          << " -> " << settings.log_file_path;
  }
  logging::SetLogItems(/*enable_process_id=*/true,
                       /*enable_thread_id=*/true,
                       /*enable_timestamp=*/true,
                       /*enable_tickcount=*/false);
  testing::TestEventListeners& listeners =
      testing::UnitTest::GetInstance()->listeners();
  listeners.Append(new CustomLogPrinter(
      listeners.Release(listeners.default_result_printer())));
}

#if BUILDFLAG(IS_WIN)
namespace {
const wchar_t kProcmonPath[] = L"C:\\tools\\Procmon.exe";
}  // namespace

base::FilePath StartProcmonLogging() {
  if (!::IsUserAnAdmin()) {
    LOG(WARNING) << __func__
                 << ": user is not an admin, skipping procmon logging";
    return {};
  }

  if (!base::PathExists(base::FilePath(kProcmonPath))) {
    LOG(WARNING) << __func__
                 << ": procmon missing, skipping logging: " << kProcmonPath;
    return {};
  }

  base::FilePath dest_dir = GetLogDestinationDir();
  if (dest_dir.empty() || !base::PathExists(dest_dir)) {
    LOG(ERROR) << __func__ << ": failed to get log destination dir";
    return {};
  }

  dest_dir = dest_dir.AppendUTF8(GetTestName());
  if (!base::CreateDirectory(dest_dir)) {
    LOG(ERROR) << __func__
               << ": failed to create log destination dir: " << dest_dir;
    return {};
  }

  const base::FilePath pmc_path(GetTestFilePath("ProcmonConfiguration.pmc"));
  CHECK(base::PathExists(pmc_path));

  const base::FilePath pml_file(
      dest_dir.Append(base::UTF8ToWide(base::UnlocalizedTimeFormatWithPattern(
          base::Time::Now(), "yyMMdd-HHmmss.'PML'"))));

  const std::wstring& cmdline = base::StrCat(
      {kProcmonPath, L" /AcceptEula /LoadConfig ",
       base::CommandLine::QuoteForCommandLineToArgvW(pmc_path.value()),
       L" /BackingFile ",
       base::CommandLine::QuoteForCommandLineToArgvW(pml_file.value()),
       L" /Quiet /externalcapture"});
  base::LaunchOptions options;
  options.start_hidden = true;
  VLOG(1) << __func__ << ": running: " << cmdline;
  const base::Process process = base::LaunchProcess(cmdline, options);

  if (!process.IsValid()) {
    LOG(ERROR) << __func__ << ": failed to run: " << cmdline;
    return {};
  }

  // Gives time for the procmon process to start logging. Without a sleep,
  // `procmon` is unable to fully initialize the logging, and subsequently when
  // `procmon /Terminate` is called to terminate the logging `procmon`, it
  // causes the PML log file to corrupt.
  base::PlatformThread::Sleep(base::Seconds(3));

  return pml_file;
}

void StopProcmonLogging(const base::FilePath& pml_file) {
  if (!::IsUserAnAdmin() || !base::PathExists(base::FilePath(kProcmonPath)) ||
      !pml_file.MatchesFinalExtension(L".PML")) {
    return;
  }

  for (const std::wstring& cmdline :
       {base::StrCat({kProcmonPath, L" /Terminate"})}) {
    base::LaunchOptions options;
    options.start_hidden = true;
    options.wait = true;
    VLOG(1) << __func__ << ": running: " << cmdline;
    const base::Process process = base::LaunchProcess(cmdline, options);
    LOG_IF(ERROR, !process.IsValid())
        << __func__ << ": failed to run: " << cmdline;
  }

  // Make a copy of the PML file in case the original gets deleted.
  if (!base::CopyFile(pml_file, pml_file.ReplaceExtension(L".PML.BAK"))) {
    LOG(ERROR) << __func__ << ": failed to backup pml file";
  }
}

EventHolder CreateWaitableEventForTest() {
  NamedObjectAttributes attr = GetNamedObjectAttributes(
      base::NumberToWString(::GetCurrentProcessId()).c_str(),
      GetUpdaterScopeForTesting());
  return {base::WaitableEvent(base::win::ScopedHandle(
              ::CreateEvent(&attr.sa, FALSE, FALSE, attr.name.c_str()))),
          attr.name};
}
#endif  // BUILDFLAG(IS_WIN)

const base::ProcessIterator::ProcessEntries FindProcesses(
    const base::FilePath::StringType& executable_name,
    const base::ProcessFilter* filter) {
  return base::NamedProcessIterator(executable_name, filter).Snapshot();
}

std::string PrintProcesses(const base::FilePath::StringType& executable_name,
                           const base::ProcessFilter* filter) {
  const std::string demarcation(72, '=');
  std::stringstream message;
  message << "Found processes:" << std::endl << demarcation << std::endl;
  for (const base::ProcessEntry& entry :
       FindProcesses(executable_name, filter)) {
    message << entry.exe_file() << ", pid=" << entry.pid()
            << ", creation time=" << [](base::ProcessId pid) {
                 const base::Process process = base::Process::Open(pid);
                 return process.IsValid()
                            ? base::TimeFormatHTTP(process.CreationTime())
                            : "n/a";
               }(entry.pid());
#if BUILDFLAG(IS_WIN)
    message << ", cmdline=" << [](base::ProcessId pid) {
      std::unique_ptr<ProcessInspector> process_inspector =
          ProcessInspector::Create(base::Process::OpenWithAccess(
              pid, PROCESS_ALL_ACCESS | PROCESS_VM_READ));
      return process_inspector ? process_inspector->command_line() : L"n/a";
    }(entry.pid());
#endif
    message << std::endl;
  }
  message << demarcation << std::endl;
  return message.str();
}

bool WaitFor(base::FunctionRef<bool()> predicate,
             base::FunctionRef<void()> still_waiting) {
  static constexpr base::TimeDelta kOutputInterval = base::Seconds(10);
  auto notify_next = base::TimeTicks::Now() + kOutputInterval;
  const auto deadline = base::TimeTicks::Now() + TestTimeouts::action_timeout();
  while (base::TimeTicks::Now() < deadline) {
    if (predicate()) {
      return true;
    }
    if (notify_next < base::TimeTicks::Now()) {
      still_waiting();
      notify_next += kOutputInterval;
    }
    base::PlatformThread::Sleep(TestTimeouts::tiny_timeout());
  }
  return false;
}

base::FilePath GetTestFilePath(const char* file_name) {
  base::FilePath test_data_root;
  base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &test_data_root);
  return test_data_root.AppendUTF8("chrome")
      .AppendUTF8("updater")
      .AppendUTF8("test")
      .AppendUTF8("data")
      .AppendUTF8(file_name);
}

void SetupFakeUpdaterVersion(UpdaterScope scope,
                             const base::Version& base_version,
                             int major_version_offset,
                             bool should_create_updater_executable) {
  std::vector<uint32_t> components = base_version.components();
  base::CheckedNumeric<uint32_t> new_version = components[0];
  new_version += major_version_offset;
  ASSERT_TRUE(new_version.AssignIfValid(&components[0]));
  SetupFakeUpdater(scope, base::Version(std::move(components)),
                   should_create_updater_executable);
}

void SetupMockUpdater(const base::FilePath& mock_updater_path) {
  const base::FilePath updater_dir(mock_updater_path.DirName());

#if BUILDFLAG(IS_WIN)
  // A valid executable is needed for Windows.
  const base::FilePath test_executable(
      GetTestProcessCommandLine(GetUpdaterScopeForTesting(),
                                test::GetTestName())
          .GetProgram());
#else
  // Create an empty temporary file.
  base::ScopedTempDir temp_dir;
  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
  const base::FilePath test_executable(
      temp_dir.GetPath().Append(mock_updater_path.BaseName()));
  base::File file(test_executable,
                  base::File::FLAG_CREATE | base::File::FLAG_WRITE);
  ASSERT_TRUE(file.IsValid());
#endif

  for (const base::FilePath& dir :
       {updater_dir, updater_dir.Append(FILE_PATH_LITERAL("1.2.3.4")),
        updater_dir.Append(FILE_PATH_LITERAL("Download")),
        updater_dir.Append(FILE_PATH_LITERAL("Install"))}) {
    ASSERT_TRUE(base::CreateDirectory(dir));

    for (const base::FilePath& executable_name :
         {mock_updater_path.BaseName(),
          base::FilePath(FILE_PATH_LITERAL("mock.executable"))}) {
      ASSERT_TRUE(base::CopyFile(test_executable, dir.Append(executable_name)));
    }
  }
}

void ExpectOnlyMockUpdater(const base::FilePath& mock_updater_path) {
  ASSERT_TRUE(base::PathExists(mock_updater_path));
  int count_mock_updater_path = 0;

  base::FileEnumerator(
      mock_updater_path.DirName(), false,
      base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)
      .ForEach([&mock_updater_path,
                &count_mock_updater_path](const base::FilePath& item) {
        if (item == mock_updater_path) {
          ++count_mock_updater_path;
        } else {
          ADD_FAILURE() << "Unexpected file/directory found: " << item;
        }
      });

  EXPECT_EQ(count_mock_updater_path, 1);
}

void ExpectTagArgsEqual(const updater::tagging::TagArgs& actual,
                        const updater::tagging::TagArgs& expected) {
  EXPECT_EQ(actual.bundle_name, expected.bundle_name);
  EXPECT_EQ(actual.installation_id, expected.installation_id);
  EXPECT_EQ(actual.brand_code, expected.brand_code);
  EXPECT_EQ(actual.client_id, expected.client_id);
  EXPECT_EQ(actual.experiment_labels, expected.experiment_labels);
  EXPECT_EQ(actual.referral_id, expected.referral_id);
  EXPECT_EQ(actual.language, expected.language);
  EXPECT_EQ(actual.browser_type, expected.browser_type);
  EXPECT_EQ(actual.usage_stats_enable, expected.usage_stats_enable);
  EXPECT_EQ(actual.enrollment_token, expected.enrollment_token);

  EXPECT_EQ(actual.apps.size(), expected.apps.size());
  for (size_t i = 0; i < expected.apps.size(); ++i) {
    const updater::tagging::AppArgs& app_actual = actual.apps[i];
    const updater::tagging::AppArgs& app_expected = expected.apps[i];

    EXPECT_EQ(app_actual.app_id, app_expected.app_id);
    EXPECT_EQ(app_actual.app_name, app_expected.app_name);
    EXPECT_EQ(app_actual.needs_admin, app_expected.needs_admin);
    EXPECT_EQ(app_actual.ap, app_expected.ap);
    EXPECT_EQ(app_actual.encoded_installer_data,
              app_expected.encoded_installer_data);
    EXPECT_EQ(app_actual.install_data_index, app_expected.install_data_index);
    EXPECT_EQ(app_actual.experiment_labels, app_expected.experiment_labels);
  }

  EXPECT_EQ(actual.runtime_mode, expected.runtime_mode);
}

int WaitForProcess(base::Process& process) {
  int exit_code = -1;
  bool process_exited = false;
  base::RunLoop wait_for_process_exit_loop;
  base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})
      ->PostTaskAndReply(
          FROM_HERE, base::BindLambdaForTesting([&] {
            base::ScopedAllowBaseSyncPrimitivesForTesting allow_blocking;
            process_exited = base::WaitForMultiprocessTestChildExit(
                process, TestTimeouts::action_timeout(), &exit_code);
          }),
          wait_for_process_exit_loop.QuitClosure());
  wait_for_process_exit_loop.Run();
  EXPECT_TRUE(process_exited);
  return exit_code;
}

}  // namespace updater::test