run-all-unittests.cc 1.45 KB
Newer Older
1 2 3 4
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
#include <memory>

7
#include "include/cppgc/platform.h"
8
#include "include/libplatform/libplatform.h"
9
#include "include/v8-initialization.h"
10
#include "src/base/compiler-specific.h"
11
#include "src/base/page-allocator.h"
12 13 14 15
#include "testing/gmock/include/gmock/gmock.h"

namespace {

16
class CppGCEnvironment final : public ::testing::Environment {
17
 public:
18
  void SetUp() override {
19 20 21 22
    // Initialize the process for cppgc with an arbitrary page allocator. This
    // has to survive as long as the process, so it's ok to leak the allocator
    // here.
    cppgc::InitializeProcess(new v8::base::PageAllocator());
23 24
  }

25
  void TearDown() override { cppgc::ShutdownProcess(); }
26 27 28 29 30 31
};

}  // namespace


int main(int argc, char** argv) {
32 33 34
  // Don't catch SEH exceptions and continue as the following tests might hang
  // in an broken environment on windows.
  testing::GTEST_FLAG(catch_exceptions) = false;
35 36 37 38

  // Most V8 unit-tests are multi-threaded, so enable thread-safe death-tests.
  testing::FLAGS_gtest_death_test_style = "threadsafe";

39
  testing::InitGoogleMock(&argc, argv);
40
  testing::AddGlobalTestEnvironment(new CppGCEnvironment);
41
  v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
vogelheim's avatar
vogelheim committed
42
  v8::V8::InitializeExternalStartupData(argv[0]);
43
  v8::V8::InitializeICUDefaultLocation(argv[0]);
44 45
  return RUN_ALL_TESTS();
}