| # Copyright 2018 The Fuchsia 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("//build/testing/host_test_data.gni") |
| |
| static_library("symbols") { |
| friend = [ |
| ":*", |
| |
| # These "large" test files should really live in this directory but it's small and keeping it in |
| # the zxdb root makes the flag controlling the compilation of that target need to be local to |
| # only one file. |
| "//src/developer/debug/zxdb:zxdb_large_tests", |
| |
| # The client one directory up instantiates the "Impl" classes using the non-public headers. |
| "//src/developer/debug/zxdb/client/*", |
| ] |
| |
| public = [ |
| "arch.h", |
| "array_type.h", |
| "base_type.h", |
| "build_id_index.h", |
| "call_site.h", |
| "call_site_parameter.h", |
| "code_block.h", |
| "collection.h", |
| "compile_unit.h", |
| "const_value.h", |
| "data_member.h", |
| "dwarf_binary.h", |
| "dwarf_expr.h", |
| "dwarf_expr_eval.h", |
| "dwarf_lang.h", |
| "dwarf_location.h", |
| "dwarf_tag.h", |
| "dwarf_unit.h", |
| "elf_symbol.h", |
| "elf_symbol_record.h", |
| "enumeration.h", |
| "file_line.h", |
| "function.h", |
| "function_type.h", |
| "identifier.h", |
| "identifier_base.h", |
| "index.h", |
| "index_node.h", |
| "inheritance_path.h", |
| "inherited_from.h", |
| "input_location.h", |
| "lazy_symbol.h", |
| "line_details.h", |
| "line_table.h", |
| "loaded_module_symbols.h", |
| "location.h", |
| "member_ptr.h", |
| "modified_type.h", |
| "module_symbol_status.h", |
| "module_symbols.h", |
| "namespace.h", |
| "process_symbols.h", |
| "resolve_options.h", |
| "source_file_provider.h", |
| "source_util.h", |
| "symbol.h", |
| "symbol_context.h", |
| "symbol_data_provider.h", |
| "symbol_factory.h", |
| "symbol_test_parent_setter.h", |
| "symbol_utils.h", |
| "system_symbols.h", |
| "target_symbols.h", |
| "template_parameter.h", |
| "type.h", |
| "value.h", |
| "variable.h", |
| "variable_location.h", |
| "variant.h", |
| "variant_part.h", |
| "visit_scopes.h", |
| ] |
| |
| sources = [ |
| "arch.cc", |
| "array_type.cc", |
| "base_type.cc", |
| "build_id_index.cc", |
| "code_block.cc", |
| "collection.cc", |
| "compile_unit.cc", |
| "const_value.cc", |
| "data_member.cc", |
| "dwarf_abstract_child_iterator.h", |
| "dwarf_binary_impl.cc", |
| "dwarf_binary_impl.h", |
| "dwarf_die_decoder.cc", |
| "dwarf_die_decoder.h", |
| "dwarf_die_scanner.cc", |
| "dwarf_die_scanner.h", |
| "dwarf_expr.cc", |
| "dwarf_expr_eval.cc", |
| "dwarf_lang.cc", |
| "dwarf_location.cc", |
| "dwarf_stack_entry.cc", |
| "dwarf_stack_entry.h", |
| "dwarf_symbol_factory.cc", |
| "dwarf_symbol_factory.h", |
| "dwarf_tag.cc", |
| "dwarf_unit_impl.cc", |
| "dwarf_unit_impl.h", |
| "elf_symbol.cc", |
| "elf_symbol_record.cc", |
| "enumeration.cc", |
| "file_line.cc", |
| "find_line.cc", |
| "find_line.h", |
| "function.cc", |
| "function_type.cc", |
| "identifier.cc", |
| "identifier_base.cc", |
| "index.cc", |
| "index_node.cc", |
| "inheritance_path.cc", |
| "inherited_from.cc", |
| "input_location.cc", |
| "lazy_symbol.cc", |
| "line_details.cc", |
| "line_table.cc", |
| "line_table_impl.cc", |
| "line_table_impl.h", |
| "loaded_module_symbols.cc", |
| "location.cc", |
| "member_ptr.cc", |
| "modified_type.cc", |
| "module_symbols.cc", |
| "module_symbols_impl.cc", |
| "module_symbols_impl.h", |
| "namespace.cc", |
| "process_symbols.cc", |
| "source_util.cc", |
| "symbol.cc", |
| "symbol_context.cc", |
| "symbol_data_provider.cc", |
| "symbol_utils.cc", |
| "system_symbols.cc", |
| "target_symbols.cc", |
| "template_parameter.cc", |
| "type.cc", |
| "value.cc", |
| "variable.cc", |
| "variable_location.cc", |
| "variant.cc", |
| "variant_part.cc", |
| "visit_scopes.cc", |
| ] |
| |
| # This library can not use any part of the debugger other than the "common" |
| # base helpers. |
| public_deps = [ |
| "//src/developer/debug/ipc:client", |
| "//src/developer/debug/shared", |
| "//src/developer/debug/zxdb/common", |
| "//src/lib/elflib", |
| "//src/lib/fxl", |
| |
| # LLVMDebugInfoDWARF is made a public dep instead of a dep to propagate the |
| # no_rtti config from llvm_library targets. |
| "//src/lib/llvm:LLVMDebugInfoDWARF", |
| "//third_party/googletest:gtest_prod", |
| ] |
| |
| deps = [ |
| "//src/lib/elflib", |
| "//src/lib/files", |
| "//third_party/rapidjson", |
| ] |
| |
| # zxdb will be 500% slower in loading symbols if compiled with no optimization, |
| # which is not desirable for in-tree developers. Optimize us for speed by default. |
| configs -= [ "//build/config:default_optimize" ] |
| configs += [ "//build/config:optimize_speed" ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| static_library("test_support") { |
| testonly = true |
| |
| sources = [ |
| "index_test_support.cc", |
| "index_test_support.h", |
| "mock_line_table.cc", |
| "mock_line_table.h", |
| "mock_module_symbols.cc", |
| "mock_module_symbols.h", |
| "mock_source_file_provider.cc", |
| "mock_source_file_provider.h", |
| "mock_symbol_data_provider.cc", |
| "mock_symbol_data_provider.h", |
| "process_symbols_test_setup.cc", |
| "process_symbols_test_setup.h", |
| "test_symbol_module.cc", |
| "test_symbol_module.h", |
| "type_test_support.cc", |
| "type_test_support.h", |
| "variable_test_support.cc", |
| "variable_test_support.h", |
| ] |
| |
| public_deps = [ |
| ":symbols", |
| "//src/developer/debug/zxdb/common:test_support", |
| "//src/lib/llvm:LLVMDebugInfoDWARF", |
| ] |
| } |
| |
| if (is_host) { |
| # Copies the test libraries for zxdb tests to use when run on Linux or Mac. |
| default_shared_out_dir = |
| get_label_info("//anything(${default_toolchain}-shared)", "root_out_dir") |
| host_test_data("test_so") { |
| sources = [ |
| "$default_shared_out_dir/lib.unstripped/libzxdb_symbol_test.so", |
| "test_data/libsymbol_test_so.targetso", |
| "test_data/libsymbol_test_so_stripped.targetso", |
| ] |
| |
| # Use a ".targetso" extension because this isn't a library that can actually |
| # loaded on the host platform. |
| outputs = [ "$root_out_dir/test_data/zxdb/{{source_name_part}}.targetso" ] |
| |
| deps = [ "test_data:zxdb_symbol_test(${default_toolchain}-shared)" ] |
| } |
| |
| host_test_data("dot_buildid") { |
| sources = [ "test_data/libsymbol_test_so.targetso" ] |
| |
| outputs = [ |
| # This output name must match the build ID of the checked-in symbol file. See |
| # test_symbol_module.cc for the build ID constant used in the test code and instructions on |
| # how to update. |
| "$root_out_dir/test_data/zxdb/build_id/.build-id/9e/b335ffa35de20c.debug", |
| ] |
| } |
| |
| host_test_data("test_elf_file") { |
| # This file is a small valid ELF file for testing the parser with. |
| # It was generated by compiling the program: |
| # int main() { return 1; } |
| # on Linux with: |
| # gcc -O2 file.c |
| sources = [ "test_data/small_test_file.elf" ] |
| outputs = [ "$root_out_dir/test_data/zxdb/small_test_file.elf" ] |
| } |
| |
| host_test_data("symbol_index_files") { |
| sources = [ |
| "test_data/another.symbol-index.json", |
| "test_data/symbol-index", |
| "test_data/symbol-index.json", |
| ] |
| outputs = [ "$root_out_dir/test_data/zxdb/{{source_file_part}}" ] |
| } |
| } |
| |
| source_set("tests") { |
| testonly = true |
| |
| sources = [ |
| "build_id_index_unittest.cc", |
| "code_block_unittest.cc", |
| "collection_unittest.cc", |
| "const_value_unittest.cc", |
| "dwarf_abstract_child_iterator_unittest.cc", |
| "dwarf_expr_eval_unittest.cc", |
| "dwarf_location_unittest.cc", |
| "dwarf_symbol_factory_unittest.cc", |
| "dwarf_tag_unittest.cc", |
| "dwarf_test_util.cc", |
| "dwarf_test_util.h", |
| "elf_symbol_record_unittest.cc", |
| "elf_symbol_unittest.cc", |
| "find_line_unittest.cc", |
| "function_type_unittest.cc", |
| "identifier_unittest.cc", |
| "index_node_unittest.cc", |
| "index_unittest.cc", |
| "line_table_unittest.cc", |
| "loaded_module_symbols_unittest.cc", |
| "member_ptr_unittest.cc", |
| "mock_symbol_data_provider_unittest.cc", |
| "modified_type_unittest.cc", |
| "module_symbols_impl_unittest.cc", |
| "process_symbols_unittest.cc", |
| "source_util_unittest.cc", |
| "symbol_data_provider_unittest.cc", |
| "symbol_unittest.cc", |
| "symbol_utils_unittest.cc", |
| "target_symbols_unittest.cc", |
| "variable_location_unittest.cc", |
| "visit_scopes_unittest.cc", |
| ] |
| |
| deps = [ |
| ":symbols", |
| ":test_support", |
| "//src/developer/debug/zxdb/common:test_support", |
| "//src/lib/llvm:LLVMDebugInfoDWARF", |
| "//third_party/googletest:gtest", |
| ] |
| if (is_host) { |
| data_deps = [ |
| ":dot_buildid", |
| ":symbol_index_files", |
| ":test_elf_file", |
| ":test_so", |
| ] |
| } |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| source_set("perf_tests") { |
| testonly = true |
| |
| sources = [ "index_perftest.cc" ] |
| |
| deps = [ |
| ":symbols", |
| "//src/developer/debug/zxdb/common:perf_test", |
| ] |
| } |