blob: 952d7e882481aa492fe23bc368b7630f9c7588f7 [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",
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000017 visibility = [
18 "//go/net/psample:__pkg__",
19 "//metropolis:__subpackages__",
20 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020021)
22
23kconfig_patch(
24 name = "testing-config",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020025 src = "//third_party/linux:linux-metropolis.config",
Lorenz Brun547b33f2020-04-23 15:27:06 +020026 out = "testing.config",
27 override_configs = {
28 # Unlock command line
29 "CONFIG_CMDLINE_OVERRIDE": "n",
30 "CONFIG_CMDLINE_BOOL": "n",
31 # Shave off 1 second from boot time
32 "CONFIG_SERIO_I8042": "",
33 "CONFIG_KEYBOARD_ATKBD": "",
34 "CONFIG_RTC_DRV_CMOS": "",
35 # Shave off an additional 18ms (half of the boot time)
36 "CONFIG_DEBUG_WX": "",
37 },
38)
39
Serge Bazanskif055a7f2021-04-13 16:22:33 +020040linux_image(
Lorenz Brun547b33f2020-04-23 15:27:06 +020041 name = "linux-testing",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020042 image_format = "vmlinux",
43 kernel_config = ":testing-config",
44 # This image is directly used by the ktest macro, thus it needs a pretty
45 # wide visibility.
46 visibility = [
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000047 "//go/net/psample:__pkg__",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020048 "//metropolis:__subpackages__",
Lorenz Brun547b33f2020-04-23 15:27:06 +020049 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020050)
51
52filegroup(
53 name = "test-script",
54 srcs = ["run_ktest.sh"],
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000055 visibility = [
56 "//go/net/psample:__pkg__",
57 "//metropolis:__subpackages__",
58 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020059)