internal/rosa: global preset flags
All checks were successful
Test / Create distribution (push) Successful in 1m31s
Test / Sandbox (push) Successful in 5m8s
Test / Hakurei (push) Successful in 7m31s
Test / Sandbox (race detector) (push) Successful in 8m6s
Test / ShareFS (push) Successful in 8m28s
Test / Hakurei (race detector) (push) Successful in 11m8s
Test / Flake checks (push) Successful in 2m41s
All checks were successful
Test / Create distribution (push) Successful in 1m31s
Test / Sandbox (push) Successful in 5m8s
Test / Hakurei (push) Successful in 7m31s
Test / Sandbox (race detector) (push) Successful in 8m6s
Test / ShareFS (push) Successful in 8m28s
Test / Hakurei (race detector) (push) Successful in 11m8s
Test / Flake checks (push) Successful in 2m41s
These changes preset behaviour globally. Useful for ad hoc workarounds for development or bootstrapping on resource-constrained systems. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -63,6 +63,8 @@ func main() {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
flagQuiet bool
|
flagQuiet bool
|
||||||
|
flagCheck bool
|
||||||
|
flagLTO bool
|
||||||
|
|
||||||
addr net.UnixAddr
|
addr net.UnixAddr
|
||||||
)
|
)
|
||||||
@@ -80,11 +82,28 @@ func main() {
|
|||||||
addr.Name = filepath.Join(cm.base, "daemon")
|
addr.Name = filepath.Join(cm.base, "daemon")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var flags int
|
||||||
|
if !flagCheck {
|
||||||
|
flags |= rosa.OptSkipCheck
|
||||||
|
}
|
||||||
|
if !flagLTO {
|
||||||
|
flags |= rosa.OptLLVMNoLTO
|
||||||
|
}
|
||||||
|
rosa.DropCaches(flags)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}).Flag(
|
}).Flag(
|
||||||
&flagQuiet,
|
&flagQuiet,
|
||||||
"q", command.BoolFlag(false),
|
"q", command.BoolFlag(false),
|
||||||
"Do not print cure messages",
|
"Do not print cure messages",
|
||||||
|
).Flag(
|
||||||
|
&flagLTO,
|
||||||
|
"lto", command.BoolFlag(false),
|
||||||
|
"Enable LTO in stage2 and stage3 LLVM toolchains",
|
||||||
|
).Flag(
|
||||||
|
&flagCheck,
|
||||||
|
"check", command.BoolFlag(true),
|
||||||
|
"Run test suites",
|
||||||
).Flag(
|
).Flag(
|
||||||
&cm.cures,
|
&cm.cures,
|
||||||
"cures", command.IntFlag(0),
|
"cures", command.IntFlag(0),
|
||||||
|
|||||||
@@ -322,15 +322,29 @@ var (
|
|||||||
}
|
}
|
||||||
// artifactsOnce is for lazy initialisation of artifacts.
|
// artifactsOnce is for lazy initialisation of artifacts.
|
||||||
artifactsOnce [_toolchainEnd][len(artifactsM)]sync.Once
|
artifactsOnce [_toolchainEnd][len(artifactsM)]sync.Once
|
||||||
|
|
||||||
|
// presetOpts globally modifies behaviour of presets.
|
||||||
|
presetOpts int
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// OptSkipCheck skips running all test suites.
|
||||||
|
OptSkipCheck = 1 << iota
|
||||||
|
// OptLLVMNoLTO disables LTO in all [LLVM] stages.
|
||||||
|
OptLLVMNoLTO
|
||||||
|
)
|
||||||
|
|
||||||
|
// Flags returns the current preset flags
|
||||||
|
func Flags() int { return presetOpts }
|
||||||
|
|
||||||
// zero zeros the value pointed to by p.
|
// zero zeros the value pointed to by p.
|
||||||
func zero[T any](p *T) { var v T; *p = v }
|
func zero[T any](p *T) { var v T; *p = v }
|
||||||
|
|
||||||
// DropCaches arranges for all cached [pkg.Artifact] to be freed some time after
|
// DropCaches arranges for all cached [pkg.Artifact] to be freed some time after
|
||||||
// it returns. Must not be used concurrently with any other function from this
|
// it returns. Must not be used concurrently with any other function from this
|
||||||
// package.
|
// package.
|
||||||
func DropCaches() {
|
func DropCaches(flags int) {
|
||||||
|
presetOpts = flags
|
||||||
zero(&artifacts)
|
zero(&artifacts)
|
||||||
zero(&artifactsOnce)
|
zero(&artifactsOnce)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,16 @@ func TestLoad(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkAll(b *testing.B) {
|
func BenchmarkAll(b *testing.B) {
|
||||||
|
flags := rosa.Flags()
|
||||||
|
b.Cleanup(func() { rosa.DropCaches(flags) })
|
||||||
|
|
||||||
for b.Loop() {
|
for b.Loop() {
|
||||||
for i := range rosa.PresetEnd {
|
for i := range rosa.PresetEnd {
|
||||||
rosa.Std.Load(rosa.PArtifact(i))
|
rosa.Std.Load(rosa.PArtifact(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
rosa.DropCaches()
|
rosa.DropCaches(0)
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ func (attr *CMakeHelper) script(name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
script := attr.Script
|
script := attr.Script
|
||||||
if !attr.SkipTest {
|
if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
|
||||||
script += "\n" + test
|
script += "\n" + test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,10 +90,14 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
|||||||
skipChecks[i] = s
|
skipChecks[i] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = append(cache, []KV{
|
if presetOpts&OptLLVMNoLTO == 0 {
|
||||||
// very expensive
|
cache = append(cache, []KV{
|
||||||
{"LLVM_ENABLE_LTO", "Thin"},
|
// very expensive
|
||||||
|
{"LLVM_ENABLE_LTO", "Thin"},
|
||||||
|
}...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cache = append(cache, []KV{
|
||||||
// symbols: clock_gettime, mallopt
|
// symbols: clock_gettime, mallopt
|
||||||
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ make \
|
|||||||
}
|
}
|
||||||
scriptMake += "\n"
|
scriptMake += "\n"
|
||||||
|
|
||||||
if !attr.SkipCheck {
|
if !attr.SkipCheck && presetOpts&OptSkipCheck == 0 {
|
||||||
scriptMake += attr.ScriptCheckEarly + `make \
|
scriptMake += attr.ScriptCheckEarly + `make \
|
||||||
` + jobsFlagE + ` \
|
` + jobsFlagE + ` \
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ func (attr *MesonHelper) script(name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var scriptTest string
|
var scriptTest string
|
||||||
if !attr.SkipTest {
|
if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
|
||||||
scriptTest = `
|
scriptTest = `
|
||||||
meson test \
|
meson test \
|
||||||
--print-errorlogs`
|
--print-errorlogs`
|
||||||
|
|||||||
@@ -93,11 +93,14 @@ func TestCureAll(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkStage3(b *testing.B) {
|
func BenchmarkStage3(b *testing.B) {
|
||||||
|
flags := rosa.Flags()
|
||||||
|
b.Cleanup(func() { rosa.DropCaches(flags) })
|
||||||
|
|
||||||
for b.Loop() {
|
for b.Loop() {
|
||||||
rosa.Std.Load(rosa.LLVM)
|
rosa.Std.Load(rosa.LLVM)
|
||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
rosa.DropCaches()
|
rosa.DropCaches(0)
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user