Lorenz Brun | 547b33f | 2020-04-23 15:27:06 +0200 | [diff] [blame] | 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") |
| 2 | load("//core/tools/kconfig-patcher:kconfig-patcher.bzl", "kconfig_patch") |
| 3 | |
| 4 | go_library( |
| 5 | name = "go_default_library", |
| 6 | srcs = ["main.go"], |
| 7 | importpath = "git.monogon.dev/source/nexantic.git/core/tools/ktest", |
| 8 | visibility = ["//visibility:private"], |
| 9 | ) |
| 10 | |
| 11 | go_binary( |
| 12 | name = "ktest", |
| 13 | embed = [":go_default_library"], |
| 14 | pure = "on", |
| 15 | visibility = ["//visibility:public"], |
| 16 | ) |
| 17 | |
| 18 | kconfig_patch( |
| 19 | name = "testing-config", |
| 20 | src = "//third_party/linux:kernel-config", |
| 21 | out = "testing.config", |
| 22 | override_configs = { |
| 23 | # Unlock command line |
| 24 | "CONFIG_CMDLINE_OVERRIDE": "n", |
| 25 | "CONFIG_CMDLINE_BOOL": "n", |
| 26 | # Shave off 1 second from boot time |
| 27 | "CONFIG_SERIO_I8042": "", |
| 28 | "CONFIG_KEYBOARD_ATKBD": "", |
| 29 | "CONFIG_RTC_DRV_CMOS": "", |
| 30 | # Shave off an additional 18ms (half of the boot time) |
| 31 | "CONFIG_DEBUG_WX": "", |
| 32 | }, |
| 33 | ) |
| 34 | |
| 35 | genrule( |
| 36 | name = "linux-testing", |
| 37 | srcs = [ |
| 38 | "@linux//:all", |
| 39 | ":testing-config", |
| 40 | ], |
| 41 | outs = [ |
| 42 | "linux-testing.elf", |
| 43 | ], |
| 44 | cmd = """ |
| 45 | DIR=external/linux |
| 46 | |
| 47 | mkdir $$DIR/.bin |
| 48 | |
| 49 | cp $(location :testing-config) $$DIR/.config |
| 50 | |
| 51 | (cd $$DIR && make -j $$(nproc) vmlinux >/dev/null) |
| 52 | |
| 53 | cp $$DIR/vmlinux $@ |
| 54 | """, |
| 55 | visibility = ["//visibility:public"], |
| 56 | ) |
| 57 | |
| 58 | filegroup( |
| 59 | name = "test-script", |
| 60 | srcs = ["run_ktest.sh"], |
| 61 | visibility = ["//visibility:public"], |
| 62 | ) |