Skip to content

Commit

Permalink
fix(bazel/benchmark): expose benchpress test results as bazel test ou…
Browse files Browse the repository at this point in the history
…tput

Currenlty the test results are written to a directory in the current working
directory. This breaks in Bazel sandbox executions where the sandbox directory
is not available upon test/benchmark completion.

Instead, when running within Bazel, the test results should be stored as
undeclared test outputs (allowing them to be accessed easily).
  • Loading branch information
devversion committed Jan 27, 2022
1 parent 5fbb98b commit e7f43ba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bazel/benchmark/driver-utilities/perf_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {mkdirSync} from 'fs';
import {resolve} from 'path';

export {verifyNoBrowserErrors} from './e2e_util';

/** Absolute path to the directory where benchmark results should be written to. */
const testOutputDirectory =
process.env.TEST_UNDECLARED_OUTPUTS_DIR ?? resolve('./dist/benchmark_results');

import {
SeleniumWebDriverAdapter,
Options,
Expand Down Expand Up @@ -71,16 +75,13 @@ function createBenchpressRunner(): Runner {
if (process.env.GIT_SHA) {
runId = process.env.GIT_SHA + ' ' + runId;
}
const resultsFolder = './dist/benchmark_results';
mkdirSync(resultsFolder, {
recursive: true,
});

const providers: StaticProvider[] = [
SeleniumWebDriverAdapter.PROTRACTOR_PROVIDERS,
{provide: Options.FORCE_GC, useValue: globalOptions.forceGc},
{provide: Options.DEFAULT_DESCRIPTION, useValue: {'runId': runId}},
JsonFileReporter.PROVIDERS,
{provide: JsonFileReporter.PATH, useValue: resultsFolder},
{provide: JsonFileReporter.PATH, useValue: testOutputDirectory},
];
if (!globalOptions.dryRun) {
providers.push({provide: Validator, useExisting: RegressionSlopeValidator});
Expand Down

0 comments on commit e7f43ba

Please sign in to comment.