blob: 0a43ab48ae51c2262a59ce6fe973a6523489e35d [file] [log] [blame]
Lorenz Brun547b33f2020-04-23 15:27:06 +02001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Tim Windelschmidtc2290c22024-08-15 19:56:00 +02002load("//osbase/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"],
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000016 visibility = [
17 "//go/net/psample:__pkg__",
18 "//metropolis:__subpackages__",
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020019 "//osbase:__subpackages__",
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000020 ],
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__",
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020049 "//osbase:__subpackages__",
Lorenz Brun547b33f2020-04-23 15:27:06 +020050 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020051)
52
53filegroup(
54 name = "test-script",
55 srcs = ["run_ktest.sh"],
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000056 visibility = [
57 "//go/net/psample:__pkg__",
58 "//metropolis:__subpackages__",
Tim Windelschmidt9f21f532024-05-07 15:14:20 +020059 "//osbase:__subpackages__",
Mateusz Zalega3ccf6962023-01-23 17:01:40 +000060 ],
Lorenz Brun547b33f2020-04-23 15:27:06 +020061)