Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/perf/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ function buildMeasurement(
};
}

function setupMeasurementFailed(measurement: Measurement): boolean {
return measurement.samples.some((sample) => !sample.ok);
}

// Boot the device once and time it. Runs WITHOUT --session so no session lock policy
// applies and the device selectors are honored (selectors are rejected on locked sessions).
function bootOnce(ctx: IsolationContext): Measurement {
Expand Down Expand Up @@ -163,6 +167,10 @@ export function runScenario(ctx: IsolationContext, cfg: PerfConfig): Measurement

const boot = bootOnce(ctx);
const establish = establishSession(ctx);
if (setupMeasurementFailed(boot) || setupMeasurementFailed(establish)) {
log('setup failed; skipping timed tour');
return [boot, establish];
}
// Absorb the one-time runner startup before any round so it isn't charged to a measurement.
warmRunner(ctx);

Expand Down
17 changes: 10 additions & 7 deletions scripts/perf/platform-profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { PerfConfig } from './config.ts';
import type { Platform } from './types.ts';

// Local-convenience defaults for ad-hoc runs; CI always overrides them (--device / --serial).
// The iOS UDID is a specific local "iPhone 17" sim; the Android serial is a dedicated emulator
// port. Pass --udid/--device/--serial to target your own device.
// The iOS UDID is a specific local "iPhone 17" sim; the Android default is an AVD name that
// `boot` can launch. Pass --udid/--device/--serial to target your own device.
const DEFAULT_IOS_UDID = 'D74E0B66-57EB-4EC1-92DC-DA0A30581FE7';
const DEFAULT_ANDROID_SERIAL = 'emulator-5556';
const DEFAULT_ANDROID_AVD = 'Pixel_9_Pro_XL_API_37';

export type ProfileSelectors = {
// A row on the Settings root that pushes a large sub-screen (big a11y tree).
Expand Down Expand Up @@ -57,13 +57,16 @@ export function resolveProfile(cfg: PerfConfig): ResolvedProfile {
},
};
}
const serial = cfg.serial ?? DEFAULT_ANDROID_SERIAL;
const avdName = cfg.device ?? DEFAULT_ANDROID_AVD;
const serialFlags = cfg.serial
? ['--serial', cfg.serial, '--android-device-allowlist', cfg.serial]
: [];
return {
platform: 'android',
deviceName: cfg.serial ? `android (${serial})` : 'Pixel_9_Pro_XL_API_37',
serial,
deviceName: cfg.serial ? `android (${cfg.serial})` : avdName,
serial: cfg.serial,
platformFlags: ['--platform', 'android'],
selectorFlags: ['--serial', serial, '--android-device-allowlist', serial],
selectorFlags: ['--device', avdName, ...serialFlags],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't add the default AVD when a serial was requested

When the perf run is invoked with only --serial and that Android device is not currently visible, this now also passes the implicit default --device Pixel_9_Pro_XL_API_37 into boot. The boot handler treats any --device as an AVD fallback and calls ensureAndroidEmulatorBooted; that helper uses serial only as a discovery filter, not as an emulator launch port, so it can start the default AVD and then wait up to the emulator boot timeout for the requested serial to appear. This makes serial-targeted CI/ad-hoc runs hang or fail against an unrelated default AVD instead of failing fast for the requested serial. Only include --device when the user supplied one, or when no --serial override is present.

Useful? React with 👍 / 👎.

appTarget: 'com.android.settings',
selectors: {
deepScreen: 'text="Network & internet"',
Expand Down
Loading