BUILD.gn 13.1 KB
Newer Older
machenbach's avatar
machenbach committed
1 2 3 4 5 6
# 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")

7 8 9 10 11 12 13
config("cctest_config") {
  # Work around a bug in the gold linker.
  if (use_gold && target_cpu == "x86") {
    ldflags = [ "-Wl,--icf=none" ]
  }
}

14
v8_executable("cctest") {
machenbach's avatar
machenbach committed
15
  testonly = true
16 17 18 19 20

  sources = [
    "cctest.cc",
  ]

21 22 23
  deps = [
    ":cctest_sources",
  ]
24 25 26 27 28 29 30 31 32 33 34

  data_deps = [
    "../../tools:v8_testrunner",
  ]

  data = [
    "testcfg.py",
    "cctest.status",
    "interpreter/bytecode_expectations/",
  ]

35 36 37
  configs = [
    "../..:external_config",
    "../..:internal_config_base",
38
    ":cctest_config",
39 40 41 42
  ]

  ldflags = []

43 44 45 46
  if (v8_use_perfetto) {
    deps += [ "//third_party/perfetto/include/perfetto/tracing" ]
  }

47 48 49 50 51 52
  # TODO(machenbach): Translate from gyp.
  #["OS=="aix"", {
  #  "ldflags": [ "-Wl,-bbigtoc" ],
  #}],
}

53 54 55 56 57 58 59 60 61 62 63 64 65
v8_header_set("cctest_headers") {
  testonly = true

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

  sources = [
    "cctest.h",
  ]
}

