internal/rosa/cmake: run tests
All checks were successful
Test / Create distribution (push) Successful in 1m27s
Test / Sandbox (push) Successful in 5m19s
Test / Hakurei (push) Successful in 7m24s
Test / Sandbox (race detector) (push) Successful in 8m4s
Test / ShareFS (push) Successful in 8m17s
Test / Hakurei (race detector) (push) Successful in 11m10s
Test / Flake checks (push) Successful in 2m43s

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
}

View File

@@ -20,6 +20,9 @@ func (t Toolchain) newSPIRVHeaders() (pkg.Artifact, string) {
Cache: []KV{
{"CMAKE_BUILD_TYPE", "Release"},
},
// upstream has no tests
SkipTest: true,
}), version
}
func init() {
@@ -110,7 +113,6 @@ func (t Toolchain) newGlslang() (pkg.Artifact, string) {
{"BUILD_SHARED_LIBS", "ON"},
{"ALLOW_EXTERNAL_SPIRV_TOOLS", "ON"},
},
Script: "ctest",
},
Python,
Bash,

View File

@@ -16,7 +16,7 @@ func (t Toolchain) newZlib() (pkg.Artifact, string) {
{"CMAKE_BUILD_TYPE", "Release"},
{"CMAKE_C_FLAGS", "-fPIC"},
{"ZLIB_BUILD_TESTING", "OFF"},
{"ZLIB_BUILD_TESTING", "ON"},
{"ZLIB_BUILD_SHARED", "ON"},
{"ZLIB_BUILD_STATIC", "ON"},
{"ZLIB_BUILD_MINIZIP", "OFF"},

View File

@@ -13,12 +13,23 @@ func (t Toolchain) newZstd() (pkg.Artifact, string) {
"zstd-"+version+".tar.gz",
checksum,
pkg.TarGzip,
), nil, &CMakeHelper{
), &PackageAttr{
// tests Makefile assumes writable source
Writable: true,
Chmod: true,
}, &CMakeHelper{
Append: []string{"build", "cmake"},
Cache: []KV{
{"CMAKE_BUILD_TYPE", "Release"},
},
}), version
Test: `
make -C /usr/src/zstd/tests datagen
ZSTD_BIN=/cure/programs/zstd /usr/src/zstd/tests/playTests.sh
`,
},
Make,
Diffutils,
), version
}
func init() {
artifactsM[Zstd] = Metadata{