BUILD.gn 13.8 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
  sources = [ "cctest.h" ]
61 62
}

63 64
v8_source_set("cctest_sources") {
  testonly = true
machenbach's avatar
machenbach committed
65

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

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

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

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

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

418
  defines = []
419
  deps = [ "../..:run_torque" ]
420

421 422
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
423
    public_deps += [ "//third_party/icu" ]
424 425 426 427
  } else {
    sources -= [ "test-intl.cc" ]
  }

428 429 430
  cflags = []
  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
431 432 433
      v8_current_cpu == "s390" || v8_current_cpu == "s390x" ||
      v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
      v8_current_cpu == "mipsel" || v8_current_cpu == "mipsel64") {
434 435
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
436 437 438
    if (!is_win) {
      cflags += [ "-ffp-contract=off" ]
    }
439 440
  }

441 442 443 444
  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
445 446 447 448
    cflags += [ "/wd4309" ]

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

    if (symbol_level == 2) {
      sources += [ "test-v8windbg.cc" ]
      deps += [ "../../tools/v8windbg:v8windbg_test" ]
    }
454
  }
455 456

  if (v8_use_perfetto) {
457
    deps += [
458 459
      # TODO(skyostil): Migrate to protozero.
      "//third_party/perfetto/protos/perfetto/trace:lite",
460
    ]
461
  }
machenbach's avatar
machenbach committed
462 463
}

464
v8_executable("generate-bytecode-expectations") {
465 466
  testonly = true

467 468 469 470 471 472 473 474 475 476 477 478
  sources = [
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/generate-bytecode-expectations.cc",
  ]

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

  deps = [
479
    ":cctest_headers",
480 481
    "../..:v8",
    "../..:v8_libbase",
482 483 484
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
485

486
  data = [ "interpreter/bytecode_expectations/" ]
487
}