blob: 0a5f5b332fa913fe307b02e62fb8afbc0ec1a42f [file] [log] [blame]
Lorenz Brun547b33f2020-04-23 15:27:06 +02001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Serge Bazanski77cb6c52020-12-19 00:09:22 +01002load("//metropolis/node/build/kconfig-patcher:kconfig-patcher.bzl", "kconfig_patch")
Serge Bazanskif055a7f2021-04-13 16:22:33 +02003load("//third_party/linux:def.bzl", "linux_image")
Lorenz Brun547b33f2020-04-23 15:27:06 +02004
5go_library(
Lorenz Brund13c1c62022-03-30 19:58:58 +02006 name = "ktest_lib",
Lorenz Brun547b33f2020-04-23 15:27:06 +02007 srcs = ["main.go"],
Serge Bazanski31370b02021-01-07 16:31:14 +01008 importpath = "source.monogon.dev/metropolis/test/ktest",
Lorenz Brun547b33f2020-04-23 15:27:06 +02009 visibility = ["//visibility:private"],
Lorenz Brund13c1c62022-03-30 19:58:58 +020010 deps = ["//metropolis/test/launch"],
Lorenz Brun547b33f2020-04-23 15:27:06 +020011)
12
13go_binary(
14 name = "ktest",
Lorenz Brund13c1c62022-03-30 19:58:58 +020015 embed = [":ktest_lib"],
Lorenz Brun547b33f2020-04-23 15:27:06 +020016 pure = "on",
Serge Bazanski0be9be82021-01-07 15:23:44 +010017 visibility = ["//metropolis:__subpackages__"],
Lorenz Brun547b33f2020-04-23 15:27:06 +020018)
19
20kconfig_patch(
21 name = "testing-config",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020022 src = "//third_party/linux:linux-metropolis.config",
Lorenz Brun547b33f2020-04-23 15:27:06 +020023 out = "testing.config",
24 override_configs = {
25 # Unlock command line
26 "CONFIG_CMDLINE_OVERRIDE": "n",
27 "CONFIG_CMDLINE_BOOL": "n",
28 # Shave off 1 second from boot time
29 "CONFIG_SERIO_I8042": "",
30 "CONFIG_KEYBOARD_ATKBD": "",
31 "CONFIG_RTC_DRV_CMOS": "",
32 # Shave off an additional 18ms (half of the boot time)
33 "CONFIG_DEBUG_WX": "",
34 },
35)
36
Serge Bazanskif055a7f2021-04-13 16:22:33 +020037linux_image(
Lorenz Brun547b33f2020-04-23 15:27:06 +020038 name = "linux-testing",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020039 image_format = "vmlinux",
40 kernel_config = ":testing-config",
41 # This image is directly used by the ktest macro, thus it needs a pretty
42 # wide visibility.
43 visibility = [
44 "//metropolis:__subpackages__",
Lorenz Brun547b33f2020-04-23 15:27:06 +020045 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020046)
47
48filegroup(
49 name = "test-script",
50 srcs = ["run_ktest.sh"],
Serge Bazanski0be9be82021-01-07 15:23:44 +010051 visibility = ["//metropolis:__subpackages__"],
Lorenz Brun547b33f2020-04-23 15:27:06 +020052)