| # 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( | |
| "//src/lib/testing/expectation/fuchsia_test_component_with_expectations.gni") | |
| import( | |
| "//src/lib/testing/expectation/fuchsia_test_with_expectations_package.gni") | |
| import("//src/lib/testing/sharding/fuchsia_sharded_test_package.gni") | |
| tests = [ | |
| { | |
| label = "sys" | |
| package_deps = [ "//src/sys/stash:stash_secure_v2" ] | |
| }, | |
| { | |
| label = "device" | |
| }, | |
| { | |
| label = "dhcp" | |
| err_logs = true | |
| package_deps = [ | |
| "//src/lib/fake-clock/svc", | |
| "//src/sys/stash:stash_secure_v2", | |
| ] | |
| subpackages = [ | |
| "//src/connectivity/network/dhcpv4/client/bindings:package", | |
| "//src/connectivity/network/dhcpv4/server:package", | |
| ] | |
| }, | |
| { | |
| label = "dhcp-client" | |
| err_logs = true | |
| subpackages = [ | |
| "//src/connectivity/network/dhcpv4/client/bindings:package", | |
| "//src/connectivity/network/dhcpv4/server:package", | |
| ] | |
| }, | |
| { | |
| label = "dhcpv6-client" | |
| err_logs = true | |
| subpackages = [ "//src/connectivity/network/dhcpv6/client:package" ] | |
| }, | |
| { | |
| label = "dns" | |
| err_logs = true | |
| package_deps = [ | |
| "//src/lib/fake-clock/svc", | |
| "//src/sys/stash:stash_secure_v2", | |
| ] | |
| subpackages = [ | |
| "//src/connectivity/network/dhcpv4/client/bindings:package", | |
| "//src/connectivity/network/dhcpv4/server:package", | |
| "//src/connectivity/network/dhcpv6/client:package", | |
| "//src/connectivity/network/dns:package_with_fake_time", | |
| "//src/connectivity/policy/netcfg:package-for-tests", | |
| "//src/connectivity/policy/socket-proxy:package", | |
| ] | |
| }, | |
| { | |
| label = "fidl" | |
| err_logs = true | |
| }, | |
| { | |
| label = "forwarding" | |
| err_logs = true | |
| }, | |
| { | |
| label = "ipv4" | |
| }, | |
| { | |
| label = "ipv6" | |
| package_deps = [ "//src/sys/stash:stash_secure_v2" ] | |
| }, | |
| { | |
| label = "power" | |
| package_deps = [ | |
| "//src/power/broker:component", | |
| "//src/power/system-activity-governor/fake:component", | |
| "//src/power/testing/fake-shutdown-shim", | |
| "//src/power/testing/fake-suspend", | |
| ] | |
| subpackages = | |
| [ "//src/power/system-activity-governor:config-use-suspender" ] | |
| }, | |
| { | |
| label = "product-flow" | |
| err_logs = true | |
| package_deps = [ | |
| "//src/lib/fake-clock/svc", | |
| "//src/sys/stash:stash_secure_v2", | |
| ] | |
| subpackages = [ | |
| "//src/connectivity/network/dhcpv4/client/bindings:package", | |
| "//src/connectivity/network/dhcpv4/server:package", | |
| "//src/connectivity/network/dns:package_with_fake_time", | |
| ] | |
| }, | |
| { | |
| label = "socket" | |
| err_logs = true | |
| long = true | |
| }, | |
| { | |
| label = "packet-capture" | |
| }, | |
| { | |
| label = "offloading" | |
| }, | |
| { | |
| label = "multicast-forwarding" | |
| err_logs = true | |
| long = true | |
| log_less = true | |
| }, | |
| ] | |
| common_package_deps = [ | |
| # Expectation comparer used by all tests. | |
| "//src/lib/testing/expectation:expectation_comparer", | |
| ] | |
| common_subpackages = [ | |
| # Netstack3 is commonly under test. | |
| "//src/connectivity/network/netstack3:package-for-tests", | |
| # netemul-sandbox is used to create hermetic test realms. | |
| "//src/connectivity/network/testing/netemul/service:package", | |
| ] | |
| non_log_less_subpackages = | |
| [ "//src/connectivity/network/netstack3:package-debug" ] | |
| log_less_subpackages = [ | |
| # `:package-debug-less-logs` is used instead of `:package-debug` to avoid | |
| # forcing DEBUG logs to be included, which are too verbose and cause some | |
| # longer suites to time out. | |
| "//src/connectivity/network/netstack3:package-debug-less-logs", | |
| ] | |
| all_test_packages = [] | |
| foreach(test, tests) { | |
| _err_logs = false | |
| _long = false | |
| if (defined(test.err_logs)) { | |
| _err_logs = test.err_logs | |
| } | |
| if (defined(test.long)) { | |
| # NB: Should be easy enough to support, but there was no need when the last | |
| # refactor happened. | |
| assert(_err_logs, "long test without error logs not supported") | |
| _long = test.long | |
| } | |
| _label = test.label | |
| # Required for list reassignment. | |
| _package_deps = [] | |
| _package_deps += common_package_deps | |
| if (defined(test.package_deps)) { | |
| _package_deps += test.package_deps | |
| } | |
| _subpackages = [] | |
| _subpackages += common_subpackages | |
| if (defined(test.log_less) && test.log_less) { | |
| _subpackages += log_less_subpackages | |
| } else { | |
| _subpackages += non_log_less_subpackages | |
| } | |
| if (defined(test.subpackages)) { | |
| _subpackages += test.subpackages | |
| } | |
| _name = "netstack-${_label}-integration-test" | |
| _component_label = "${_name}" | |
| if (!_err_logs) { | |
| _package_label = "${_name}_pkg" | |
| fuchsia_test_component_with_expectations(_component_label) { | |
| component_name = _name | |
| expectations = "expects/${_name}.json5" | |
| manifest = "meta/${_name}.cml" | |
| deps = [ test.label ] | |
| } | |
| fuchsia_test_package(_package_label) { | |
| package_name = _name | |
| test_components = [ ":${_component_label}" ] | |
| deps = _package_deps | |
| subpackages = _subpackages | |
| } | |
| all_test_packages += [ ":${_package_label}" ] | |
| } else { | |
| _no_err_logs_name = "${_name}-no-err-logs" | |
| _with_err_logs_name = "${_name}-with-err-logs" | |
| if (_long) { | |
| _component_attributes = { | |
| } | |
| _component_attributes = { | |
| manifest = "meta/${_name}.cml" | |
| deps = [ test.label ] | |
| expectations = "expects/${_name}.json5" | |
| num_shards = 10 | |
| # Matches the first `::`-delimited section of the test case name, | |
| # or the whole name if there are no `::` delimiters. | |
| shard_part_regex = "([^::]+)(?:::.*)?" | |
| } | |
| fuchsia_sharded_test_package(_no_err_logs_name) { | |
| test_components = [ | |
| { | |
| forward_variables_from(_component_attributes, "*") | |
| name = _no_err_logs_name | |
| treatment_of_cases_with_error_logs = "SKIP_CASES_WITH_ERROR_LOGS" | |
| }, | |
| ] | |
| deps = _package_deps | |
| subpackages = _subpackages | |
| } | |
| fuchsia_sharded_test_package(_with_err_logs_name) { | |
| test_components = [ | |
| { | |
| forward_variables_from(_component_attributes, "*") | |
| name = _with_err_logs_name | |
| treatment_of_cases_with_error_logs = | |
| "RUN_ONLY_CASES_WITH_ERROR_LOGS" | |
| }, | |
| ] | |
| deps = _package_deps | |
| subpackages = _subpackages | |
| test_specs = { | |
| log_settings = { | |
| max_severity = "ERROR" | |
| } | |
| } | |
| } | |
| } else { | |
| fuchsia_test_component(_component_label) { | |
| component_name = _name | |
| manifest = "meta/${_name}.cml" | |
| deps = [ test.label ] | |
| } | |
| fuchsia_test_with_expectations_package(_no_err_logs_name) { | |
| test_components = [ ":${_component_label}" ] | |
| expectations = "expects/${_name}.json5" | |
| treatment_of_cases_with_error_logs = "SKIP_CASES_WITH_ERROR_LOGS" | |
| deps = _package_deps | |
| subpackages = _subpackages | |
| } | |
| fuchsia_test_with_expectations_package(_with_err_logs_name) { | |
| test_components = [ ":${_component_label}" ] | |
| expectations = "expects/${_name}.json5" | |
| treatment_of_cases_with_error_logs = "RUN_ONLY_CASES_WITH_ERROR_LOGS" | |
| deps = _package_deps | |
| subpackages = _subpackages | |
| test_specs = { | |
| log_settings = { | |
| max_severity = "ERROR" | |
| } | |
| } | |
| } | |
| } | |
| all_test_packages += [ | |
| ":${_no_err_logs_name}", | |
| ":${_with_err_logs_name}", | |
| ] | |
| } | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| "inspect:tests", | |
| "macros:tests", | |
| ] + all_test_packages | |
| } |