| # Copyright 2019 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") |
| import("//build/zircon/c_utils.gni") |
| import("//zircon/vdso/vdso.gni") |
| |
| import("//build/zircon/migrated_targets.gni") |
| |
| config("kazoo_config") { |
| visibility = [ ":*" ] |
| include_dirs = [ rebase_path("../..") ] |
| } |
| |
| zx_library("kazoo_lib") { |
| sdk = "source" |
| |
| configs += [ ":kazoo_config" ] |
| |
| sources = [ |
| "alias_workaround.cc", |
| "alias_workaround.h", |
| "c_ulib_header_output.cc", |
| "category_output.cc", |
| "cdecl_output.cc", |
| "go_syscalls_output.cc", |
| "go_vdso_output.cc", |
| "json_output.cc", |
| "kernel_wrappers_output.cc", |
| "ktrace_output.cc", |
| "output_util.cc", |
| "output_util.h", |
| "outputs.h", |
| "rust_output.cc", |
| "string_util.cc", |
| "string_util.h", |
| "syscall_library.cc", |
| "syscall_library.h", |
| "syscall_numbers_output.cc", |
| "writer.cc", |
| "writer.h", |
| ] |
| |
| deps = [ "//zircon/system/public" ] |
| |
| public_deps = [ "//third_party/rapidjson" ] |
| } |
| |
| zx_host_tool("kazoo") { |
| configs += [ ":kazoo_config" ] |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ ":kazoo_lib" ] |
| deps += [ "//zircon/system/ulib/cmdline" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":kazoo-syscall-golden-test", |
| ":kazoo-unittests", |
| ] |
| } |
| |
| test("kazoo-unittests") { |
| configs += [ ":kazoo_config" ] |
| output_name = "kazoo-test" |
| |
| deps = [ |
| ":generate_test_files", |
| ":kazoo_lib", |
| ] |
| |
| # The "../.." is so that the generated files can be included with a |
| # "tools/kazoo/" prefix. |
| include_dirs = [ "$target_gen_dir/../.." ] |
| |
| sources = [ |
| "alias_workaround_test.cc", |
| "c_ulib_header_output_test.cc", |
| "category_output_test.cc", |
| "cdecl_output_test.cc", |
| "go_syscalls_output_test.cc", |
| "go_vdso_output_test.cc", |
| "json_output_test.cc", |
| "kernel_wrappers_output_test.cc", |
| "ktrace_output_test.cc", |
| "output_util_test.cc", |
| "rust_output_test.cc", |
| "string_util_test.cc", |
| "syscall_library_test.cc", |
| "syscall_numbers_output_test.cc", |
| "test_main.cc", |
| "writer_test.cc", |
| ] |
| } |
| |
| zx_host_tool_action_foreach("test_files_fidl_to_json") { |
| tool = "//tools/fidl/fidlc:fidlc" |
| |
| args = [ |
| "--experimental", |
| "new_syntax_only", |
| "--json", |
| rebase_path("$target_gen_dir", root_build_dir) + |
| "/{{source_name_part}}.json", |
| "--files", |
| "{{source}}", |
| rebase_path("//zircon/vdso/rights.fidl", root_build_dir), |
| rebase_path("//zircon/vdso/zx_common.fidl", root_build_dir), |
| rebase_path("//zircon/vdso/zx_syscall.fidl", root_build_dir), |
| ] |
| |
| inputs = [ |
| "//zircon/vdso/rights.fidl", |
| "//zircon/vdso/zx_common.fidl", |
| "//zircon/vdso/zx_syscall.fidl", |
| ] |
| |
| outputs = [ "$target_gen_dir/{{source_name_part}}.json" ] |
| |
| sources = [ |
| "test_aliases.test.fidl", |
| "test_go_nonblocking.test.fidl", |
| "test_go_reserved_words.test.fidl", |
| "test_kernel_cases.test.fidl", |
| "test_kernelwrappers.test.fidl", |
| "test_no_methods.test.fidl", |
| "test_one_protocol_one_method.test.fidl", |
| "test_one_protocol_two_methods.test.fidl", |
| "test_one_protocol_two_methods_with_internal.test.fidl", |
| "test_out_voidptr.test.fidl", |
| "test_ownership_annotations.test.fidl", |
| "test_pointers_and_vectors.test.fidl", |
| "test_rights_specs.test.fidl", |
| "test_rust_selection.test.fidl", |
| "test_selection.test.fidl", |
| "test_various_categories.test.fidl", |
| "test_vdsowrappers.test.fidl", |
| ] |
| } |
| |
| zx_host_tool_action_foreach("test_files_fidl_to_json_zxio") { |
| tool = "//tools/fidl/fidlc:fidlc" |
| |
| args = [ |
| "--experimental", |
| "new_syntax_only", |
| "--json", |
| rebase_path("$target_gen_dir", root_build_dir) + |
| "/{{source_name_part}}.json", |
| "--files", |
| "{{source}}", |
| |
| # No zx fidls here compared with above. |
| ] |
| |
| outputs = [ "$target_gen_dir/{{source_name_part}}.json" ] |
| |
| sources = [ |
| "test_ulib_bits.test.fidl", |
| "test_ulib_enums.test.fidl", |
| "test_ulib_tables.test.fidl", |
| "test_ulib_type_aliases.test.fidl", |
| ] |
| } |
| |
| action_foreach("generate_test_files") { |
| script = "fidl_to_h.py" |
| |
| deps = [ |
| ":test_files_fidl_to_json", |
| ":test_files_fidl_to_json_zxio", |
| ] |
| |
| args = [ |
| "{{source}}", |
| rebase_path("$target_gen_dir", root_build_dir) + |
| "/test_ir_{{source_name_part}}.h", |
| "{{source_name_part}}", |
| ] |
| |
| outputs = [ "$target_gen_dir/test_ir_{{source_name_part}}.h" ] |
| |
| sources = get_target_outputs(":test_files_fidl_to_json") + |
| get_target_outputs(":test_files_fidl_to_json_zxio") |
| } |
| |
| fidlc_rspfile = "$target_gen_dir/fidlc.rspfile" |
| link_output_rspfile("fidlc.rspfile") { |
| visibility = [ ":*" ] |
| outputs = [ fidlc_rspfile ] |
| deps = [ "//tools/fidl/fidlc:fidlc" ] |
| } |
| |
| kazoo_rspfile = "$target_gen_dir/kazoo.rspfile" |
| link_output_rspfile("kazoo.rspfile") { |
| visibility = [ ":*" ] |
| outputs = [ kazoo_rspfile ] |
| deps = [ ":kazoo" ] |
| } |
| |
| action("kazoo-syscall-golden-test") { |
| deps = [ |
| ":fidlc.rspfile", |
| ":kazoo.rspfile", |
| ] |
| |
| script = "golden-test.py" |
| sources = [ |
| "golden.txt", |
| fidlc_rspfile, |
| kazoo_rspfile, |
| ] |
| foreach(fidl, all_syscall_fidl_files) { |
| sources += [ "//zircon/vdso/" + fidl ] |
| } |
| |
| _new_golden = "$target_out_dir/new-golden.txt" |
| outputs = [ |
| "$target_gen_dir/kazoo-golden-test", |
| _new_golden, |
| ] |
| depfile = "$target_gen_dir/kazoo-golden-test.d" |
| |
| args = [ |
| "--fidlc", |
| rebase_path(fidlc_rspfile, root_build_dir), |
| "--kazoo", |
| rebase_path(kazoo_rspfile, root_build_dir), |
| "--syscalls", |
| rebase_path("//zircon/vdso", root_build_dir), |
| "--output-touch", |
| rebase_path(outputs[0], root_build_dir), |
| "--tmp-base", |
| rebase_path("${target_gen_dir}/__untraced_kazoo_test_dir__", |
| root_build_dir), |
| "--new-golden", |
| rebase_path(_new_golden, root_build_dir), |
| "--depfile", |
| rebase_path(depfile, root_build_dir), |
| ] |
| } |