| # 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. |
| |
| # This library contains helper classes used by both the debug_agent and zxdb |
| # but that aren't directly related to the protocol. |
| static_library("helper") { |
| sources = [ |
| "arch_arm64.h", |
| "arch_x86.h", |
| "buffered_fd.cc", |
| "buffered_fd.h", |
| "elf.cc", |
| "elf.h", |
| "message_loop.cc", |
| "message_loop.h", |
| "regex.cc", |
| "regex.h", |
| "stream_buffer.cc", |
| "stream_buffer.h", |
| "test_stream_buffer.cc", |
| "test_stream_buffer.h", |
| "zx_status.cc", |
| "zx_status.h", |
| "zx_status_definitions.h", |
| ] |
| |
| public_deps = [ |
| "//garnet/lib/debug_ipc/debug", |
| "//garnet/public/lib/fxl", |
| ] |
| |
| deps = [ |
| "//garnet/lib/elflib", |
| ] |
| |
| if (current_toolchain == host_toolchain) { |
| # Host toolchain. |
| sources += [ |
| "message_loop_poll.cc", |
| "message_loop_poll.h", |
| ] |
| } else { |
| # Target toolchain. |
| sources += [ |
| "buffered_zx_socket.cc", |
| "buffered_zx_socket.h", |
| "event_handlers.cc", |
| "event_handlers.h", |
| # Implementation of message loop using async-loop. |
| "message_loop_async.cc", |
| "message_loop_async.h", |
| # New interface to abstract message loop from the debug agent. |
| "message_loop_target.cc", |
| "message_loop_target.h", |
| # Original message loop (previously MessageLoopZircon). |
| "message_loop_zircon.cc", |
| "message_loop_zircon.h", |
| ] |
| |
| public_deps += [ |
| "//zircon/public/lib/fdio", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/async-loop-cpp", |
| ] |
| } |
| } |
| |
| if (current_toolchain == host_toolchain) { |
| # Copy the test file to the build directory, as elf_unittests will not be run |
| # near the source code. |
| copy("copy_test_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; }tests" |
| # on Linux with: |
| # gcc -O2 file.c |
| sources = [ |
| "testdata/small_test_file.elf", |
| ] |
| outputs = [ |
| "$root_out_dir/test_data/debug_ipc/small_test_file.elf", |
| ] |
| |
| metadata = { |
| test_runtime_deps = outputs |
| } |
| } |
| |
| # TODO(IN-819): Delete once zxdb_tests is no longer being run out of |
| # $root_build_dir/host_tests/. |
| copy("copy_test_file_deprecated") { |
| sources = [ |
| "testdata/small_test_file.elf", |
| ] |
| outputs = [ |
| "$root_build_dir/host_tests/test_data/debug_ipc/small_test_file.elf", |
| ] |
| } |
| } |
| |
| # Unit tests for this directory. These are intended to be referenced by unit |
| # test targets for the consumers of this library. |
| source_set("tests") { |
| testonly = true |
| sources = [ |
| "elf_unittest.cc", |
| "message_loop_unittest.cc", |
| "regex_unittest.cc", |
| "stream_buffer_unittest.cc", |
| ] |
| |
| if (current_toolchain == host_toolchain) { |
| data_deps = [ |
| ":copy_test_file", |
| ":copy_test_file_deprecated", |
| ] |
| } |
| deps = [ |
| ":helper", |
| "//third_party/googletest:gtest", |
| ] |
| } |