| # 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/test.gni") |
| |
| # A collection of utilities useful to debuggers and similar programs. |
| |
| static_library("elflib") { |
| sources = [ |
| "elflib.cc", |
| ] |
| |
| deps = [ |
| "//zircon/system/public", |
| ] |
| |
| public_deps = [ |
| "//zircon/public/lib/fbl", |
| ] |
| } |
| |
| # An example stripped binary. Originally copied from out/x64/cowsay. |
| # ARM64 binary generated with: |
| # fx set core.arm64 --with //examples/cowsay |
| # fx build |
| # cp out/default/exe.unstripped/cowsay \ |
| # src/lib/elflib/test_data/unstripped_example.arm64.elf |
| # ./prebuilt/third_party/clang/linux-x64/bin/llvm-objcopy \ |
| # --strip-sections out/default/exe.unstripped/cowsay \ |
| # src/lib/elflib/test_data/unstripped_example_stripped.arm64.elf |
| copy("copy_example_elf") { |
| sources = [ |
| "test_data/stripped_example.elf", |
| "test_data/unstripped_example.arm64.elf", |
| "test_data/unstripped_example.elf", |
| "test_data/unstripped_example_stripped.arm64.elf", |
| "test_data/unstripped_example_stripped.elf", |
| ] |
| |
| outputs = [ |
| "$root_out_dir/test_data/elflib/{{source_file_part}}", |
| ] |
| |
| metadata = { |
| test_runtime_deps = [ |
| "$root_out_dir/test_data/elflib/stripped_example.elf", |
| "$root_out_dir/test_data/elflib/unstripped_example.elf", |
| "$root_out_dir/test_data/elflib/unstripped_example_stripped.elf", |
| "$root_out_dir/test_data/elflib/unstripped_example.arm64.elf", |
| "$root_out_dir/test_data/elflib/unstripped_example_stripped.arm64.elf", |
| ] |
| } |
| } |
| |
| test("elflib_tests") { |
| sources = [ |
| "elflib_unittest.cc", |
| ] |
| |
| deps = [ |
| ":elflib", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| ] |
| |
| data_deps = [ |
| ":copy_example_elf", |
| ] |
| } |