blob: 16612e5315729f76d10ccda84390cafacd4cbc4d [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"],
Tim Windelschmidt9f21f532024-05-07 15:14:20 +02008 importpath = "source.monogon.dev/osbase/test/ktest",
Lorenz Brun547b33f2020-04-23 15:27:06 +02009 visibility = ["//visibility:private"],
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020010 deps = ["//osbase/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__",
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020020 "//osbase:__subpackages__",
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000021 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020022)
23
24kconfig_patch(
25 name = "testing-config",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020026 src = "//third_party/linux:linux-metropolis.config",
Lorenz Brun547b33f2020-04-23 15:27:06 +020027 out = "testing.config",
28 override_configs = {
29 # Unlock command line
30 "CONFIG_CMDLINE_OVERRIDE": "n",
31 "CONFIG_CMDLINE_BOOL": "n",
32 # Shave off 1 second from boot time
33 "CONFIG_SERIO_I8042": "",
34 "CONFIG_KEYBOARD_ATKBD": "",
35 "CONFIG_RTC_DRV_CMOS": "",
36 # Shave off an additional 18ms (half of the boot time)
37 "CONFIG_DEBUG_WX": "",
38 },
39)
40
Serge Bazanskif055a7f2021-04-13 16:22:33 +020041linux_image(
Lorenz Brun547b33f2020-04-23 15:27:06 +020042 name = "linux-testing",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020043 image_format = "vmlinux",
44 kernel_config = ":testing-config",
45 # This image is directly used by the ktest macro, thus it needs a pretty
46 # wide visibility.
47 visibility = [
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000048 "//go/net/psample:__pkg__",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020049 "//metropolis:__subpackages__",
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020050 "//osbase:__subpackages__",
Lorenz Brun547b33f2020-04-23 15:27:06 +020051 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020052)
53
54filegroup(
55 name = "test-script",
56 srcs = ["run_ktest.sh"],
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000057 visibility = [
58 "//go/net/psample:__pkg__",
59 "//metropolis:__subpackages__",
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020060 "//osbase:__subpackages__",
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000061 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020062)