Add in-kernel test runner
This adds a way to run tests inside the Smalltown kernel.
Improvements to the Bazel part of this are tracked in T726
Test Plan: Tested by intentionally failing the test.
X-Origin-Diff: phab/D485
GitOrigin-RevId: e4aad7f28d122d82a7fcb6699e678cbe022e2f73
diff --git a/core/pkg/fsquota/BUILD.bazel b/core/pkg/fsquota/BUILD.bazel
index 6971929..8feeede 100644
--- a/core/pkg/fsquota/BUILD.bazel
+++ b/core/pkg/fsquota/BUILD.bazel
@@ -1,4 +1,5 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("//core/tools/ktest:ktest.bzl", "ktest")
go_library(
name = "go_default_library",
@@ -14,3 +15,25 @@
"@org_golang_x_sys//unix:go_default_library",
],
)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["fsquota_test.go"],
+ embed = [":go_default_library"],
+ pure = "on",
+ deps = [
+ "@com_github_stretchr_testify//require:go_default_library",
+ "@org_golang_x_sys//unix:go_default_library",
+ ],
+)
+
+ktest(
+ tester = ":go_default_test",
+ deps = [
+ "//third_party/xfsprogs:mkfs.xfs",
+ ],
+ initramfs_extra = """
+file /mkfs.xfs $(location //third_party/xfsprogs:mkfs.xfs) 0755 0 0
+ """,
+ cmdline = "ramdisk_size=51200",
+)