v8/test/cctest/BUILD.gn
machenbach 994dc21148 [gn] Use one source of truth for test source files.
This avoids forgetting to add files for either gyp or gn.

While for most executables, this is detected by compilation
errors, for test executables, it can lead to tests silently
not running.

BUG=chromium:474921

Review-Url: https://codereview.chromium.org/2098313002
Cr-Commit-Position: refs/heads/master@{#37331}
2016-06-28 13:24:08 +00:00

168 lines
4.6 KiB
Plaintext

# 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.
# The sources are kept automatically in sync with cctest.gyp.
import("../../gni/v8.gni")
gypi_values = exec_script("//build/gypi_to_gn.py",
[ rebase_path("cctest.gyp") ],
"scope",
[ "cctest.gyp" ])
v8_executable("cctest") {
testonly = true
sources = [
"$target_gen_dir/resources.cc",
] + gypi_values.cctest_sources
if (v8_target_cpu == "arm") {
sources += gypi_values.cctest_sources_arm
} else if (v8_target_cpu == "arm64") {
sources += gypi_values.cctest_sources_arm64
} else if (v8_target_cpu == "x86") {
sources += gypi_values.cctest_sources_ia32
} else if (v8_target_cpu == "mips") {
sources += gypi_values.cctest_sources_mips
} else if (v8_target_cpu == "mipsel") {
sources += gypi_values.cctest_sources_mipsel
} else if (v8_target_cpu == "mips64") {
sources += gypi_values.cctest_sources_mips64
} else if (v8_target_cpu == "mips64el") {
sources += gypi_values.cctest_sources_mips64el
} else if (v8_target_cpu == "x64") {
sources += gypi_values.cctest_sources_x64
} else if (v8_target_cpu == "x87") {
sources += gypi_values.cctest_sources_x87
} else if (v8_target_cpu == "ppc" || v8_target_cpu == "ppc64") {
sources += gypi_values.cctest_sources_ppc
} else if (v8_target_cpu == "s390" || v8_target_cpu == "s390x") {
sources += gypi_values.cctest_sources_s390
}
if (is_linux) {
# TODO(machenbach): Translate 'or OS=="qnx"' from gyp.
sources += [ "test-platform-linux.cc" ]
} else if (is_win) {
sources += [ "test-platform-win32.cc" ]
# TODO(machenbach): Translate from gyp.
# "msvs_settings": {
# "VCCLCompilerTool": {
# # MSVS wants this for gay-{precision,shortest}.cc.
# "AdditionalOptions": ["/bigobj"],
# },
# },
}
configs = [
"../..:external_config",
"../..:internal_config_base",
]
# TODO(machenbach): Translate from gyp.
#['v8_target_cpu=="ppc" or v8_target_cpu=="ppc64" \
# or v8_target_cpu=="arm" or v8_target_cpu=="arm64" \
# or v8_target_cpu=="s390" or v8_target_cpu=="s390x"', {
# # disable fmadd/fmsub so that expected results match generated code in
# # RunFloat64MulAndFloat64Add1 and friends.
# 'cflags': ['-ffp-contract=off'],
#}],
# TODO(machenbach): Translate from gyp.
#["OS=="aix"", {
# "ldflags": [ "-Wl,-bbigtoc" ],
#}],
deps = [
":resources",
"../..:v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
]
if (is_component_build) {
# cctest 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" ]
}
if (is_win) {
# This warning is benignly triggered by the U16 and U32 macros in
# bytecode-utils.h.
# C4309: 'static_cast': truncation of constant value
cflags = [ "/wd4309" ]
# Suppress warnings about importing locally defined symbols.
if (is_component_build) {
ldflags = [
"/ignore:4049",
"/ignore:4217",
]
}
}
}
action("resources") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "../../tools/js2c.py"
# The script depends on this other script, this rule causes a rebuild if it
# changes.
inputs = [
"../../tools/jsmin.py",
]
# NOSORT
sources = [
"../../tools/splaytree.js",
"../../tools/codemap.js",
"../../tools/csvparser.js",
"../../tools/consarray.js",
"../../tools/profile.js",
"../../tools/profile_view.js",
"../../tools/logreader.js",
"log-eq-of-logging-and-traversal.js",
]
outputs = [
"$target_gen_dir/resources.cc",
]
args = [
rebase_path("$target_gen_dir/resources.cc", root_build_dir),
"TEST",
]
args += rebase_path(sources, root_build_dir)
}
v8_executable("generate-bytecode-expectations") {
sources = [
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
"interpreter/generate-bytecode-expectations.cc",
]
configs = [
"../..:external_config",
"../..:internal_config_base",
]
deps = [
"../..:v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
]
if (is_component_build) {
# Same as cctest, we need to depend on the underlying static target.
deps += [ "../..:v8_maybe_snapshot" ]
} else {
deps += [ "../..:v8" ]
}
}