BUILD.gn 15.6 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
  sources = [ "cctest.cc" ]
18

19
  deps = [ ":cctest_sources" ]
20

21
  data_deps = [ "../../tools:v8_testrunner" ]
22 23 24 25 26 27 28

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

29 30 31
  configs = [
    "../..:external_config",
    "../..:internal_config_base",
32
    "../..:v8_tracing_config",
33
    ":cctest_config",
34 35 36 37
  ]

  ldflags = []

38 39 40 41 42 43 44 45
  if (v8_use_perfetto) {
    deps += [
      # TODO(skyostil): Switch the test to use protozero.
      "//third_party/perfetto/protos/perfetto/trace/interned_data:lite",
      "//third_party/perfetto/protos/perfetto/trace/track_event:lite",
    ]
  }

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

52 53 54 55 56 57 58 59
v8_header_set("cctest_headers") {
  testonly = true

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

60 61 62 63 64
  deps = [
    "../..:v8_internal_headers",
    "../..:v8_libbase",
    "../..:v8_libplatform",
  ]
65

66
  sources = [ "cctest.h" ]
67 68
}

69 70 71 72 73 74
config("cctest_sources_config") {
  if (is_clang) {
    cflags = [ "-Wno-string-concatenation" ]
  }
}

75 76
v8_source_set("cctest_sources") {
  testonly = true
machenbach's avatar
machenbach committed
77

jochen's avatar
jochen committed
78
  sources = [
79
    ### gcmole(all) ###
80
    "../common/assembler-tester.h",
81
    "../common/flag-utils.h",
82
    "cctest-utils.h",
83
    "collector.h",
jochen's avatar
jochen committed
84
    "compiler/c-signature.h",
85
    "compiler/call-tester.h",
jochen's avatar
jochen committed
86 87 88 89 90
    "compiler/code-assembler-tester.h",
    "compiler/codegen-tester.cc",
    "compiler/codegen-tester.h",
    "compiler/function-tester.cc",
    "compiler/function-tester.h",
91
    "compiler/node-observer-tester.h",
92
    "compiler/test-atomic-load-store-codegen.cc",
jochen's avatar
jochen committed
93 94
    "compiler/test-basic-block-profiler.cc",
    "compiler/test-branch-combine.cc",
95
    "compiler/test-calls-with-arraylike-or-spread.cc",
jochen's avatar
jochen committed
96
    "compiler/test-code-assembler.cc",
97
    "compiler/test-code-generator.cc",
98
    "compiler/test-concurrent-shared-function-info.cc",
jochen's avatar
jochen committed
99 100
    "compiler/test-gap-resolver.cc",
    "compiler/test-graph-visualizer.cc",
101
    "compiler/test-instruction-scheduler.cc",
jochen's avatar
jochen committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
    "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-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-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-stackcheck.cc",
124
    "compiler/test-run-tail-calls.cc",
jochen's avatar
jochen committed
125 126
    "compiler/test-run-unwinding-info.cc",
    "compiler/test-run-variables.cc",
127
    "compiler/test-sloppy-equality.cc",
128
    "compiler/test-verify-type.cc",
129
    "compiler/value-helper.cc",
130
    "compiler/value-helper.h",
131 132
    "disasm-regex-helper.cc",
    "disasm-regex-helper.h",
133
    "expression-type-collector-macros.h",
jochen's avatar
jochen committed
134
    "gay-fixed.cc",
135
    "gay-fixed.h",
jochen's avatar
jochen committed
136
    "gay-precision.cc",
137
    "gay-precision.h",
jochen's avatar
jochen committed
138
    "gay-shortest.cc",
139
    "gay-shortest.h",
jochen's avatar
jochen committed
140 141 142 143 144 145
    "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",
146
    "heap/test-concurrent-allocation.cc",
147
    "heap/test-concurrent-marking.cc",
148
    "heap/test-embedder-tracing.cc",
149
    "heap/test-external-string-tracker.cc",
jochen's avatar
jochen committed
150 151
    "heap/test-heap.cc",
    "heap/test-incremental-marking.cc",
152
    "heap/test-invalidated-slots.cc",
153
    "heap/test-iterators.cc",
jochen's avatar
jochen committed
154 155
    "heap/test-lab.cc",
    "heap/test-mark-compact.cc",
156
    "heap/test-memory-measurement.cc",
jochen's avatar
jochen committed
157
    "heap/test-page-promotion.cc",
158
    "heap/test-shared-heap.cc",
jochen's avatar
jochen committed
159
    "heap/test-spaces.cc",
160
    "heap/test-unmapper.cc",
161
    "heap/test-weak-references.cc",
162
    "heap/test-write-barrier.cc",
jochen's avatar
jochen committed
163 164 165
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/interpreter-tester.cc",
166
    "interpreter/interpreter-tester.h",
jochen's avatar
jochen committed
167 168 169 170 171 172 173
    "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",
174
    "libsampler/signals-and-mutexes.cc",
jochen's avatar
jochen committed
175
    "libsampler/test-sampler.cc",
176
    "manually-externalized-buffer.h",
177
    "parsing/test-parse-decision.cc",
178
    "parsing/test-preparser.cc",
179
    "parsing/test-scanner-streams.cc",
180
    "parsing/test-scanner.cc",
jochen's avatar
jochen committed
181
    "print-extension.cc",
182
    "print-extension.h",
jochen's avatar
jochen committed
183
    "profiler-extension.cc",
184
    "profiler-extension.h",
185
    "scope-test-helper.h",
186 187
    "setup-isolate-for-tests.cc",
    "setup-isolate-for-tests.h",
jochen's avatar
jochen committed
188
    "test-access-checks.cc",
189
    "test-accessor-assembler.cc",
jochen's avatar
jochen committed
190
    "test-accessors.cc",
191
    "test-allocation.cc",
jochen's avatar
jochen committed
192
    "test-api-accessors.cc",
193
    "test-api-array-buffer.cc",
194
    "test-api-icu.cc",
jochen's avatar
jochen committed
195
    "test-api-interceptors.cc",
196
    "test-api-stack-traces.cc",
197
    "test-api-typed-array.cc",
jochen's avatar
jochen committed
198 199 200 201 202 203 204 205 206
    "test-api.cc",
    "test-api.h",
    "test-array-list.cc",
    "test-atomicops.cc",
    "test-bignum-dtoa.cc",
    "test-bignum.cc",
    "test-bit-vector.cc",
    "test-circular-queue.cc",
    "test-code-layout.cc",
207
    "test-code-pages.cc",
jochen's avatar
jochen committed
208 209
    "test-code-stub-assembler.cc",
    "test-compiler.cc",
210
    "test-concurrent-descriptor-array.cc",
211
    "test-concurrent-feedback-vector.cc",
212
    "test-concurrent-js-array.cc",
213
    "test-concurrent-prototype.cc",
214
    "test-concurrent-script-context-table.cc",
215
    "test-concurrent-string.cc",
216
    "test-concurrent-transition-array.cc",
jochen's avatar
jochen committed
217 218 219 220
    "test-constantpool.cc",
    "test-conversions.cc",
    "test-cpu-profiler.cc",
    "test-date.cc",
221
    "test-debug-helper.cc",
jochen's avatar
jochen committed
222 223 224
    "test-debug.cc",
    "test-decls.cc",
    "test-deoptimization.cc",
225
    "test-descriptor-array.cc",
jochen's avatar
jochen committed
226 227 228 229 230
    "test-dictionary.cc",
    "test-diy-fp.cc",
    "test-double.cc",
    "test-dtoa.cc",
    "test-elements-kind.cc",
231
    "test-factory.cc",
jochen's avatar
jochen committed
232 233
    "test-fast-dtoa.cc",
    "test-feedback-vector.cc",
234
    "test-feedback-vector.h",
jochen's avatar
jochen committed
235 236 237 238 239 240
    "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",
241
    "test-hashcode.cc",
jochen's avatar
jochen committed
242 243
    "test-hashmap.cc",
    "test-heap-profiler.cc",
244
    "test-icache.cc",
jochen's avatar
jochen committed
245
    "test-identity-map.cc",
246
    "test-ignition-statistics-extension.cc",
jochen's avatar
jochen committed
247
    "test-inobject-slack-tracking.cc",
248
    "test-inspector.cc",
249
    "test-intl.cc",
250
    "test-js-weak-refs.cc",
jochen's avatar
jochen committed
251
    "test-liveedit.cc",
252
    "test-local-handles.cc",
jochen's avatar
jochen committed
253 254
    "test-lockers.cc",
    "test-log.cc",
255
    "test-managed.cc",
jochen's avatar
jochen committed
256
    "test-mementos.cc",
257
    "test-modules.cc",
jochen's avatar
jochen committed
258
    "test-object.cc",
259
    "test-orderedhashtable.cc",
jochen's avatar
jochen committed
260
    "test-parsing.cc",
261
    "test-persistent-handles.cc",
jochen's avatar
jochen committed
262 263
    "test-platform.cc",
    "test-profile-generator.cc",
264
    "test-property-details.cc",
265
    "test-ptr-compr-cage.cc",
jochen's avatar
jochen committed
266 267 268
    "test-random-number-generator.cc",
    "test-regexp.cc",
    "test-representation.cc",
269
    "test-roots.cc",
jochen's avatar
jochen committed
270 271
    "test-sampler-api.cc",
    "test-serialize.cc",
272
    "test-shared-strings.cc",
273
    "test-smi-lexicographic-compare.cc",
jochen's avatar
jochen committed
274 275
    "test-strings.cc",
    "test-strtod.cc",
276 277
    "test-swiss-name-dictionary-csa.cc",
    "test-swiss-name-dictionary-infra.cc",
278
    "test-swiss-name-dictionary.cc",
jochen's avatar
jochen committed
279
    "test-symbols.cc",
280
    "test-temporal-parser.cc",
jochen's avatar
jochen committed
281 282 283
    "test-thread-termination.cc",
    "test-threads.cc",
    "test-trace-event.cc",
284
    "test-traced-value.cc",
jochen's avatar
jochen committed
285
    "test-transitions.cc",
286
    "test-transitions.h",
jochen's avatar
jochen committed
287 288 289
    "test-typedarrays.cc",
    "test-types.cc",
    "test-unscopables-hidden-prototype.cc",
290
    "test-unwinder-code-pages.cc",
jochen's avatar
jochen committed
291 292
    "test-usecounters.cc",
    "test-utils.cc",
293
    "test-verifiers.cc",
jochen's avatar
jochen committed
294 295 296
    "test-version.cc",
    "test-weakmaps.cc",
    "test-weaksets.cc",
297
    "test-web-snapshots.cc",
298
    "torque/test-torque.cc",
jochen's avatar
jochen committed
299
    "trace-extension.cc",
300
    "trace-extension.h",
301
    "unicode-helpers.cc",
302
    "unicode-helpers.h",
jochen's avatar
jochen committed
303
  ]
machenbach's avatar
machenbach committed
304

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

396 397 398 399 400
  if (v8_use_perfetto) {
    # Perfetto doesn't use TraceObject.
    sources -= [ "test-trace-event.cc" ]
  }

401
  configs = [
402
    "../..:cppgc_base_config",
machenbach's avatar
machenbach committed
403 404
    "../..:external_config",
    "../..:internal_config_base",
405
    "../..:v8_tracing_config",
406
    ":cctest_sources_config",
machenbach's avatar
machenbach committed
407 408
  ]

409
  public_deps = [
410
    ":cctest_headers",
411
    "..:common_test_headers",
412
    "../..:v8_for_testing",
413
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
414
    "../..:v8_libplatform",
415
    "../../tools/debug_helper:v8_debug_helper",
machenbach's avatar
machenbach committed
416 417 418
    "//build/win:default_exe_manifest",
  ]

419 420 421 422 423
  if (v8_enable_webassembly) {
    sources += [
      "../common/wasm/flag-utils.h",
      "../common/wasm/test-signatures.h",
      "../common/wasm/wasm-macro-gen.h",
424 425 426 427 428 429
      "compiler/test-multiple-return.cc",

      # test-run-native-calls uses wasm's LinkageAllocator.
      "compiler/test-run-native-calls.cc",
      "test-api-wasm.cc",
      "test-js-to-wasm.cc",
430
      "wasm/test-backing-store.cc",
431 432 433 434 435
      "wasm/test-c-wasm-entry.cc",
      "wasm/test-compilation-cache.cc",
      "wasm/test-gc.cc",
      "wasm/test-grow-memory.cc",
      "wasm/test-jump-table-assembler.cc",
436
      "wasm/test-liftoff-for-fuzzing.cc",
437 438 439 440 441 442 443 444 445 446 447
      "wasm/test-liftoff-inspection.cc",
      "wasm/test-run-wasm-64.cc",
      "wasm/test-run-wasm-asmjs.cc",
      "wasm/test-run-wasm-atomics.cc",
      "wasm/test-run-wasm-atomics64.cc",
      "wasm/test-run-wasm-bulk-memory.cc",
      "wasm/test-run-wasm-exceptions.cc",
      "wasm/test-run-wasm-interpreter.cc",
      "wasm/test-run-wasm-js.cc",
      "wasm/test-run-wasm-memory64.cc",
      "wasm/test-run-wasm-module.cc",
448
      "wasm/test-run-wasm-relaxed-simd.cc",
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
      "wasm/test-run-wasm-sign-extension.cc",
      "wasm/test-run-wasm-simd-liftoff.cc",
      "wasm/test-run-wasm-simd.cc",
      "wasm/test-run-wasm-wrappers.cc",
      "wasm/test-run-wasm.cc",
      "wasm/test-streaming-compilation.cc",
      "wasm/test-wasm-breakpoints.cc",
      "wasm/test-wasm-codegen.cc",
      "wasm/test-wasm-import-wrapper-cache.cc",
      "wasm/test-wasm-metrics.cc",
      "wasm/test-wasm-serialization.cc",
      "wasm/test-wasm-shared-engine.cc",
      "wasm/test-wasm-stack.cc",
      "wasm/test-wasm-trap-position.cc",
      "wasm/wasm-atomics-utils.h",
      "wasm/wasm-run-utils.cc",
      "wasm/wasm-run-utils.h",
466 467
      "wasm/wasm-simd-utils.cc",
      "wasm/wasm-simd-utils.h",
468 469 470 471
    ]
    public_deps += [ "../..:wasm_test_common" ]
  }

472
  defines = []
473 474 475 476
  deps = [
    "../..:run_torque",
    "../..:v8_shared_internal_headers",
  ]
477

478 479
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
480
    public_deps += [ "//third_party/icu" ]
481 482 483 484
  } else {
    sources -= [ "test-intl.cc" ]
  }

