blob: 8fc2bf328b29821ec9a07142780c3d31370d4b40 [file] [log] [blame]
load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("//bazel:flags.bzl", "string_flag_with_values")
package(
default_applicable_licenses = ["//:license"],
)
licenses(["notice"])
go_library(
name = "adb_test_runner_lib",
srcs = ["adb_test_runner.go"],
importpath = "go.skia.org/skia/tools/testrunners/common/android/adb_test_runner",
visibility = ["//visibility:private"],
deps = [
"//bazel/device_specific_configs",
"@org_golang_x_exp//slices",
"@org_skia_go_infra//go/exec",
],
)
go_binary(
name = "adb_test_runner",
embed = [":adb_test_runner_lib"],
visibility = ["//visibility:public"],
)
# This flag controls the platform for which the adb_test_runner Go program gets compiled when
# building an adb_test target. This allows us to build an Android test from an x86_64 Linux machine
# on GCE and switch the adb_test_runner platform to linux_arm64 so it can be executed from a
# Raspberry Pi in a subsequent CI task.
string_flag_with_values(
name = "adb_platform",
values = [
# These are shorthand for rules_go platforms, e.g.
# @rules_go//go/toolchain:linux_amd64.
#
# To make the CPU part more readable, we replace "amd64" with "x86", which makes it more
# visually distinct from "arm64". We map the CPU dimension back to GOARCH style in
# adb_test.bzl.
#
# We can add more platforms as needed. The source of truth for rules_go platforms is
# https://github.com/bazelbuild/rules_go/blob/5933b6ed063488472fc14ceca232b3115e8bc39f/go/private/platforms.bzl.
"linux_x86",
"linux_arm64",
"darwin_x86",
"darwin_arm64",
"windows_x86",
"windows_arm64",
],
)
go_test(
name = "adb_test_runner_test",
srcs = ["adb_test_runner_test.go"],
embed = [":adb_test_runner_lib"],
deps = [
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_skia_go_infra//go/exec",
],
)