blob: 3d8bb2a90416c6734978c4cc939335d7bbbf7d15 [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 Windelschmidtd0cdb572025-03-27 17:18:39 +010010 deps = ["//osbase/test/qemu"],
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",
Lorenz Brune3420862025-06-05 12:25:03 +020025 src = "//third_party/linux:kconfig",
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",
Tim Windelschmidt6cca9322025-04-15 21:13:32 +020044 kernel_src = "@linux//:all",
Serge Bazanskif055a7f2021-04-13 16:22:33 +020045 # 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)