summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/BUILD.gn
blob: db94e0c7ff0478e8656231bdb7f39c17f3f19233 (plain)
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
# 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_current_cpu == "arm") {
    sources += gypi_values.cctest_sources_arm
  } else if (v8_current_cpu == "arm64") {
    sources += gypi_values.cctest_sources_arm64
  } else if (v8_current_cpu == "x86") {
    sources += gypi_values.cctest_sources_ia32
  } else if (v8_current_cpu == "mips") {
    sources += gypi_values.cctest_sources_mips
  } else if (v8_current_cpu == "mipsel") {
    sources += gypi_values.cctest_sources_mipsel
  } else if (v8_current_cpu == "mips64") {
    sources += gypi_values.cctest_sources_mips64
  } else if (v8_current_cpu == "mips64el") {
    sources += gypi_values.cctest_sources_mips64el
  } else if (v8_current_cpu == "x64") {
    sources += gypi_values.cctest_sources_x64
  } else if (v8_current_cpu == "x87") {
    sources += gypi_values.cctest_sources_x87
  } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
    sources += gypi_values.cctest_sources_ppc
  } else if (v8_current_cpu == "s390" || v8_current_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" ]
  }

  configs = [
    "../..:external_config",
    "../..:internal_config_base",
  ]

  # 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" ]
  }

  cflags = []
  ldflags = []

  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
      v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
    cflags += [ "-ffp-contract=off" ]
  }

  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" ]

    # MSVS wants this for gay-{precision,shortest}.cc.
    cflags += [ "/bigobj" ]

    # 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" ]
  }

  if (is_win) {
    # Suppress warnings about importing locally defined symbols.
    if (is_component_build) {
      ldflags = [
        "/ignore:4049",
        "/ignore:4217",
      ]
    }
  }
}