blob: e0b46fb7bbd2fb661023cbe35bc51f80987f2cb9 [file] [log] [blame] [edit]
# Copyright 2020 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/compiled_action.gni")
import("//build/fidl/toolchain.gni")
import("//build/go/go_binary.gni")
import("//build/go/go_library.gni")
import("//build/host.gni")
import("//build/testing/golden_test.gni")
import("//zircon/tools/fidl/testdata/info.gni")
go_library("gopkg") {
name = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_syzkaller/..."
deps = [ "//tools/fidl/lib/fidlgen" ]
sources = [
"codegen/codegen.go",
"codegen/description.tmpl.go",
"codegen/ir.go",
"codegen/protocol.tmpl.go",
"codegen/struct.tmpl.go",
"codegen/union.tmpl.go",
"main.go",
]
}
go_binary("fidlgen_syzkaller") {
gopackage = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_syzkaller"
sdk_category = "partner"
deps = [ ":gopkg" ]
}
install_host_tools("host") {
deps = [ ":fidlgen_syzkaller" ]
outputs = [ "fidlgen_syzkaller" ]
}
fidl_testdata_info_filtered = []
foreach(info, fidl_testdata_info) {
if (info.denylist + [ "fidlgen_syzkaller" ] - [ "fidlgen_syzkaller" ] ==
info.denylist) {
fidl_testdata_info_filtered += [ info ]
}
}
compiled_action_foreach("generate_goldens") {
testonly = true
tool = ":fidlgen_syzkaller"
deps = []
sources = []
foreach(info, fidl_testdata_info_filtered) {
deps += [ "${info.target}($fidl_toolchain)" ]
sources += [ "${info.fidl_gen_dir}/${info.target_name}.fidl.json" ]
}
args = [
"-json",
"{{source}}",
"-output-syz",
rebase_path(target_gen_dir, root_build_dir) +
"/golden_{{source_name_part}}.syz.txt",
]
outputs = [ "$target_gen_dir/golden_{{source_name_part}}.syz.txt" ]
}
golden_test("fidlgen_syzkaller_golden_tests") {
goldens_dir = "goldens"
deps = [ ":generate_goldens" ]
entries = []
foreach(info, fidl_testdata_info_filtered) {
entries += [
{
golden = "${info.name}.syz.txt.golden"
generated = "$target_gen_dir/golden_${info.target_name}.fidl.syz.txt"
},
]
}
}
group("tests") {
testonly = true
deps = [ ":fidlgen_syzkaller_golden_tests($host_toolchain)" ]
}