| # 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/package.gni") |
| import("//build/test/test_package.gni") |
| |
| source_set("lib") { |
| sources = [ |
| "args.cc", |
| "cpu_stress.cc", |
| "cpu_stressor.cc", |
| "cpu_workloads.cc", |
| "device.cc", |
| "flash_stress.cc", |
| "hwstress.cc", |
| "light_stress.cc", |
| "memory_patterns.cc", |
| "memory_range.cc", |
| "memory_stats.cc", |
| "memory_stress.cc", |
| "profile_manager.cc", |
| "status.cc", |
| "temperature_sensor.cc", |
| "util.cc", |
| ] |
| |
| public_deps = [ |
| "//sdk/fidl/fuchsia.hardware.block", |
| "//sdk/fidl/fuchsia.hardware.block.volume", |
| "//sdk/fidl/fuchsia.hardware.light", |
| "//sdk/fidl/fuchsia.hardware.thermal", |
| "//sdk/fidl/fuchsia.kernel", |
| "//sdk/fidl/fuchsia.scheduler", |
| "//sdk/lib/fdio", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl", |
| "//src/lib/uuid", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxc", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/cmdline", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/fs-management", |
| ] |
| |
| # We want to optimize as much as possible for speed, under the assumption |
| # that this will also optimize for generating code that will maximise the |
| # amount of stress placed on the system (e.g., more heat for CPU tests). |
| configs += [ "//build/config:optimize_speed" ] |
| } |
| |
| executable("bin") { |
| output_name = "hwstress" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ ":lib" ] |
| } |
| |
| # Traditional CLI package. |
| package("hwstress_cli") { |
| package_name = "hwstress-cli" |
| |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| shell = true |
| name = "hwstress" |
| }, |
| ] |
| } |
| |
| # CFv1 package. |
| package("hwstress_pkg") { |
| package_name = "hwstress" |
| |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| name = "hwstress" |
| }, |
| ] |
| |
| # We generate an in-package CMX file for the top-level "hwstress" |
| # binary, and also for each style of test we run. |
| # |
| # This is to help automated tests seperate logs for the different |
| # styles of test, where currently the CFv1 component name is the |
| # only mechanism we have to do this. |
| meta = [] |
| foreach(name, |
| [ |
| "hwstress", |
| "cpu", |
| "memory", |
| "flash", |
| "led", |
| ]) { |
| meta += [ |
| { |
| path = rebase_path("meta/hwstress.cmx") |
| dest = name + ".cmx" |
| }, |
| ] |
| } |
| } |
| |
| # Tests using CFv1. |
| executable("hwstress_test") { |
| testonly = true |
| |
| sources = [ |
| "args_test.cc", |
| "cpu_stress_test.cc", |
| "cpu_stressor_test.cc", |
| "cpu_workloads_test.cc", |
| "hwstress_test.cc", |
| "light_stress_test.cc", |
| "memory_patterns_test.cc", |
| "memory_range_test.cc", |
| "memory_stats_test.cc", |
| "memory_stress_test.cc", |
| "profile_manager_test.cc", |
| "status_test.cc", |
| "temperature_sensor_test.cc", |
| "util_test.cc", |
| ] |
| |
| deps = [ |
| ":lib", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/predicates", |
| "//third_party/googletest:gmock", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxc", |
| ] |
| } |
| |
| # Tests requiring support from the CFv2 (or requiring support from libraries that depend on CFv2). |
| executable("hwstress_v2_test") { |
| testonly = true |
| |
| sources = [ "flash_stress_test.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/isolated_devmgr/v2_component", # requires CFv2. |
| "//src/lib/testing/predicates", |
| "//third_party/googletest:gmock", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxc", |
| ] |
| } |
| |
| test_package("hwstress_test_pkg") { |
| package_name = "hwstress-tests" |
| |
| deps = [ |
| ":hwstress_test", |
| ":hwstress_v2_test", |
| ] |
| |
| tests = [ |
| { |
| name = "hwstress_test" |
| }, |
| ] |
| |
| v2_tests = [ |
| { |
| name = "hwstress_v2_test" |
| }, |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":hwstress_test_pkg", |
| "//src/lib/isolated_devmgr/v2_component", |
| ] |
| } |
| |
| group("hwstress") { |
| testonly = true |
| public_deps = [ |
| ":hwstress_cli", |
| ":hwstress_pkg", |
| ] |
| } |