aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmd/mbf/main.go19
-rw-r--r--internal/rosa/all.go16
-rw-r--r--internal/rosa/all_test.go5
-rw-r--r--internal/rosa/cmake.go2
-rw-r--r--internal/rosa/llvm.go10
-rw-r--r--internal/rosa/make.go2
-rw-r--r--internal/rosa/meson.go2
-rw-r--r--internal/rosa/rosa_test.go5
8 files changed, 52 insertions, 9 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go
index 1a986ca7..68d418b5 100644
--- a/cmd/mbf/main.go
+++ b/cmd/mbf/main.go
@@ -63,6 +63,8 @@ func main() {
var (
flagQuiet bool
+ flagCheck bool
+ flagLTO bool
addr net.UnixAddr
)
@@ -80,12 +82,29 @@ func main() {
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
}).Flag(
&flagQuiet,
"q", command.BoolFlag(false),
"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(
&cm.cures,
"cures", command.IntFlag(0),
"Maximum number of dependencies to cure at any given time",
diff --git a/internal/rosa/all.go b/internal/rosa/all.go
index f61ec62f..fb745c0a 100644
--- a/internal/rosa/all.go
+++ b/internal/rosa/all.go
@@ -322,15 +322,29 @@ var (
}
// artifactsOnce is for lazy initialisation of artifacts.
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.
func zero[T any](p *T) { var v T; *p = v }
// 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
// package.
-func DropCaches() {
+func DropCaches(flags int) {
+ presetOpts = flags
zero(&artifacts)
zero(&artifactsOnce)
}
diff --git a/internal/rosa/all_test.go b/internal/rosa/all_test.go
index f97ebbdf..52eabf39 100644
--- a/internal/rosa/all_test.go
+++ b/internal/rosa/all_test.go
@@ -20,13 +20,16 @@ func TestLoad(t *testing.T) {
}
func BenchmarkAll(b *testing.B) {
+ flags := rosa.Flags()
+ b.Cleanup(func() { rosa.DropCaches(flags) })
+
for b.Loop() {
for i := range rosa.PresetEnd {
rosa.Std.Load(rosa.PArtifact(i))
}
b.StopTimer()
- rosa.DropCaches()
+ rosa.DropCaches(0)
b.StartTimer()
}
}
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go
index 802a0b30..bfa035c0 100644
--- a/internal/rosa/cmake.go
+++ b/internal/rosa/cmake.go
@@ -185,7 +185,7 @@ func (attr *CMakeHelper) script(name string) string {
}
script := attr.Script
- if !attr.SkipTest {
+ if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
script += "\n" + test
}
diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go
index a7930e1b..6177a716 100644
--- a/internal/rosa/llvm.go
+++ b/internal/rosa/llvm.go
@@ -90,10 +90,14 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
skipChecks[i] = s
}
- cache = append(cache, []KV{
- // very expensive
- {"LLVM_ENABLE_LTO", "Thin"},
+ if presetOpts&OptLLVMNoLTO == 0 {
+ cache = append(cache, []KV{
+ // very expensive
+ {"LLVM_ENABLE_LTO", "Thin"},
+ }...)
+ }
+ cache = append(cache, []KV{
// symbols: clock_gettime, mallopt
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
diff --git a/internal/rosa/make.go b/internal/rosa/make.go
index ecec3a5d..c283e5fb 100644
--- a/internal/rosa/make.go
+++ b/internal/rosa/make.go
@@ -194,7 +194,7 @@ make \
}
scriptMake += "\n"
- if !attr.SkipCheck {
+ if !attr.SkipCheck && presetOpts&OptSkipCheck == 0 {
scriptMake += attr.ScriptCheckEarly + `make \
` + jobsFlagE + ` \
`
diff --git a/internal/rosa/meson.go b/internal/rosa/meson.go
index 4b778a75..638074b9 100644
--- a/internal/rosa/meson.go
+++ b/internal/rosa/meson.go
@@ -117,7 +117,7 @@ func (attr *MesonHelper) script(name string) string {
}
var scriptTest string
- if !attr.SkipTest {
+ if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
scriptTest = `
meson test \
--print-errorlogs`
diff --git a/internal/rosa/rosa_test.go b/internal/rosa/rosa_test.go
index b64ebbd7..ceb7e79c 100644
--- a/internal/rosa/rosa_test.go
+++ b/internal/rosa/rosa_test.go
@@ -93,11 +93,14 @@ func TestCureAll(t *testing.T) {
}
func BenchmarkStage3(b *testing.B) {
+ flags := rosa.Flags()
+ b.Cleanup(func() { rosa.DropCaches(flags) })
+
for b.Loop() {
rosa.Std.Load(rosa.LLVM)
b.StopTimer()
- rosa.DropCaches()
+ rosa.DropCaches(0)
b.StartTimer()
}
}