| # 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/components.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/go/toolchain.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") |
| |
| if ((is_host && is_linux) || has_board) { |
| generated_dir = "$target_gen_dir" |
| generated_source = "$generated_dir/conformance_test.go" |
| |
| gidl("conformance_suite") { |
| type = "conformance" |
| language = "go" |
| inputs = conformance_suite_gidl_files |
| fidl = conformance_suite_fidl_target |
| output = generated_source |
| } |
| |
| copy("copy_test_utils") { |
| sources = [] |
| foreach(filename, go_conformance_test_files) { |
| sources += |
| [ "//third_party/go/src/syscall/zx/fidl/fidl_test/" + filename ] |
| } |
| outputs = [ "${generated_dir}/{{source_file_part}}" ] |
| } |
| |
| go_library("conformance_tests_library") { |
| testonly = true |
| name = "conformance_tests" |
| source_dir = generated_dir |
| |
| sources = rebase_path( |
| [ generated_source ] + get_target_outputs(":copy_test_utils"), |
| generated_dir) |
| |
| non_go_deps = [ |
| ":conformance_suite", |
| ":copy_test_utils", |
| ] |
| |
| deps = [ "${conformance_suite_fidl_target}_go(${go_toolchain})" ] |
| } |
| |
| go_test("fidl_go_conformance_tests") { |
| library = ":conformance_tests_library" |
| non_go_deps = [ ":conformance_suite" ] |
| |
| # This runs both on target device and as a host test. |
| # In both cases, it needs to build a go toolchain rather than using a prebuilt because |
| # it is testing the fidl package, which is implemented in the toolcahin itself. |
| use_prebuilt_go = false |
| } |
| |
| fuchsia_unittest_package("fidl_go_conformance") { |
| deps = [ ":fidl_go_conformance_tests" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [] |
| |
| # Only include the host test on Linux, as we don't want to compile the Fuchsia |
| # runtime on MacOS. |
| if (is_linux) { |
| deps += [ ":fidl_go_conformance_tests($host_toolchain)" ] |
| } |
| |
| # Don't include the _Fuchsia_ version of the test if there isn't a board |
| # defined. |
| if (has_board) { |
| deps += [ ":fidl_go_conformance" ] |
| } |
| } |