blob: 7e010e0e74bb28fcea522acd98b606671f3656d7 [file] [log] [blame]
Tim Windelschmidt18e9a3f2024-04-08 21:51:03 +02001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
2load("//osbase/build:def.bzl", "node_initramfs")
3load("//osbase/build:efi.bzl", "efi_unified_kernel_image")
4
5go_test(
6 name = "test_test",
7 size = "medium",
8 srcs = ["run_test.go"],
9 data = [
10 ":kernel_failed",
11 ":kernel_succeeded",
12 "//third_party/edk2:OVMF_CODE.fd",
13 "//third_party/edk2:OVMF_VARS.fd",
14 "@qemu//:qemu-x86_64-softmmu",
15 ],
16 importpath = "source.monogon.dev/metropolis/installer/test",
17 visibility = ["//visibility:private"],
18 x_defs = {
19 "xOvmfVarsPath": "$(rlocationpath //third_party/edk2:OVMF_VARS.fd )",
20 "xOvmfCodePath": "$(rlocationpath //third_party/edk2:OVMF_CODE.fd )",
21 "xQemuPath": "$(rlocationpath @qemu//:qemu-x86_64-softmmu )",
22 "xSucceedKernelPath": "$(rlocationpath :kernel_succeeded )",
23 "xFailedKernelPath": "$(rlocationpath :kernel_failed )",
24 },
25 deps = [
26 "//osbase/cmd",
27 "@io_bazel_rules_go//go/runfiles:go_default_library",
28 ],
29)
30
31go_library(
32 name = "succeeded_lib",
33 srcs = ["main_succeeded.go"],
34 importpath = "source.monogon.dev/osbase/bringup/test",
35 visibility = ["//visibility:private"],
36 deps = [
37 "//osbase/bootparam",
38 "//osbase/bringup",
39 "//osbase/efivarfs",
40 "//osbase/logtree",
41 "//osbase/supervisor",
42 "@org_golang_x_sys//unix",
43 "@org_uber_go_multierr//:multierr",
44 ],
45)
46
47go_binary(
48 name = "succeeded",
49 embed = [":succeeded_lib"],
50 visibility = ["//visibility:private"],
51)
52
53node_initramfs(
54 name = "initramfs_succeeded",
55 files = {
56 ":succeeded": "/init",
57 },
58 fsspecs = [
59 "//osbase/build:earlydev.fsspec",
60 ],
61 visibility = ["//visibility:private"],
62)
63
64efi_unified_kernel_image(
65 name = "kernel_succeeded",
66 cmdline = "quiet console=ttyS0 init=/init",
67 initrd = [":initramfs_succeeded"],
68 kernel = "//third_party/linux",
69 visibility = ["//visibility:private"],
70)
71
72go_library(
73 name = "failed_lib",
74 srcs = ["main_failed.go"],
75 importpath = "source.monogon.dev/osbase/bringup/test",
76 visibility = ["//visibility:private"],
77 deps = [
78 "//osbase/bootparam",
79 "//osbase/bringup",
80 "//osbase/efivarfs",
81 "//osbase/logtree",
82 "//osbase/supervisor",
83 "@org_golang_x_sys//unix",
84 "@org_uber_go_multierr//:multierr",
85 ],
86)
87
88go_binary(
89 name = "failed",
90 embed = [":failed_lib"],
91 visibility = ["//visibility:private"],
92)
93
94node_initramfs(
95 name = "initramfs_failed",
96 files = {
97 ":failed": "/init",
98 },
99 fsspecs = [
100 "//osbase/build:earlydev.fsspec",
101 ],
102 visibility = ["//visibility:private"],
103)
104
105efi_unified_kernel_image(
106 name = "kernel_failed",
107 cmdline = "quiet console=ttyS0 init=/init",
108 initrd = [":initramfs_failed"],
109 kernel = "//third_party/linux",
110 visibility = ["//visibility:private"],
111)