[gn] Add unittests
BUG=chromium:474921 NOTRY=true Committed: https://crrev.com/67e549ec5b34ad02506abb2720c6a0851ae31f5e Cr-Commit-Position: refs/heads/master@{#36510} Review-Url: https://codereview.chromium.org/2011853002 Cr-Commit-Position: refs/heads/master@{#36582}
This commit is contained in:
parent
07ce602d4c
commit
143b3d167d
58
BUILD.gn
58
BUILD.gn
@ -69,15 +69,6 @@ declare_args() {
|
|||||||
v8_random_seed = "314159265"
|
v8_random_seed = "314159265"
|
||||||
v8_toolset_for_shell = "host"
|
v8_toolset_for_shell = "host"
|
||||||
|
|
||||||
if (v8_use_snapshot && v8_use_external_startup_data) {
|
|
||||||
snapshot_target = ":v8_external_snapshot"
|
|
||||||
} else if (v8_use_snapshot) {
|
|
||||||
snapshot_target = ":v8_snapshot"
|
|
||||||
} else {
|
|
||||||
assert(!v8_use_external_startup_data)
|
|
||||||
snapshot_target = ":v8_nosnapshot"
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Configurations
|
# Configurations
|
||||||
#
|
#
|
||||||
@ -643,6 +634,17 @@ action("run_mksnapshot") {
|
|||||||
# Source Sets (aka static libraries)
|
# Source Sets (aka static libraries)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
source_set("v8_maybe_snapshot") {
|
||||||
|
if (v8_use_snapshot && v8_use_external_startup_data) {
|
||||||
|
public_deps = [ ":v8_external_snapshot" ]
|
||||||
|
} else if (v8_use_snapshot) {
|
||||||
|
public_deps = [ ":v8_snapshot" ]
|
||||||
|
} else {
|
||||||
|
assert(!v8_use_external_startup_data)
|
||||||
|
public_deps = [ ":v8_nosnapshot" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
v8_source_set("v8_nosnapshot") {
|
v8_source_set("v8_nosnapshot") {
|
||||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||||
|
|
||||||
@ -2004,7 +2006,7 @@ v8_source_set("fuzzer_support") {
|
|||||||
configs = [ ":internal_config_base" ]
|
configs = [ ":internal_config_base" ]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
snapshot_target,
|
":v8_maybe_snapshot",
|
||||||
]
|
]
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
@ -2046,6 +2048,33 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
|||||||
# Public targets
|
# Public targets
|
||||||
#
|
#
|
||||||
|
|
||||||
|
want_v8_shell = (
|
||||||
|
(current_toolchain == host_toolchain && v8_toolset_for_shell == "host") ||
|
||||||
|
(current_toolchain == v8_snapshot_toolchain &&
|
||||||
|
v8_toolset_for_shell == "host") ||
|
||||||
|
(current_toolchain != host_toolchain && v8_toolset_for_shell == "target"))
|
||||||
|
|
||||||
|
group("gn_all") {
|
||||||
|
testonly = true
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":d8",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (want_v8_shell) {
|
||||||
|
deps += [
|
||||||
|
":v8_shell",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (host_os != "mac" || !is_android) {
|
||||||
|
# These items don't compile for Android on Mac.
|
||||||
|
deps += [
|
||||||
|
"test/unittests:unittests",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_component_build) {
|
if (is_component_build) {
|
||||||
component("v8") {
|
component("v8") {
|
||||||
sources = [
|
sources = [
|
||||||
@ -2054,7 +2083,7 @@ if (is_component_build) {
|
|||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":v8_base",
|
":v8_base",
|
||||||
snapshot_target,
|
":v8_maybe_snapshot",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||||
@ -2071,7 +2100,7 @@ if (is_component_build) {
|
|||||||
group("v8") {
|
group("v8") {
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":v8_base",
|
":v8_base",
|
||||||
snapshot_target,
|
":v8_maybe_snapshot",
|
||||||
]
|
]
|
||||||
public_configs = [ ":external_config" ]
|
public_configs = [ ":external_config" ]
|
||||||
}
|
}
|
||||||
@ -2118,10 +2147,7 @@ executable("d8") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((current_toolchain == host_toolchain && v8_toolset_for_shell == "host") ||
|
if (want_v8_shell) {
|
||||||
(current_toolchain == v8_snapshot_toolchain &&
|
|
||||||
v8_toolset_for_shell == "host") ||
|
|
||||||
(current_toolchain != host_toolchain && v8_toolset_for_shell == "target")) {
|
|
||||||
executable("v8_shell") {
|
executable("v8_shell") {
|
||||||
sources = [
|
sources = [
|
||||||
"samples/shell.cc",
|
"samples/shell.cc",
|
||||||
|
15
build_overrides/gtest.gni
Normal file
15
build_overrides/gtest.gni
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Copyright 2016 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.
|
||||||
|
|
||||||
|
# Exclude support for registering main function in multi-process tests.
|
||||||
|
gtest_include_multiprocess = false
|
||||||
|
|
||||||
|
# Exclude support for platform-specific operations across unit tests.
|
||||||
|
gtest_include_platform_test = true
|
||||||
|
|
||||||
|
# Exclude support for testing Objective C code on OS X and iOS.
|
||||||
|
gtest_include_objc_support = true
|
||||||
|
|
||||||
|
# Exclude support for flushing coverage files on iOS.
|
||||||
|
gtest_include_ios_coverage = true
|
166
test/unittests/BUILD.gn
Normal file
166
test/unittests/BUILD.gn
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
# Copyright 2016 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.
|
||||||
|
|
||||||
|
import("../../gni/v8.gni")
|
||||||
|
|
||||||
|
executable("unittests") {
|
||||||
|
testonly = true
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"base/atomic-utils-unittest.cc",
|
||||||
|
"base/bits-unittest.cc",
|
||||||
|
"base/cpu-unittest.cc",
|
||||||
|
"base/division-by-constant-unittest.cc",
|
||||||
|
"base/flags-unittest.cc",
|
||||||
|
"base/functional-unittest.cc",
|
||||||
|
"base/iterator-unittest.cc",
|
||||||
|
"base/logging-unittest.cc",
|
||||||
|
"base/platform/condition-variable-unittest.cc",
|
||||||
|
"base/platform/mutex-unittest.cc",
|
||||||
|
"base/platform/platform-unittest.cc",
|
||||||
|
"base/platform/semaphore-unittest.cc",
|
||||||
|
"base/platform/time-unittest.cc",
|
||||||
|
"base/sys-info-unittest.cc",
|
||||||
|
"base/utils/random-number-generator-unittest.cc",
|
||||||
|
"cancelable-tasks-unittest.cc",
|
||||||
|
"char-predicates-unittest.cc",
|
||||||
|
"compiler/branch-elimination-unittest.cc",
|
||||||
|
"compiler/coalesced-live-ranges-unittest.cc",
|
||||||
|
"compiler/common-operator-reducer-unittest.cc",
|
||||||
|
"compiler/common-operator-unittest.cc",
|
||||||
|
"compiler/compiler-test-utils.h",
|
||||||
|
"compiler/control-equivalence-unittest.cc",
|
||||||
|
"compiler/control-flow-optimizer-unittest.cc",
|
||||||
|
"compiler/dead-code-elimination-unittest.cc",
|
||||||
|
"compiler/diamond-unittest.cc",
|
||||||
|
"compiler/effect-control-linearizer-unittest.cc",
|
||||||
|
"compiler/escape-analysis-unittest.cc",
|
||||||
|
"compiler/graph-reducer-unittest.cc",
|
||||||
|
"compiler/graph-reducer-unittest.h",
|
||||||
|
"compiler/graph-trimmer-unittest.cc",
|
||||||
|
"compiler/graph-unittest.cc",
|
||||||
|
"compiler/graph-unittest.h",
|
||||||
|
"compiler/instruction-selector-unittest.cc",
|
||||||
|
"compiler/instruction-selector-unittest.h",
|
||||||
|
"compiler/instruction-sequence-unittest.cc",
|
||||||
|
"compiler/instruction-sequence-unittest.h",
|
||||||
|
"compiler/int64-lowering-unittest.cc",
|
||||||
|
"compiler/js-builtin-reducer-unittest.cc",
|
||||||
|
"compiler/js-create-lowering-unittest.cc",
|
||||||
|
"compiler/js-intrinsic-lowering-unittest.cc",
|
||||||
|
"compiler/js-operator-unittest.cc",
|
||||||
|
"compiler/js-typed-lowering-unittest.cc",
|
||||||
|
"compiler/linkage-tail-call-unittest.cc",
|
||||||
|
"compiler/live-range-unittest.cc",
|
||||||
|
"compiler/liveness-analyzer-unittest.cc",
|
||||||
|
"compiler/load-elimination-unittest.cc",
|
||||||
|
"compiler/loop-peeling-unittest.cc",
|
||||||
|
"compiler/machine-operator-reducer-unittest.cc",
|
||||||
|
"compiler/machine-operator-unittest.cc",
|
||||||
|
"compiler/move-optimizer-unittest.cc",
|
||||||
|
"compiler/node-cache-unittest.cc",
|
||||||
|
"compiler/node-matchers-unittest.cc",
|
||||||
|
"compiler/node-properties-unittest.cc",
|
||||||
|
"compiler/node-test-utils.cc",
|
||||||
|
"compiler/node-test-utils.h",
|
||||||
|
"compiler/node-unittest.cc",
|
||||||
|
"compiler/opcodes-unittest.cc",
|
||||||
|
"compiler/register-allocator-unittest.cc",
|
||||||
|
"compiler/schedule-unittest.cc",
|
||||||
|
"compiler/scheduler-rpo-unittest.cc",
|
||||||
|
"compiler/scheduler-unittest.cc",
|
||||||
|
"compiler/simplified-operator-reducer-unittest.cc",
|
||||||
|
"compiler/simplified-operator-unittest.cc",
|
||||||
|
"compiler/state-values-utils-unittest.cc",
|
||||||
|
"compiler/tail-call-optimization-unittest.cc",
|
||||||
|
"compiler/typer-unittest.cc",
|
||||||
|
"compiler/value-numbering-reducer-unittest.cc",
|
||||||
|
"compiler/zone-pool-unittest.cc",
|
||||||
|
"counters-unittest.cc",
|
||||||
|
"heap/bitmap-unittest.cc",
|
||||||
|
"heap/gc-idle-time-handler-unittest.cc",
|
||||||
|
"heap/gc-tracer-unittest.cc",
|
||||||
|
"heap/heap-unittest.cc",
|
||||||
|
"heap/memory-reducer-unittest.cc",
|
||||||
|
"heap/scavenge-job-unittest.cc",
|
||||||
|
"heap/slot-set-unittest.cc",
|
||||||
|
"interpreter/bytecode-array-builder-unittest.cc",
|
||||||
|
"interpreter/bytecode-array-iterator-unittest.cc",
|
||||||
|
"interpreter/bytecode-array-writer-unittest.cc",
|
||||||
|
"interpreter/bytecode-peephole-optimizer-unittest.cc",
|
||||||
|
"interpreter/bytecode-pipeline-unittest.cc",
|
||||||
|
"interpreter/bytecode-register-allocator-unittest.cc",
|
||||||
|
"interpreter/bytecodes-unittest.cc",
|
||||||
|
"interpreter/constant-array-builder-unittest.cc",
|
||||||
|
"interpreter/interpreter-assembler-unittest.cc",
|
||||||
|
"interpreter/interpreter-assembler-unittest.h",
|
||||||
|
"interpreter/source-position-table-unittest.cc",
|
||||||
|
"libplatform/default-platform-unittest.cc",
|
||||||
|
"libplatform/task-queue-unittest.cc",
|
||||||
|
"libplatform/worker-thread-unittest.cc",
|
||||||
|
"locked-queue-unittest.cc",
|
||||||
|
"run-all-unittests.cc",
|
||||||
|
"test-utils.cc",
|
||||||
|
"test-utils.h",
|
||||||
|
"wasm/ast-decoder-unittest.cc",
|
||||||
|
"wasm/decoder-unittest.cc",
|
||||||
|
"wasm/encoder-unittest.cc",
|
||||||
|
"wasm/leb-helper-unittest.cc",
|
||||||
|
"wasm/loop-assignment-analysis-unittest.cc",
|
||||||
|
"wasm/module-decoder-unittest.cc",
|
||||||
|
"wasm/switch-logic-unittest.cc",
|
||||||
|
"wasm/wasm-macro-gen-unittest.cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (v8_target_arch == "arm") {
|
||||||
|
sources += [ "compiler/arm/instruction-selector-arm-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "arm64") {
|
||||||
|
sources += [ "compiler/arm64/instruction-selector-arm64-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "ia32") {
|
||||||
|
sources += [ "compiler/ia32/instruction-selector-ia32-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "mips") {
|
||||||
|
sources += [ "compiler/mips/instruction-selector-mips-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "mipsel") {
|
||||||
|
sources += [ "compiler/mipsel/instruction-selector-mipsel-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "mips64") {
|
||||||
|
sources += [ "compiler/mips64/instruction-selector-mips64-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "mips64el") {
|
||||||
|
sources += [ "compiler/mips64el/instruction-selector-mips64el-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "x64") {
|
||||||
|
sources += [ "compiler/x64/instruction-selector-x64-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "ppc" || v8_target_arch == "ppc64") {
|
||||||
|
sources += [ "compiler/ppc/instruction-selector-ppc-unittest.cc" ]
|
||||||
|
} else if (v8_target_arch == "s390" || v8_target_arch == "s390x") {
|
||||||
|
sources += [ "compiler/s390/instruction-selector-s390-unittest.cc" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||||
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||||
|
configs += [
|
||||||
|
"../..:internal_config_base",
|
||||||
|
"../..:features",
|
||||||
|
"../..:toolchain",
|
||||||
|
]
|
||||||
|
|
||||||
|
# TODO(machenbach): Translate from gyp.
|
||||||
|
#['OS=="aix"', {
|
||||||
|
# 'ldflags': [ '-Wl,-bbigtoc' ],
|
||||||
|
#}],
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"../..:v8_libplatform",
|
||||||
|
"//build/config/sanitizers:deps",
|
||||||
|
"//build/win:default_exe_manifest",
|
||||||
|
"//testing/gmock",
|
||||||
|
"//testing/gtest",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (is_component_build) {
|
||||||
|
# compiler-unittests can't be built against a shared library, so we
|
||||||
|
# need to depend on the underlying static target in that case.
|
||||||
|
deps += [ "../..:v8_maybe_snapshot" ]
|
||||||
|
} else {
|
||||||
|
deps += [ "../..:v8" ]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user