Skip to content

Commit

Permalink
[1760]: Fix the full benchmark sim.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpicyLemon committed May 31, 2024
1 parent 8757355 commit 32ea53a
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions app/sim_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ import (
func BenchmarkFullAppSimulation(b *testing.B) {
b.ReportAllocs()
config, db, dir, logger, skip, err := setupSimulation("goleveldb-app-sim", "Simulation")
if err != nil {
b.Fatalf("simulation setup failed: %s", err.Error())
}
require.NoError(b, err, "simulation setup failed")

if skip {
b.Skip("skipping benchmark application simulation")
}
printConfig(config)

defer func() {
db.Close()
err = os.RemoveAll(dir)
if err != nil {
b.Fatal(err)
}
require.NoError(b, db.Close())
require.NoError(b, os.RemoveAll(dir))
}()

app := New(logger, db, nil, true, newSimAppOpts(b), interBlockCacheOpt())
appOpts := newSimAppOpts(b)
baseAppOpts := []func(*baseapp.BaseApp){
interBlockCacheOpt(),
baseapp.SetChainID(config.ChainID),
}
app := New(logger, db, nil, true, appOpts, baseAppOpts...)

// run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed(
Expand All @@ -55,23 +55,17 @@ func BenchmarkFullAppSimulation(b *testing.B) {
)

// export state and simParams before the simulation error is checked
if err = simtestutil.CheckExportSimulation(app, config, simParams); err != nil {
b.Fatal(err)
}

if simErr != nil {
b.Fatal(simErr)
}
err = simtestutil.CheckExportSimulation(app, config, simParams)
require.NoError(b, err, "CheckExportSimulation")
require.NoError(b, simErr, "SimulateFromSeed")

printStats(config, db)
}

func BenchmarkInvariants(b *testing.B) {
b.ReportAllocs()
config, db, dir, logger, skip, err := setupSimulation("leveldb-app-invariant-bench", "Simulation")
if err != nil {
b.Fatalf("simulation setup failed: %s", err.Error())
}
require.NoError(b, err, "simulation setup failed")

if skip {
b.Skip("skipping benchmark application simulation")
Expand Down

0 comments on commit 32ea53a

Please sign in to comment.