66 67
v8_source_set("cctest_sources") {
  testonly = true
machenbach's avatar
machenbach committed
68

jochen's avatar
jochen committed
69
  sources = [
70
    ### gcmole(all) ###
71 72 73 74
    "../common/assembler-tester.h",
    "../common/wasm/flag-utils.h",
    "../common/wasm/test-signatures.h",
    "../common/wasm/wasm-macro-gen.h",
75
    "collector.h",
jochen's avatar
jochen committed
76
    "compiler/c-signature.h",
77
    "compiler/call-tester.h",
jochen's avatar
jochen committed
78 79 80 81 82 83
    "compiler/code-assembler-tester.h",
    "compiler/codegen-tester.cc",
    "compiler/codegen-tester.h",
    "compiler/function-tester.cc",
    "compiler/function-tester.h",
    "compiler/graph-builder-tester.h",
84 85
    "compiler/serializer-tester.cc",
    "compiler/serializer-tester.h",
jochen's avatar
jochen committed
86 87 88
    "compiler/test-basic-block-profiler.cc",
    "compiler/test-branch-combine.cc",
    "compiler/test-code-assembler.cc",
89
    "compiler/test-code-generator.cc",
jochen's avatar
jochen committed
90 91
    "compiler/test-gap-resolver.cc",
    "compiler/test-graph-visualizer.cc",
92
    "compiler/test-instruction-scheduler.cc",
jochen's avatar
jochen committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
    "compiler/test-instruction.cc",
    "compiler/test-js-constant-cache.cc",
    "compiler/test-js-context-specialization.cc",
    "compiler/test-js-typed-lowering.cc",
    "compiler/test-jump-threading.cc",
    "compiler/test-linkage.cc",
    "compiler/test-loop-analysis.cc",
    "compiler/test-machine-operator-reducer.cc",
    "compiler/test-multiple-return.cc",
    "compiler/test-node.cc",
    "compiler/test-operator.cc",
    "compiler/test-representation-change.cc",
    "compiler/test-run-bytecode-graph-builder.cc",
    "compiler/test-run-calls-to-external-references.cc",
    "compiler/test-run-deopt.cc",
    "compiler/test-run-intrinsics.cc",
    "compiler/test-run-jsbranches.cc",
    "compiler/test-run-jscalls.cc",
    "compiler/test-run-jsexceptions.cc",
    "compiler/test-run-jsobjects.cc",
    "compiler/test-run-jsops.cc",
    "compiler/test-run-load-store.cc",
    "compiler/test-run-machops.cc",
    "compiler/test-run-native-calls.cc",
117
    "compiler/test-run-retpoline.cc",
jochen's avatar
jochen committed
118
    "compiler/test-run-stackcheck.cc",
119
    "compiler/test-run-tail-calls.cc",
jochen's avatar
jochen committed
120 121
    "compiler/test-run-unwinding-info.cc",
    "compiler/test-run-variables.cc",
122
    "compiler/value-helper.cc",
123
    "compiler/value-helper.h",
124 125
    "disasm-regex-helper.cc",
    "disasm-regex-helper.h",
126
    "expression-type-collector-macros.h",
jochen's avatar
jochen committed
127
    "gay-fixed.cc",
128
    "gay-fixed.h",
jochen's avatar
jochen committed
129
    "gay-precision.cc",
130
    "gay-precision.h",
jochen's avatar
jochen committed
131
    "gay-shortest.cc",
132
    "gay-shortest.h",
jochen's avatar
jochen committed
133 134 135 136 137 138
    "heap/heap-tester.h",
    "heap/heap-utils.cc",
    "heap/heap-utils.h",
    "heap/test-alloc.cc",
    "heap/test-array-buffer-tracker.cc",
    "heap/test-compaction.cc",
139
    "heap/test-concurrent-marking.cc",
140
    "heap/test-embedder-tracing.cc",
141
    "heap/test-external-string-tracker.cc",
jochen's avatar
jochen committed
142 143
    "heap/test-heap.cc",
    "heap/test-incremental-marking.cc",
144
    "heap/test-invalidated-slots.cc",
145
    "heap/test-iterators.cc",
jochen's avatar
jochen committed
146 147
    "heap/test-lab.cc",
    "heap/test-mark-compact.cc",
148
    "heap/test-memory-measurement.cc",
jochen's avatar
jochen committed
149 150
    "heap/test-page-promotion.cc",
    "heap/test-spaces.cc",
151
    "heap/test-unmapper.cc",
152
    "heap/test-weak-references.cc",
jochen's avatar
jochen committed
153 154 155
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/interpreter-tester.cc",
156
    "interpreter/interpreter-tester.h",
jochen's avatar
jochen committed
157 158 159 160 161 162 163 164
    "interpreter/source-position-matcher.cc",
    "interpreter/source-position-matcher.h",
    "interpreter/test-bytecode-generator.cc",
    "interpreter/test-interpreter-intrinsics.cc",
    "interpreter/test-interpreter.cc",
    "interpreter/test-source-positions.cc",
    "libplatform/test-tracing.cc",
    "libsampler/test-sampler.cc",
165
    "manually-externalized-buffer.h",
166
    "parsing/test-parse-decision.cc",
167
    "parsing/test-preparser.cc",
168
    "parsing/test-scanner-streams.cc",
169
    "parsing/test-scanner.cc",
jochen's avatar
jochen committed
170
    "print-extension.cc",
171
    "print-extension.h",
jochen's avatar
jochen committed
172
    "profiler-extension.cc",
173
    "profiler-extension.h",
174
    "scope-test-helper.h",
175 176
    "setup-isolate-for-tests.cc",
    "setup-isolate-for-tests.h",
jochen's avatar
jochen committed
177
    "test-access-checks.cc",
178
    "test-accessor-assembler.cc",
jochen's avatar
jochen committed
179
    "test-accessors.cc",
180
    "test-allocation.cc",
jochen's avatar
jochen committed
181
    "test-api-accessors.cc",
182
    "test-api-array-buffer.cc",
jochen's avatar
jochen committed
183
    "test-api-interceptors.cc",
184
    "test-api-stack-traces.cc",
185
    "test-api-typed-array.cc",
186
    "test-api-wasm.cc",
jochen's avatar
jochen committed
187 188 189 190
    "test-api.cc",
    "test-api.h",
    "test-array-list.cc",
    "test-atomicops.cc",
191
    "test-backing-store.cc",
jochen's avatar
jochen committed
192 193 194 195 196
    "test-bignum-dtoa.cc",
    "test-bignum.cc",
    "test-bit-vector.cc",
    "test-circular-queue.cc",
    "test-code-layout.cc",
197
    "test-code-pages.cc",
jochen's avatar
jochen committed
198 199 200 201 202 203
    "test-code-stub-assembler.cc",
    "test-compiler.cc",
    "test-constantpool.cc",
    "test-conversions.cc",
    "test-cpu-profiler.cc",
    "test-date.cc",
204
    "test-debug-helper.cc",
jochen's avatar
jochen committed
205 206 207 208 209 210 211 212
    "test-debug.cc",
    "test-decls.cc",
    "test-deoptimization.cc",
    "test-dictionary.cc",
    "test-diy-fp.cc",
    "test-double.cc",
    "test-dtoa.cc",
    "test-elements-kind.cc",
213
    "test-factory.cc",
jochen's avatar
jochen committed
214 215
    "test-fast-dtoa.cc",
    "test-feedback-vector.cc",
216
    "test-feedback-vector.h",
jochen's avatar
jochen committed
217 218 219 220 221 222
    "test-field-type-tracking.cc",
    "test-fixed-dtoa.cc",
    "test-flags.cc",
    "test-func-name-inference.cc",
    "test-global-handles.cc",
    "test-global-object.cc",
223
    "test-hashcode.cc",
jochen's avatar
jochen committed
224 225
    "test-hashmap.cc",
    "test-heap-profiler.cc",
226
    "test-icache.cc",
jochen's avatar
jochen committed
227 228
    "test-identity-map.cc",
    "test-inobject-slack-tracking.cc",
229
    "test-inspector.cc",
230
    "test-intl.cc",
231
    "test-js-weak-refs.cc",
jochen's avatar
jochen committed
232 233 234
    "test-liveedit.cc",
    "test-lockers.cc",
    "test-log.cc",
235
    "test-managed.cc",
jochen's avatar
jochen committed
236
    "test-mementos.cc",
237
    "test-modules.cc",
jochen's avatar
jochen committed
238
    "test-object.cc",
239
    "test-orderedhashtable.cc",
jochen's avatar
jochen committed
240 241 242 243 244 245
    "test-parsing.cc",
    "test-platform.cc",
    "test-profile-generator.cc",
    "test-random-number-generator.cc",
    "test-regexp.cc",
    "test-representation.cc",
246
    "test-roots.cc",
jochen's avatar
jochen committed
247 248
    "test-sampler-api.cc",
    "test-serialize.cc",
249
    "test-smi-lexicographic-compare.cc",
jochen's avatar
jochen committed
250 251 252 253 254 255
    "test-strings.cc",
    "test-strtod.cc",
    "test-symbols.cc",
    "test-thread-termination.cc",
    "test-threads.cc",
    "test-trace-event.cc",
256
    "test-traced-value.cc",
jochen's avatar
jochen committed
257
    "test-transitions.cc",
258
    "test-transitions.h",
jochen's avatar
jochen committed
259 260 261 262
    "test-typedarrays.cc",
    "test-types.cc",
    "test-unboxed-doubles.cc",
    "test-unscopables-hidden-prototype.cc",
263
    "test-unwinder-code-pages.cc",
264
    "test-unwinder.cc",
jochen's avatar
jochen committed
265 266 267 268 269
    "test-usecounters.cc",
    "test-utils.cc",
    "test-version.cc",
    "test-weakmaps.cc",
    "test-weaksets.cc",
270
    "torque/test-torque.cc",
jochen's avatar
jochen committed
271
    "trace-extension.cc",
272
    "trace-extension.h",
273
    "unicode-helpers.cc",
274
    "unicode-helpers.h",
275
    "wasm/test-c-wasm-entry.cc",
276
    "wasm/test-compilation-cache.cc",
277
    "wasm/test-grow-memory.cc",
278
    "wasm/test-jump-table-assembler.cc",
279
    "wasm/test-liftoff-inspection.cc",
jochen's avatar
jochen committed
280 281
    "wasm/test-run-wasm-64.cc",
    "wasm/test-run-wasm-asmjs.cc",
282
    "wasm/test-run-wasm-atomics.cc",
283
    "wasm/test-run-wasm-atomics64.cc",
284
    "wasm/test-run-wasm-bulk-memory.cc",
285
    "wasm/test-run-wasm-exceptions.cc",
jochen's avatar
jochen committed
286 287 288
    "wasm/test-run-wasm-interpreter.cc",
    "wasm/test-run-wasm-js.cc",
    "wasm/test-run-wasm-module.cc",
289
    "wasm/test-run-wasm-sign-extension.cc",
290
    "wasm/test-run-wasm-simd-liftoff.cc",
291
    "wasm/test-run-wasm-simd.cc",
jochen's avatar
jochen committed
292
    "wasm/test-run-wasm.cc",
293
    "wasm/test-streaming-compilation.cc",
294
    "wasm/test-wasm-breakpoints.cc",
295
    "wasm/test-wasm-codegen.cc",
296
    "wasm/test-wasm-import-wrapper-cache.cc",
297
    "wasm/test-wasm-interpreter-entry.cc",
298
    "wasm/test-wasm-serialization.cc",
299
    "wasm/test-wasm-shared-engine.cc",
jochen's avatar
jochen committed
300 301
    "wasm/test-wasm-stack.cc",
    "wasm/test-wasm-trap-position.cc",
302
    "wasm/wasm-atomics-utils.h",
303
    "wasm/wasm-run-utils.cc",
jochen's avatar
jochen committed
304 305
    "wasm/wasm-run-utils.h",
  ]
machenbach's avatar
machenbach committed
306

307
  if (v8_current_cpu == "arm") {
308
    sources += [  ### gcmole(arch:arm) ###
309 310
      "assembler-helper-arm.cc",
      "assembler-helper-arm.h",
jochen's avatar
jochen committed
311 312 313
      "test-assembler-arm.cc",
      "test-disasm-arm.cc",
      "test-macro-assembler-arm.cc",
314
      "test-poison-disasm-arm.cc",
315
      "test-sync-primitives-arm.cc",
jochen's avatar
jochen committed
316
    ]
317
  } else if (v8_current_cpu == "arm64") {
318
    sources += [  ### gcmole(arch:arm64) ###
jochen's avatar
jochen committed
319 320 321 322 323
      "test-assembler-arm64.cc",
      "test-disasm-arm64.cc",
      "test-fuzz-arm64.cc",
      "test-javascript-arm64.cc",
      "test-js-arm64-variables.cc",
324
      "test-macro-assembler-arm64.cc",
325
      "test-pointer-auth-arm64.cc",
326
      "test-poison-disasm-arm64.cc",
327
      "test-sync-primitives-arm64.cc",
jochen's avatar
jochen committed
328
      "test-utils-arm64.cc",
329
      "test-utils-arm64.h",
jochen's avatar
jochen committed
330
    ]
331 332 333
    if (is_win) {
      sources += [ "test-stack-unwinding-win64.cc" ]
    }
334
  } else if (v8_current_cpu == "x86") {
335
    sources += [  ### gcmole(arch:ia32) ###
jochen's avatar
jochen committed
336 337 338 339
      "test-assembler-ia32.cc",
      "test-disasm-ia32.cc",
      "test-log-stack-tracer.cc",
    ]
340
  } else if (v8_current_cpu == "mips") {
341
    sources += [  ### gcmole(arch:mips) ###
jochen's avatar
jochen committed
342 343 344 345
      "test-assembler-mips.cc",
      "test-disasm-mips.cc",
      "test-macro-assembler-mips.cc",
    ]
346
  } else if (v8_current_cpu == "mipsel") {
347
    sources += [  ### gcmole(arch:mipsel) ###
jochen's avatar
jochen committed
348 349 350 351
      "test-assembler-mips.cc",
      "test-disasm-mips.cc",
      "test-macro-assembler-mips.cc",
    ]
352
  } else if (v8_current_cpu == "mips64") {
353
    sources += [  ### gcmole(arch:mips64) ###
jochen's avatar
jochen committed
354 355 356 357
      "test-assembler-mips64.cc",
      "test-disasm-mips64.cc",
      "test-macro-assembler-mips64.cc",
    ]
358
  } else if (v8_current_cpu == "mips64el") {
359
    sources += [  ### gcmole(arch:mips64el) ###
jochen's avatar
jochen committed
360 361 362 363
      "test-assembler-mips64.cc",
      "test-disasm-mips64.cc",
      "test-macro-assembler-mips64.cc",
    ]
364
  } else if (v8_current_cpu == "x64") {
365
    sources += [  ### gcmole(arch:x64) ###
jochen's avatar
jochen committed
366 367 368 369 370
      "test-assembler-x64.cc",
      "test-disasm-x64.cc",
      "test-log-stack-tracer.cc",
      "test-macro-assembler-x64.cc",
    ]
371
    if (is_win) {
372
      sources += [ "test-stack-unwinding-win64.cc" ]
373
    }
374
  } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
375
    sources += [  ### gcmole(arch:ppc) ###
jochen's avatar
jochen committed
376 377 378
      "test-assembler-ppc.cc",
      "test-disasm-ppc.cc",
    ]
379
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
380
    sources += [  ### gcmole(arch:s390) ###
jochen's avatar
jochen committed
381 382 383
      "test-assembler-s390.cc",
      "test-disasm-s390.cc",
    ]
machenbach's avatar
machenbach committed
384 385
  }

