| # Copyright 2022 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/components/fuchsia_unittest_package.gni") |
| import("//build/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/go/toolchain.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//src/tests/fidl/conformance_suite/gidl-conformance-suite.gni") |
| import( |
| "//third_party/go/src/syscall/zx/fidl/fidl_test/conformance_test_files.gni") |
| import("//tools/fidl/gidl/gidl.gni") |
| |
| ## This file tests that GIDL backends produce valid code for an empty GIDL file. |
| ## This ensures we can always disable tests without causing build issues such as |
| ## unused imports, etc. |
| |
| rust_empty_gidl_test_source = "$target_gen_dir/rust/empty_conformance_test.rs" |
| |
| gidl("rust_empty_gidl") { |
| type = "conformance" |
| language = "rust" |
| inputs = [ "empty.gidl" ] |
| fidl = conformance_suite_fidl_target |
| output = rust_empty_gidl_test_source |
| } |
| |
| rustc_test("rust_empty_gidl_test_bin") { |
| output_name = "rust_empty_gidl_tests" |
| edition = "2018" |
| source_root = rust_empty_gidl_test_source |
| deps = [ |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fidl/rust/gidl_util", |
| "//src/lib/zircon/rust:fuchsia-zircon-status", |
| "//src/lib/zircon/rust:fuchsia-zircon-types", |
| "//src/tests/fidl/conformance_suite:conformance_fidl_rust", |
| "//third_party/rust_crates:assert_matches", |
| ] |
| non_rust_deps = [ ":rust_empty_gidl" ] |
| sources = [ rust_empty_gidl_test_source ] |
| } |
| |
| fuchsia_unittest_package("rust_empty_gidl_tests") { |
| deps = [ ":rust_empty_gidl_test_bin" ] |
| } |
| |
| go_generated_dir = "$target_gen_dir/go" |
| go_generated_source = "$go_generated_dir/empty_gidl_test.go" |
| |
| gidl("go_empty_gidl") { |
| type = "conformance" |
| language = "go" |
| inputs = [ "empty.gidl" ] |
| fidl = conformance_suite_fidl_target |
| output = go_generated_source |
| } |
| |
| copy("go_copy_test_utils") { |
| sources = [] |
| foreach(filename, go_conformance_test_files) { |
| sources += [ "//third_party/go/src/syscall/zx/fidl/fidl_test/" + filename ] |
| } |
| outputs = [ "${go_generated_dir}/{{source_file_part}}" ] |
| } |
| |
| go_library("go_empty_gidl_tests_library") { |
| testonly = true |
| name = "empty_gidl_tests" |
| source_dir = go_generated_dir |
| |
| sources = rebase_path( |
| [ go_generated_source ] + get_target_outputs(":go_copy_test_utils"), |
| go_generated_dir) |
| |
| non_go_deps = [ |
| ":go_copy_test_utils", |
| ":go_empty_gidl", |
| ] |
| |
| deps = [ "${conformance_suite_fidl_target}_go(${go_toolchain})" ] |
| } |
| |
| go_test("go_empty_gidl_test_bin") { |
| library = ":go_empty_gidl_tests_library" |
| non_go_deps = [ ":go_empty_gidl" ] |
| use_prebuilt_go = false |
| } |
| |
| fuchsia_unittest_package("go_empty_gidl_tests") { |
| deps = [ ":go_empty_gidl_test_bin" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":go_empty_gidl_tests", |
| ":rust_empty_gidl_tests", |
| ] |
| } |