blob: f945c529ffccdf8f52f5c65ac209280a412cc470 [file] [log] [blame]
# 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",
"file_line_function.cc",
"file_line_function.h",
"message_loop.cc",
"message_loop.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/public/lib/component/cpp",
"//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",
"message_loop_zircon.cc",
"message_loop_zircon.h",
]
public_deps += [
"//zircon/public/lib/fdio",
"//zircon/public/lib/zx",
]
}
}
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/elf_unittests/small_test_file.elf",
]
}
# 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/elf_unittests/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",
"stream_buffer_unittest.cc",
]
if (current_toolchain == host_toolchain) {
data_deps = [
":copy_test_file",
":copy_test_file_deprecated",
]
}
deps = [
":helper",
"//third_party/googletest:gtest",
]
}