1
0
forked from rosa/hakurei

internal/rosa/cmake: run tests

This uses the standard CMake test target.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-01 02:02:00 +09:00
parent 09a216c6ec
commit 2cd6b35bee
4 changed files with 33 additions and 5 deletions

View File

@@ -127,6 +127,11 @@ type CMakeHelper struct {
// Runs after install.
Script string
// Replaces the default test command.
Test string
// Whether to skip running tests.
SkipTest bool
// Whether to generate Makefile instead.
Make bool
}
@@ -170,8 +175,18 @@ func (attr *CMakeHelper) script(name string) string {
}
generate := "Ninja"
test := "ninja " + jobsFlagE + " test"
if attr.Make {
generate = "'Unix Makefiles'"
test = "make " + jobsFlagE + " test"
}
if attr.Test != "" {
test = attr.Test
}
script := attr.Script
if !attr.SkipTest {
script += "\n" + test
}
return `
@@ -191,5 +206,5 @@ cmake -G ` + generate + ` \
'/usr/src/` + name + `/` + filepath.Join(attr.Append...) + `'
cmake --build . --parallel=` + jobsE + `
cmake --install . --prefix=/work/system
` + attr.Script
` + script
}