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

sql / BUILD.gn [blame]

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/test.gni")
import("//tools/metrics/generate_allowlist_from_histograms_file.gni")

generate_allowlist_from_histograms_file("sql_name_variants") {
  namespace = "sql_metrics"
  input_xml_file = "//tools/metrics/histograms/metadata/sql/histograms.xml"
  output_file = "sql_name_variants.h"
  tag = "variant"
  allow_list_name = "DatabaseTag"
}

component("sql") {
  sources = [
    "database.cc",
    "database.h",
    "database_memory_dump_provider.cc",
    "database_memory_dump_provider.h",
    "error_delegate_util.cc",
    "error_delegate_util.h",
    "init_status.h",
    "initialization.cc",
    "initialization.h",
    "internal_api_token.h",
    "meta_table.cc",
    "meta_table.h",
    "recovery.cc",
    "recovery.h",
    "sandboxed_vfs.cc",
    "sandboxed_vfs.h",
    "sandboxed_vfs_file.cc",
    "sandboxed_vfs_file.h",
    "sql_features.cc",
    "sql_features.h",
    "sql_memory_dump_provider.cc",
    "sql_memory_dump_provider.h",
    "sqlite_result_code.cc",
    "sqlite_result_code.h",
    "sqlite_result_code_values.cc",
    "sqlite_result_code_values.h",
    "statement.cc",
    "statement.h",
    "statement_id.cc",
    "statement_id.h",
    "transaction.cc",
    "transaction.h",
    "vfs_wrapper.cc",
    "vfs_wrapper.h",
  ]

  #sources += get_target_outputs(":sql_name_variants")

  defines = [ "IS_SQL_IMPL" ]

  deps = [
    "//base",
    "//third_party/sqlite",
  ]

  public_deps = [ ":sql_name_variants" ]

  # For vfs_wrapper.cc time-machine exclusions.
  if (is_mac) {
    frameworks = [
      "CoreFoundation.framework",
      "CoreServices.framework",
    ]
  }

  if (is_fuchsia) {
    sources += [
      "vfs_wrapper_fuchsia.cc",
      "vfs_wrapper_fuchsia.h",
    ]
  }
}

static_library("test_support") {
  testonly = true
  sources = [
    "test/scoped_error_expecter.cc",
    "test/scoped_error_expecter.h",
    "test/test_helpers.cc",
    "test/test_helpers.h",
  ]

  public_deps = [ ":sql" ]
  deps = [
    "//base",
    "//testing/gtest",
    "//third_party/sqlite",
  ]
}

bundle_data("sql_unittests_bundle_data") {
  testonly = true
  sources = [ "test/data/recovery_387868" ]
  outputs = [ "{{bundle_resources_dir}}/" +
              "{{source_root_relative_dir}}/{{source_file_part}}" ]
}

test("sql_unittests") {
  sources = [
    "database_options_unittest.cc",
    "database_unittest.cc",
    "meta_table_unittest.cc",
    "recovery_unittest.cc",
    "sql_memory_dump_provider_unittest.cc",
    "sqlite_features_unittest.cc",
    "sqlite_result_code_unittest.cc",
    "statement_id_unittest.cc",
    "statement_unittest.cc",
    "test/paths.cc",
    "test/paths.h",
    "test/run_all_unittests.cc",
    "test/sql_test_suite.cc",
    "test/sql_test_suite.h",
    "transaction_unittest.cc",
  ]

  data = [ "test/data/" ]

  deps = [
    ":sql",
    ":sql_unittests_bundle_data",
    ":test_support",
    "//base/test:test_support",
    "//testing/gtest",
    "//third_party/sqlite",
  ]
}

group("fuzzers") {
  testonly = true
  deps = [ "//sql/fuzzers:sql_recovery_lpm_fuzzer" ]
}