485 486 487
  cflags = []
  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
488 489
      v8_current_cpu == "s390" || v8_current_cpu == "s390x" ||
      v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
Brice Dobry's avatar
Brice Dobry committed
490
      v8_current_cpu == "mipsel" || v8_current_cpu == "mipsel64" ||
491
      v8_current_cpu == "riscv64" || v8_current_cpu == "loong64") {
492 493
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
494 495 496
    if (!is_win) {
      cflags += [ "-ffp-contract=off" ]
    }
497 498
  }

499 500 501 502
  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
503 504 505 506
    cflags += [ "/wd4309" ]

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

    if (symbol_level == 2) {
      sources += [ "test-v8windbg.cc" ]
      deps += [ "../../tools/v8windbg:v8windbg_test" ]
    }
512
  }
513 514

  if (v8_use_perfetto) {
515
    deps += [
516 517
      # TODO(skyostil): Migrate to protozero.
      "//third_party/perfetto/protos/perfetto/trace:lite",
518
    ]
519
  }
machenbach's avatar
machenbach committed
520 521
}

522
v8_executable("generate-bytecode-expectations") {
523 524
  testonly = true

525 526 527 528 529 530 531 532 533 534 535 536
  sources = [
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/generate-bytecode-expectations.cc",
  ]

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

  deps = [
537
    ":cctest_headers",
538 539
    "../..:v8",
    "../..:v8_libbase",
540 541 542
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
543

544
  data = [ "interpreter/bytecode_expectations/" ]
545
}