| # 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/libfuzzer/fuzzer_test.gni") |
| import("//testing/test.gni") |
| |
| 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", |
| "recover_module/btree.cc", |
| "recover_module/btree.h", |
| "recover_module/cursor.cc", |
| "recover_module/cursor.h", |
| "recover_module/integers.cc", |
| "recover_module/integers.h", |
| "recover_module/module.cc", |
| "recover_module/module.h", |
| "recover_module/pager.cc", |
| "recover_module/pager.h", |
| "recover_module/parsing.cc", |
| "recover_module/parsing.h", |
| "recover_module/payload.cc", |
| "recover_module/payload.h", |
| "recover_module/record.cc", |
| "recover_module/record.h", |
| "recover_module/table.cc", |
| "recover_module/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", |
| ] |
| |
| defines = [ "IS_SQL_IMPL" ] |
| |
| deps = [ |
| "//base", |
| "//base/third_party/dynamic_annotations", |
| "//third_party/sqlite", |
| ] |
| |
| # 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", |
| "recover_module/module_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/database_test_peer.cc", |
| "test/database_test_peer.h", |
| "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", |
| ] |
| } |
| |
| # Why "built in"? Chromium used to have bespoke recovery code before SQLite |
| # had a built-in recovery module. See crbug.com/1513310 |
| fuzzer_test("sql_built_in_recovery_fuzzer") { |
| sources = [ "built_in_recovery_fuzzer.cc" ] |
| deps = [ |
| ":sql", |
| "//base", |
| "//base/test:test_support", |
| ] |
| |
| libfuzzer_options = [ "rss_limit_mb=4096" ] |
| } |
| |
| group("fuzzers") { |
| testonly = true |
| deps = [ "//sql/fuzzers:sql_built_in_recovery_lpm_fuzzer" ] |
| } |