| # 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/fidl/fidl.gni") |
| import("//build/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/host.gni") |
| import("//build/testing/golden_test.gni") |
| import("//build/testing/host_test_data.gni") |
| import("//src/tests/fidl/conformance_suite/gidl-conformance-suite.gni") |
| import("//tools/fidl/gidl/gidl.gni") |
| |
| go_library("gopkg") { |
| name = "go.fuchsia.dev/fuchsia/tools/fidl/gidl/..." |
| deps = [ "//tools/fidl/lib/fidlgen" ] |
| sources = [ |
| "c/conformance.go", |
| "config/defaults.go", |
| "dart/benchmarks.go", |
| "dart/common.go", |
| "dart/conformance.go", |
| "fuzzer_corpus/conformance.go", |
| "golang/benchmarks.go", |
| "golang/common.go", |
| "golang/conformance.go", |
| "golang/golang_test.go", |
| "hlcpp/benchmarks.go", |
| "hlcpp/builder.go", |
| "hlcpp/conformance.go", |
| "hlcpp/equality_builder.go", |
| "ir/error.go", |
| "ir/test_case.go", |
| "ir/util.go", |
| "ir/value.go", |
| "llcpp/benchmarks.go", |
| "llcpp/conformance.go", |
| "llcpp/lib/allocator_builder.go", |
| "llcpp/lib/common.go", |
| "llcpp/lib/equality_builder.go", |
| "llcpp/lib/unowned_builder.go", |
| "main.go", |
| "mixer/mixer.go", |
| "mixer/mixer_test.go", |
| "parser/generators.go", |
| "parser/parser.go", |
| "parser/parser_test.go", |
| "reference/benchmarks.go", |
| "rust/benchmarks.go", |
| "rust/common.go", |
| "rust/conformance.go", |
| "walker/benchmarks.go", |
| ] |
| } |
| |
| go_binary("gidl") { |
| gopackage = "go.fuchsia.dev/fuchsia/tools/fidl/gidl" |
| deps = [ ":gopkg" ] |
| } |
| |
| install_host_tools("host") { |
| deps = [ ":gidl" ] |
| outputs = [ "gidl" ] |
| } |
| |
| fidl("gidl_mixer_test_fidl") { |
| name = "test.mixer" |
| testonly = true |
| sources = [ "//tools/fidl/gidl/mixer/testdata/mixer.test.fidl" ] |
| public_deps = [ "//zircon/vdso/zx" ] |
| experimental_flags = [ "enable_handle_rights" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":gidl_golang_test($host_toolchain)", |
| ":gidl_golden_tests($host_toolchain)", |
| ":gidl_mixer_test($host_toolchain)", |
| ":gidl_parser_test($host_toolchain)", |
| ] |
| } |
| |
| go_test("gidl_parser_test") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/fidl/gidl/parser" ] |
| deps = [ |
| ":gopkg", |
| "//third_party/golibs:github.com/google/go-cmp", |
| ] |
| } |
| |
| go_test("gidl_golang_test") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/fidl/gidl/golang" ] |
| |
| deps = [ ":gopkg" ] |
| } |
| |
| if (is_host) { |
| host_test_data("gidl_mixer_test_json") { |
| deps = [ ":gidl_mixer_test_fidl($fidl_toolchain)" ] |
| sources = [ "$root_build_dir/fidling/gen/tools/fidl/gidl/gidl_mixer_test_fidl.fidl.json" ] |
| outputs = [ "$root_out_dir/test_data/gidl/mixer.test.fidl.json" ] |
| } |
| |
| go_test("gidl_mixer_test") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/fidl/gidl/mixer" ] |
| args = [ |
| "--test_data_dir", |
| rebase_path("$root_out_dir/test_data/gidl", root_build_dir), |
| ] |
| deps = [ ":gopkg" ] |
| non_go_deps = [ ":gidl_mixer_test_json" ] |
| } |
| } |
| |
| llcpp_gidl_output_prefix = "conformance_suite__" |
| foreach(gidl_file, conformance_suite_golden_gidl_files) { |
| gidl_name = get_path_info(gidl_file, "name") |
| target = "${llcpp_gidl_output_prefix}${gidl_name}" |
| gidl_llcpp_conformance(target) { |
| testonly = true |
| inputs = [ gidl_file ] |
| fidl = conformance_suite_fidl_target |
| deps = [ "//third_party/googletest:gtest" ] |
| if (is_fuchsia) { |
| deps += [ "//sdk/cts/tests/pkg/fidl/cpp:handle_util" ] |
| } |
| } |
| } |
| |
| gidl_hlcpp_conformance("gidl_hlcpp_goldens") { |
| testonly = true |
| inputs = conformance_suite_golden_gidl_files |
| fidl = conformance_suite_fidl_target |
| } |
| |
| go_golden_generated_source = "$target_gen_dir/gidl_conformance_goldens.go" |
| gidl("gidl_go_goldens") { |
| type = "conformance" |
| language = "go" |
| inputs = conformance_suite_golden_gidl_files |
| fidl = conformance_suite_fidl_target |
| output = go_golden_generated_source |
| } |
| |
| golden_test("gidl_golden_tests") { |
| goldens_dir = "goldens" |
| deps = [ |
| ":gidl_go_goldens", |
| ":gidl_hlcpp_goldens_gidl", |
| ] |
| entries = [ |
| { |
| golden = "go_golden.go.golden" |
| generated = go_golden_generated_source |
| }, |
| { |
| golden = "hlcpp_golden.cc.golden" |
| generated = "${target_gen_dir}/gidl_generated_gidl_hlcpp_goldens.cc" |
| }, |
| ] |
| foreach(gidl_file, conformance_suite_golden_gidl_files) { |
| gidl_name = get_path_info(gidl_file, "name") |
| target = "${llcpp_gidl_output_prefix}${gidl_name}" |
| deps += [ ":${target}" ] |
| entries += [ |
| { |
| golden = "llcpp_${gidl_name}.cc.golden" |
| generated = "${target_gen_dir}/gidl_generated_${target}.cc" |
| }, |
| ] |
| } |
| } |