diff --git a/scripts/runBenchmarks.ts b/scripts/runBenchmarks.ts index 70d2783af..7d7051f35 100644 --- a/scripts/runBenchmarks.ts +++ b/scripts/runBenchmarks.ts @@ -86,7 +86,7 @@ const writeResultsToFile = (results: IBenchResult[]) => { }; /** - * Launch a single benchmark. It returns the stdout from `/benchmarks/util/util.lua`. + * Launch a single benchmark. It returns the stdout from wrk's Lua done() callback. * * @param endpoint Endpoint that reflects one of the keys from `benchmarkConfig`. * @param wsUrl `wsUrl` to benchmark off of. @@ -137,6 +137,10 @@ const main = async (args: IBenchParseArgs) => { if (log_level) setLogLevel(log_level); setBenchTime(args.time); + // Set LUA_PATH so wrk Lua scripts can require("util") and require("report") + // from any benchmark subdirectory without needing per-script package.path hacks. + process.env.LUA_PATH = `${process.cwd()}/benchmarks/?.lua;;`; + console.log('Building Sidecar...'); const sidecarBuild = await launchProcess('yarn', procs, defaultSasBuildOpts);