386
  configs = [
machenbach's avatar
machenbach committed
387 388 389 390
    "../..:external_config",
    "../..:internal_config_base",
  ]

391
  public_deps = [
392
    ":cctest_headers",
393
    "..:common_test_headers",
394
    "../..:v8_for_testing",
395
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
396
    "../..:v8_libplatform",
397
    "../..:wasm_module_runner",
398
    "../../tools/debug_helper:v8_debug_helper",
machenbach's avatar
machenbach committed
399 400 401
    "//build/win:default_exe_manifest",
  ]

402
  defines = []
403 404 405
  deps = [
    "../..:run_torque",
  ]
406

407 408
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
409
    public_deps += [ "//third_party/icu" ]
410 411 412 413
  } else {
    sources -= [ "test-intl.cc" ]
  }

414 415 416
  cflags = []
  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
417 418 419
      v8_current_cpu == "s390" || v8_current_cpu == "s390x" ||
      v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
      v8_current_cpu == "mipsel" || v8_current_cpu == "mipsel64") {
420 421
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
422 423 424
    if (!is_win) {
      cflags += [ "-ffp-contract=off" ]
    }
425 426
  }

427 428 429 430
  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
431 432 433 434
    cflags += [ "/wd4309" ]

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

  if (v8_use_perfetto) {
438 439 440 441 442
    deps += [
      "//third_party/perfetto/include/perfetto/tracing",
      "//third_party/perfetto/protos/perfetto/trace/chrome:lite",
      "//third_party/perfetto/protos/perfetto/trace/chrome:zero",
    ]
443
  }
machenbach's avatar
machenbach committed
444 445
}

446
v8_executable("generate-bytecode-expectations") {
447 448
  testonly = true

449 450 451 452 453 454 455 456 457 458 459 460
  sources = [
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/generate-bytecode-expectations.cc",
  ]

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

  deps = [
461
    ":cctest_headers",
462 463
    "../..:v8",
    "../..:v8_libbase",
464 465 466
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
467 468 469 470

  data = [
    "interpreter/bytecode_expectations/",
  ]
471
}