BUILD.gn 14 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
if (is_fuchsia) {
  import("//build/config/fuchsia/rules.gni")

10
  cr_fuchsia_package("v8_unittests_pkg") {
11 12 13 14 15 16 17 18 19 20 21 22
    testonly = true
    binary = ":unittests"
    package_name_override = "v8_unittests"
  }

  fuchsia_package_runner("v8_unittests_fuchsia") {
    testonly = true
    package = ":v8_unittests_pkg"
    package_name_override = "v8_unittests"
  }
}

Michael Lippautz's avatar
Michael Lippautz committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# Stand-alone target for C++ GC unittests. This is used to ensure that it
# builds without V8 as well. They are also included in the regular unittests
# target for simplicity.
v8_executable("cppgc_unittests") {
  testonly = true

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

  sources = [ "heap/cppgc/run-all-unittests.cc" ]

  deps = [
    ":cppgc_unittests_sources",
38
    "../..:cppgc_for_testing",
Michael Lippautz's avatar
Michael Lippautz committed
39 40 41 42 43 44 45 46
    "//testing/gmock",
    "//testing/gtest",
  ]
}

v8_source_set("cppgc_unittests_sources") {
  testonly = true

47
  sources = [
48
    "heap/cppgc/concurrent-sweeper-unittest.cc",
49 50 51 52 53
    "heap/cppgc/custom-spaces-unittest.cc",
    "heap/cppgc/finalizer-trait-unittest.cc",
    "heap/cppgc/free-list-unittest.cc",
    "heap/cppgc/garbage-collected-unittest.cc",
    "heap/cppgc/gc-info-unittest.cc",
54 55
    "heap/cppgc/gc-invoker-unittest.cc",
    "heap/cppgc/heap-growing-unittest.cc",
56 57 58
    "heap/cppgc/heap-object-header-unittest.cc",
    "heap/cppgc/heap-page-unittest.cc",
    "heap/cppgc/heap-unittest.cc",
59
    "heap/cppgc/incremental-marking-schedule-unittest.cc",
60 61
    "heap/cppgc/logging-unittest.cc",
    "heap/cppgc/marker-unittest.cc",
62
    "heap/cppgc/marking-verifier-unittest.cc",
63 64
    "heap/cppgc/marking-visitor-unittest.cc",
    "heap/cppgc/member-unittest.cc",
65
    "heap/cppgc/minor-gc-unittest.cc",
66
    "heap/cppgc/object-start-bitmap-unittest.cc",
67 68 69 70 71
    "heap/cppgc/page-memory-unittest.cc",
    "heap/cppgc/persistent-unittest.cc",
    "heap/cppgc/prefinalizer-unittest.cc",
    "heap/cppgc/source-location-unittest.cc",
    "heap/cppgc/stack-unittest.cc",
72
    "heap/cppgc/stats-collector-unittest.cc",
73
    "heap/cppgc/sweeper-unittest.cc",
74 75
    "heap/cppgc/test-platform.cc",
    "heap/cppgc/test-platform.h",
76 77
    "heap/cppgc/tests.cc",
    "heap/cppgc/tests.h",
78 79
    "heap/cppgc/visitor-unittest.cc",
    "heap/cppgc/worklist-unittest.cc",
80
    "heap/cppgc/write-barrier-unittest.cc",
81
  ]
Michael Lippautz's avatar
Michael Lippautz committed
82 83 84 85

  configs = [
    "../..:external_config",
    "../..:internal_config_base",
86
    "../..:cppgc_base_config",
Michael Lippautz's avatar
Michael Lippautz committed
87 88 89 90 91 92 93 94
  ]

  deps = [
    "//testing/gmock",
    "//testing/gtest",
  ]
}

