Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-06-26 10:56:01 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-06-26 10:56:01 +0300
commitd1278f696aa062950471587bf3dc4a1604cf5d5b (patch)
tree01ce77cc36866641e149bca050ac5fac872726de
parent92f31ae63b62ba52f476d55266b143f49b739fbe (diff)
Extract the baseline benchmark to a test
-rw-r--r--hugolib/hugo_smoke_test.go44
1 files changed, 30 insertions, 14 deletions
diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go
index 241ac537d..0c14414e5 100644
--- a/hugolib/hugo_smoke_test.go
+++ b/hugolib/hugo_smoke_test.go
@@ -322,7 +322,36 @@ The content.
b.CreateSites().Build(BuildCfg{})
}
+// This is just a test to verify that BenchmarkBaseline is working as intended.
+func TestBenchmarkBaseline(t *testing.T) {
+ cfg := IntegrationTestConfig{
+ T: t,
+ TxtarString: benchmarkBaselineFiles(),
+ }
+ b := NewIntegrationTestBuilder(cfg).Build()
+
+ b.Assert(len(b.H.Sites), qt.Equals, 4)
+
+}
+
func BenchmarkBaseline(b *testing.B) {
+ cfg := IntegrationTestConfig{
+ T: b,
+ TxtarString: benchmarkBaselineFiles(),
+ }
+ builders := make([]*IntegrationTestBuilder, b.N)
+
+ for i := range builders {
+ builders[i] = NewIntegrationTestBuilder(cfg)
+ }
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ builders[i].Build()
+ }
+}
+
+func benchmarkBaselineFiles() string {
files := `
-- config.toml --
baseURL = "https://example.com"
@@ -410,18 +439,5 @@ Aliqua labore enim et sint anim amet excepteur ea dolore.
}
}
- cfg := IntegrationTestConfig{
- T: b,
- TxtarString: files,
- }
- builders := make([]*IntegrationTestBuilder, b.N)
-
- for i := range builders {
- builders[i] = NewIntegrationTestBuilder(cfg)
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- builders[i].Build()
- }
+ return files
}