blob: afb9836da25b52b81859c7bdc2d5a6b1d680f82d [file] [log] [blame]
# Copyright 2023 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/host.gni")
import("//build/python/python_binary.gni")
import("//build/python/python_host_test.gni")
import("//build/testing/host_test_data.gni")
group("tests") {
testonly = true
deps = [
":args_test($host_toolchain)",
":config_test($host_toolchain)",
":console_test($host_toolchain)",
":debugger_test($host_toolchain)",
":environment_test($host_toolchain)",
":event_test($host_toolchain)",
":execution_test($host_toolchain)",
":log_test($host_toolchain)",
":main_test($host_toolchain)",
":selection_action_test($host_toolchain)",
":selection_test($host_toolchain)",
":test_list_file_test($host_toolchain)",
":tests_json_file_test($host_toolchain)",
"dataparse:tests",
]
}
if (is_host) {
binary_sources = [
"args.py",
"config.py",
"console.py",
"debugger.py",
"environment.py",
"event.py",
"execution.py",
"log.py",
"package_repository.py",
"selection.py",
"selection_action.py",
"selection_types.py",
"test_list_file.py",
"tests_json_file.py",
]
binary_deps = [
"dataparse",
"//scripts/lib/async_utils",
"//scripts/lib/statusinfo",
"//scripts/lib/termout",
"//third_party/colorama",
"//third_party/jellyfish",
]
# Main executable target.
python_binary("fxtest-rewrite") {
enable_mypy = true
# Unbuffer so output can be piped to other programs nicely.
unbuffered_output = true
main_source = "main.py"
output_name = "fxtest_rewrite.pyz"
sources = binary_sources
deps = binary_deps
}
main_module_tests = [
"args",
"config",
"console",
"debugger",
"environment",
"event",
"execution",
"log",
"main",
"selection",
"selection_action",
"test_list_file",
"tests_json_file",
]
foreach(test_name, main_module_tests) {
target = "${test_name}_test"
main_source = "tests/${test_name}_test.py"
python_host_test(target) {
# TODO(https://fxbug.dev/329239255): Re-enable when flake is addressed
if (test_name != "main") {
enable_mypy = true
} else {
enable_mypy = false
}
main_source = main_source
main_callable = "unittest.main"
extra_args = [ "-v" ]
test_dir = "$root_out_dir/test_data/fxtest-rewrite-tests"
sources = binary_sources + [ "main.py" ]
libraries = binary_deps + [ "//third_party/parameterized" ]
deps = [
":test_data",
":test_deps",
]
}
}
host_test_data("test_data") {
sources = [
"tests/test_data/build_output/package-repositories.json",
"tests/test_data/build_output/package-targets.json",
"tests/test_data/build_output/test-list.json",
"tests/test_data/build_output/tests.json",
]
outputs = [ "$root_out_dir/test_data/fxtest-rewrite-tests/test_data/build_output/{{source_file_part}}" ]
}
host_test_data("test_deps") {
sources = [ "$root_build_dir/host-tools/dldist" ]
outputs = [
"$root_out_dir/test_data/fxtest-rewrite-tests/bin/{{source_file_part}}",
]
deps = [ "//scripts/fxtest/scripts:install" ]
}
# Rename the resulting .pyz for the host tool
copy("copy") {
deps = [ ":fxtest-rewrite" ]
sources = [ "${target_out_dir}/fxtest_rewrite.pyz" ]
outputs = [ "${root_out_dir}/test2" ]
}
install_host_tools("install") {
deps = [ ":copy" ]
outputs = [ "test2" ]
}
}