| # 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") |
| |
| if (is_host) { |
| 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" ] |
| } |
| |
| 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" ] |
| } |
| |
| 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" ] |
| } |
| |
| conformance_golden_items = [ |
| { |
| language = "go" |
| extension = "go" |
| }, |
| { |
| language = "hlcpp" |
| extension = "cc" |
| }, |
| { |
| language = "llcpp" |
| extension = "cc" |
| }, |
| ] |
| |
| foreach(item, conformance_golden_items) { |
| gidl("${item.language}_goldens") { |
| type = "conformance" |
| language = item.language |
| inputs = conformance_suite_golden_gidl_files |
| fidl = conformance_suite_fidl_target |
| output = "$target_gen_dir/${item.language}_golden.${item.extension}" |
| } |
| } |
| |
| golden_test("gidl_golden_tests") { |
| goldens_dir = "goldens" |
| deps = [] |
| entries = [] |
| |
| foreach(item, conformance_golden_items) { |
| deps += [ ":${item.language}_goldens" ] |
| entries += [ |
| { |
| golden = "${item.language}_golden.${item.extension}.golden" |
| generated = |
| "$target_gen_dir/${item.language}_golden.${item.extension}" |
| }, |
| ] |
| } |
| } |
| } |
| |
| 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" ] |
| } |
| |
| install_host_tools("host") { |
| deps = [ ":gidl" ] |
| outputs = [ "gidl" ] |
| } |
| |
| 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)", |
| ] |
| } |