(benchArgs: BenchArgs)
| 54 | `; |
| 55 | |
| 56 | export async function runBenchmark(benchArgs: BenchArgs): Promise<void> { |
| 57 | const { |
| 58 | scenarioPath, |
| 59 | command, |
| 60 | init, |
| 61 | useLocal, |
| 62 | forceCheckout, |
| 63 | forcePublish, |
| 64 | precompile, |
| 65 | prepare, |
| 66 | ignoreFailure, |
| 67 | showOutput, |
| 68 | warmup, |
| 69 | exportJson, |
| 70 | memFile, |
| 71 | e2eCloneDirectory, |
| 72 | } = benchArgs; |
| 73 | |
| 74 | const scenario = loadScenario(e2eCloneDirectory, scenarioPath); |
| 75 | |
| 76 | if (scenario.definition.disabled === true) { |
| 77 | logWarning(`Scenario "${scenario.id}" is disabled`); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | const benchCommand = command ?? scenario.definition.defaultCommand; |
| 82 | const runs = benchArgs.runs ?? 10; |
| 83 | |
| 84 | if (init) { |
| 85 | logStep("Initializing scenario"); |
| 86 | await e2eInit( |
| 87 | e2eCloneDirectory, |
| 88 | scenarioPath, |
| 89 | useLocal, |
| 90 | forceCheckout, |
| 91 | forcePublish, |
| 92 | ); |
| 93 | } |
| 94 | |
| 95 | if (precompile) { |
| 96 | logStep("Precompiling (npx hardhat compile)"); |
| 97 | await e2eExec( |
| 98 | e2eCloneDirectory, |
| 99 | scenarioPath, |
| 100 | "npx hardhat compile", |
| 101 | useLocal, |
| 102 | forceCheckout, |
| 103 | forcePublish, |
| 104 | ); |
| 105 | } |
| 106 | |
| 107 | logStep("Running benchmark"); |
| 108 | const hyperfineCommand = buildHyperfineCommand( |
| 109 | benchCommand, |
| 110 | warmup, |
| 111 | runs, |
| 112 | prepare, |
| 113 | ignoreFailure, |
no test coverage detected