95
v8_executable("unittests") {
machenbach's avatar
machenbach committed
96 97
  testonly = true

98 99 100 101 102 103
  # TODO(machenbach): Translate from gyp.
  #['OS=="aix"', {
  #  'ldflags': [ '-Wl,-bbigtoc' ],
  #}],

  deps = [
Michael Lippautz's avatar
Michael Lippautz committed
104
    ":cppgc_unittests_sources",
105 106 107 108 109
    ":unittests_sources",
    "../..:v8_for_testing",
    "../..:v8_libbase",
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
110 111
    "//testing/gmock",
    "//testing/gtest",
112 113
  ]

114
  data_deps = [ "../../tools:v8_testrunner" ]
115 116 117 118 119 120

  data = [
    "testcfg.py",
    "unittests.status",
  ]

121 122 123 124 125
  configs = [
    "../..:external_config",
    "../..:internal_config_base",
  ]
}
126

127 128 129
v8_source_set("unittests_sources") {
  testonly = true

jochen's avatar
jochen committed
130
  sources = [
131
    "../../test/common/assembler-tester.h",
132
    "../../test/common/wasm/wasm-macro-gen.h",
133 134
    "../../testing/gmock-support.h",
    "../../testing/gtest-support.h",
135
    "api/access-check-unittest.cc",
136
    "api/exception-unittest.cc",
137
    "api/interceptor-unittest.cc",
138
    "api/isolate-unittest.cc",
139
    "api/remote-object-unittest.cc",
140
    "api/resource-constraints-unittest.cc",
141
    "api/v8-object-unittest.cc",
142
    "asmjs/asm-scanner-unittest.cc",
143
    "asmjs/asm-types-unittest.cc",
144
    "base/address-region-unittest.cc",
jochen's avatar
jochen committed
145 146 147 148 149 150 151 152 153
    "base/atomic-utils-unittest.cc",
    "base/bits-unittest.cc",
    "base/cpu-unittest.cc",
    "base/division-by-constant-unittest.cc",
    "base/flags-unittest.cc",
    "base/functional-unittest.cc",
    "base/ieee754-unittest.cc",
    "base/iterator-unittest.cc",
    "base/logging-unittest.cc",
154
    "base/macros-unittest.cc",
155
    "base/ostreams-unittest.cc",
jochen's avatar
jochen committed
156 157 158 159 160
    "base/platform/condition-variable-unittest.cc",
    "base/platform/mutex-unittest.cc",
    "base/platform/platform-unittest.cc",
    "base/platform/semaphore-unittest.cc",
    "base/platform/time-unittest.cc",
161
    "base/region-allocator-unittest.cc",
jochen's avatar
jochen committed
162
    "base/sys-info-unittest.cc",
163
    "base/template-utils-unittest.cc",
164
    "base/threaded-list-unittest.cc",
jochen's avatar
jochen committed
165
    "base/utils/random-number-generator-unittest.cc",
166
    "base/vlq-base64-unittest.cc",
Yang Guo's avatar
Yang Guo committed
167 168 169 170
    "codegen/code-stub-assembler-unittest.cc",
    "codegen/code-stub-assembler-unittest.h",
    "codegen/register-configuration-unittest.cc",
    "codegen/source-position-table-unittest.cc",
171
    "compiler-dispatcher/compiler-dispatcher-unittest.cc",
172
    "compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc",
173 174 175 176 177
    "compiler/backend/instruction-selector-unittest.cc",
    "compiler/backend/instruction-selector-unittest.h",
    "compiler/backend/instruction-sequence-unittest.cc",
    "compiler/backend/instruction-sequence-unittest.h",
    "compiler/backend/instruction-unittest.cc",
jochen's avatar
jochen committed
178
    "compiler/branch-elimination-unittest.cc",
179
    "compiler/bytecode-analysis-unittest.cc",
jochen's avatar
jochen committed
180 181 182 183
    "compiler/checkpoint-elimination-unittest.cc",
    "compiler/common-operator-reducer-unittest.cc",
    "compiler/common-operator-unittest.cc",
    "compiler/compiler-test-utils.h",
184
    "compiler/constant-folding-reducer-unittest.cc",
jochen's avatar
jochen committed
185 186 187
    "compiler/control-equivalence-unittest.cc",
    "compiler/control-flow-optimizer-unittest.cc",
    "compiler/dead-code-elimination-unittest.cc",
188
    "compiler/decompression-optimizer-unittest.cc",
jochen's avatar
jochen committed
189 190 191 192 193 194 195 196
    "compiler/diamond-unittest.cc",
    "compiler/effect-control-linearizer-unittest.cc",
    "compiler/graph-reducer-unittest.cc",
    "compiler/graph-reducer-unittest.h",
    "compiler/graph-trimmer-unittest.cc",
    "compiler/graph-unittest.cc",
    "compiler/graph-unittest.h",
    "compiler/int64-lowering-unittest.cc",
197
    "compiler/js-call-reducer-unittest.cc",
jochen's avatar
jochen committed
198 199
    "compiler/js-create-lowering-unittest.cc",
    "compiler/js-intrinsic-lowering-unittest.cc",
200
    "compiler/js-native-context-specialization-unittest.cc",
jochen's avatar
jochen committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214
    "compiler/js-operator-unittest.cc",
    "compiler/js-typed-lowering-unittest.cc",
    "compiler/linkage-tail-call-unittest.cc",
    "compiler/load-elimination-unittest.cc",
    "compiler/loop-peeling-unittest.cc",
    "compiler/machine-operator-reducer-unittest.cc",
    "compiler/machine-operator-unittest.cc",
    "compiler/node-cache-unittest.cc",
    "compiler/node-matchers-unittest.cc",
    "compiler/node-properties-unittest.cc",
    "compiler/node-test-utils.cc",
    "compiler/node-test-utils.h",
    "compiler/node-unittest.cc",
    "compiler/opcodes-unittest.cc",
215
    "compiler/persistent-unittest.cc",
216
    "compiler/redundancy-elimination-unittest.cc",
217
    "compiler/regalloc/live-range-unittest.cc",
218
    "compiler/regalloc/mid-tier-register-allocator-unittest.cc",
219 220
    "compiler/regalloc/move-optimizer-unittest.cc",
    "compiler/regalloc/register-allocator-unittest.cc",
jochen's avatar
jochen committed
221 222 223
    "compiler/schedule-unittest.cc",
    "compiler/scheduler-rpo-unittest.cc",
    "compiler/scheduler-unittest.cc",
224
    "compiler/simplified-lowering-unittest.cc",
jochen's avatar
jochen committed
225 226 227 228 229 230
    "compiler/simplified-operator-reducer-unittest.cc",
    "compiler/simplified-operator-unittest.cc",
    "compiler/state-values-utils-unittest.cc",
    "compiler/typed-optimization-unittest.cc",
    "compiler/typer-unittest.cc",
    "compiler/value-numbering-reducer-unittest.cc",
231
    "compiler/zone-stats-unittest.cc",
Yang Guo's avatar
Yang Guo committed
232 233 234 235
    "date/date-cache-unittest.cc",
    "diagnostics/eh-frame-iterator-unittest.cc",
    "diagnostics/eh-frame-writer-unittest.cc",
    "execution/microtask-queue-unittest.cc",
236
    "heap/allocation-observer-unittest.cc",
237
    "heap/barrier-unittest.cc",
238
    "heap/bitmap-test-utils.h",
jochen's avatar
jochen committed
239
    "heap/bitmap-unittest.cc",
240
    "heap/code-object-registry-unittest.cc",
241
    "heap/embedder-tracing-unittest.cc",
jochen's avatar
jochen committed
242 243
    "heap/gc-idle-time-handler-unittest.cc",
    "heap/gc-tracer-unittest.cc",
244
    "heap/heap-controller-unittest.cc",
jochen's avatar
jochen committed
245
    "heap/heap-unittest.cc",
246
    "heap/heap-utils.h",
247
    "heap/item-parallel-job-unittest.cc",
248
    "heap/js-member-unittest.cc",
249
    "heap/list-unittest.cc",
250
    "heap/local-factory-unittest.cc",
251
    "heap/local-heap-unittest.cc",
jochen's avatar
jochen committed
252
    "heap/marking-unittest.cc",
253
    "heap/marking-worklist-unittest.cc",
jochen's avatar
jochen committed
254
    "heap/memory-reducer-unittest.cc",
255
    "heap/object-stats-unittest.cc",
256
    "heap/persistent-handles-unittest.cc",
257
    "heap/safepoint-unittest.cc",
jochen's avatar
jochen committed
258
    "heap/slot-set-unittest.cc",
259
    "heap/spaces-unittest.cc",
260
    "heap/unified-heap-unittest.cc",
261
    "heap/unmapper-unittest.cc",
262
    "heap/worklist-unittest.cc",
jochen's avatar
jochen committed
263 264
    "interpreter/bytecode-array-builder-unittest.cc",
    "interpreter/bytecode-array-iterator-unittest.cc",
265
    "interpreter/bytecode-array-random-iterator-unittest.cc",
266
    "interpreter/bytecode-array-writer-unittest.cc",
jochen's avatar
jochen committed
267
    "interpreter/bytecode-decoder-unittest.cc",
268
    "interpreter/bytecode-node-unittest.cc",
269
    "interpreter/bytecode-operands-unittest.cc",
jochen's avatar
jochen committed
270 271
    "interpreter/bytecode-register-allocator-unittest.cc",
    "interpreter/bytecode-register-optimizer-unittest.cc",
272
    "interpreter/bytecode-source-info-unittest.cc",
273
    "interpreter/bytecode-utils.h",
jochen's avatar
jochen committed
274 275 276 277
    "interpreter/bytecodes-unittest.cc",
    "interpreter/constant-array-builder-unittest.cc",
    "interpreter/interpreter-assembler-unittest.cc",
    "interpreter/interpreter-assembler-unittest.h",
278
    "libplatform/default-job-unittest.cc",
jochen's avatar
jochen committed
279
    "libplatform/default-platform-unittest.cc",
280
    "libplatform/default-worker-threads-task-runner-unittest.cc",
jochen's avatar
jochen committed
281 282
    "libplatform/task-queue-unittest.cc",
    "libplatform/worker-thread-unittest.cc",
Yang Guo's avatar
Yang Guo committed
283 284 285
    "logging/counters-unittest.cc",
    "numbers/bigint-unittest.cc",
    "numbers/conversions-unittest.cc",
286
    "objects/backing-store-unittest.cc",
Yang Guo's avatar
Yang Guo committed
287
    "objects/object-unittest.cc",
288
    "objects/osr-optimized-code-cache-unittest.cc",
Yang Guo's avatar
Yang Guo committed
289
    "objects/value-serializer-unittest.cc",
290
    "objects/weakarraylist-unittest.cc",
291
    "parser/ast-value-unittest.cc",
292
    "parser/preparser-unittest.cc",
Yang Guo's avatar
Yang Guo committed
293
    "profiler/strings-storage-unittest.cc",
294
    "regress/regress-crbug-1041240-unittest.cc",
295
    "regress/regress-crbug-1056054-unittest.cc",
296
    "regress/regress-crbug-938251-unittest.cc",
jochen's avatar
jochen committed
297
    "run-all-unittests.cc",
Yang Guo's avatar
Yang Guo committed
298 299 300 301
    "strings/char-predicates-unittest.cc",
    "strings/unicode-unittest.cc",
    "tasks/background-compile-task-unittest.cc",
    "tasks/cancelable-tasks-unittest.cc",
302 303
    "test-helpers.cc",
    "test-helpers.h",
jochen's avatar
jochen committed
304 305
    "test-utils.cc",
    "test-utils.h",
306
    "torque/earley-parser-unittest.cc",
307 308
    "torque/ls-json-unittest.cc",
    "torque/ls-message-unittest.cc",
309
    "torque/ls-server-data-unittest.cc",
310
    "torque/torque-unittest.cc",
311
    "torque/torque-utils-unittest.cc",
Yang Guo's avatar
Yang Guo committed
312 313 314 315
    "utils/allocation-unittest.cc",
    "utils/detachable-vector-unittest.cc",
    "utils/locked-queue-unittest.cc",
    "utils/utils-unittest.cc",
316
    "utils/vector-unittest.cc",
jochen's avatar
jochen committed
317 318
    "wasm/control-transfer-unittest.cc",
    "wasm/decoder-unittest.cc",
319
    "wasm/function-body-decoder-unittest.cc",
jochen's avatar
jochen committed
320 321 322
    "wasm/leb-helper-unittest.cc",
    "wasm/loop-assignment-analysis-unittest.cc",
    "wasm/module-decoder-unittest.cc",
323
    "wasm/simd-shuffle-unittest.cc",
324
    "wasm/streaming-decoder-unittest.cc",
325
    "wasm/subtyping-unittest.cc",
326
    "wasm/wasm-code-manager-unittest.cc",
327
    "wasm/wasm-compiler-unittest.cc",
jochen's avatar
jochen committed
328
    "wasm/wasm-macro-gen-unittest.cc",
329
    "wasm/wasm-module-builder-unittest.cc",
330
    "wasm/wasm-module-sourcemap-unittest.cc",
331
    "zone/zone-allocator-unittest.cc",
332
    "zone/zone-chunk-list-unittest.cc",
333
    "zone/zone-unittest.cc",
jochen's avatar
jochen committed
334
  ]
machenbach's avatar
machenbach committed
335

336 337 338 339
  if (v8_enable_wasm_gdb_remote_debugging) {
    sources += [ "wasm/wasm-gdbserver-unittest.cc" ]
  }

340 341 342 343
  if (v8_enable_conservative_stack_scanning) {
    sources += [ "heap/object-start-bitmap-unittest.cc" ]
  }

344
  if (v8_current_cpu == "arm") {
345 346 347 348
    sources += [
      "assembler/turbo-assembler-arm-unittest.cc",
      "compiler/arm/instruction-selector-arm-unittest.cc",
    ]
349
  } else if (v8_current_cpu == "arm64") {
350 351 352 353
    sources += [
      "assembler/turbo-assembler-arm64-unittest.cc",
      "compiler/arm64/instruction-selector-arm64-unittest.cc",
    ]
354
  } else if (v8_current_cpu == "x86") {
355 356 357 358
    sources += [
      "assembler/turbo-assembler-ia32-unittest.cc",
      "compiler/ia32/instruction-selector-ia32-unittest.cc",
    ]
359
  } else if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel") {
360 361 362 363
    sources += [
      "assembler/turbo-assembler-mips-unittest.cc",
      "compiler/mips/instruction-selector-mips-unittest.cc",
    ]
364
  } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
