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

View File

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

View File

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

View File

@@ -13,12 +13,23 @@ func (t Toolchain) newZstd() (pkg.Artifact, string) {
"zstd-"+version+".tar.gz", "zstd-"+version+".tar.gz",
checksum, checksum,
pkg.TarGzip, pkg.TarGzip,
), nil, &CMakeHelper{ ), &PackageAttr{
// tests Makefile assumes writable source
Writable: true,
Chmod: true,
}, &CMakeHelper{
Append: []string{"build", "cmake"}, Append: []string{"build", "cmake"},
Cache: []KV{ Cache: []KV{
{"CMAKE_BUILD_TYPE", "Release"}, {"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() { func init() {
artifactsM[Zstd] = Metadata{ artifactsM[Zstd] = Metadata{