365 366 367 368
    sources += [
      "assembler/turbo-assembler-mips64-unittest.cc",
      "compiler/mips64/instruction-selector-mips64-unittest.cc",
    ]
369
  } else if (v8_current_cpu == "x64") {
370 371 372
    sources += [
      "assembler/turbo-assembler-x64-unittest.cc",
      "compiler/x64/instruction-selector-x64-unittest.cc",
373
      "wasm/trap-handler-x64-unittest.cc",
374
    ]
375
  } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
376 377 378 379
    sources += [
      "assembler/turbo-assembler-ppc-unittest.cc",
      "compiler/ppc/instruction-selector-ppc-unittest.cc",
    ]
380
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
381 382 383 384
    sources += [
      "assembler/turbo-assembler-s390-unittest.cc",
      "compiler/s390/instruction-selector-s390-unittest.cc",
    ]
machenbach's avatar
machenbach committed
385 386
  }

387 388 389 390 391 392 393 394
  if (is_posix) {
    sources += [ "wasm/trap-handler-posix-unittest.cc" ]
  }

  if (is_win) {
    sources += [ "wasm/trap-handler-win-unittest.cc" ]
  }

395
  configs = [
396
    "../..:cppgc_base_config",
machenbach's avatar
machenbach committed
397 398 399 400 401
    "../..:external_config",
    "../..:internal_config_base",
  ]

  deps = [
402
    "..:common_test_headers",
403
    "../..:v8_for_testing",
404
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
405
    "../..:v8_libplatform",
406
    "../..:wasm_test_common",
407
    "../../third_party/inspector_protocol:crdtp_test",
machenbach's avatar
machenbach committed
408
    "//build/win:default_exe_manifest",
409 410
    "//testing/gmock",
    "//testing/gtest",
machenbach's avatar
machenbach committed
411 412
  ]

413 414 415 416 417 418
  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" ]
  }
machenbach's avatar
machenbach committed
419
}