Skip to content

Commit 7443932

Browse files
fabio-dCQ Bot
authored andcommitted
[ffx][e2e_emu] Register the build's symbol index into the ffx isolate too
Change-Id: If2cb12aab5efc9795c8bf3fe9839fabaa637e564 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1235584 Commit-Queue: Fabio D'Urso <[email protected]> Reviewed-by: Adam Perry <[email protected]> Reviewed-by: Steven Grady <[email protected]>
1 parent 6a52f52 commit 7443932

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

src/developer/ffx/lib/e2e_emu/ffx_e2e_test.gni

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ template("ffx_e2e_test") {
2727
_amber_files_label = "//build/images/updates:publish($default_toolchain)"
2828
_amber_files_path = "$root_build_dir/amber-files"
2929

30+
_symbol_index_label = "//src/developer/ffx/lib/symbol-index:symbol_index_json($default_toolchain)"
31+
_symbol_index_path = "$root_build_dir/.symbol-index.json"
32+
3033
# Default product bundle containing emulator image.
3134
_pb_label = "//build/images/fuchsia:product_bundle($default_toolchain)"
3235
if (defined(invoker.product_bundle)) {
@@ -44,6 +47,7 @@ template("ffx_e2e_test") {
4447
data_deps = [
4548
":$_host_test_data_label",
4649
"//src/developer/ffx:suite_test_data",
50+
_symbol_index_label,
4751
]
4852
if (defined(invoker.data_deps)) {
4953
data_deps += invoker.data_deps
@@ -53,6 +57,8 @@ template("ffx_e2e_test") {
5357
"env PRODUCT_BUNDLE_PATH=" + rebase_path(_product_bundle, root_build_dir),
5458
"env PACKAGE_REPOSITORY_PATH=" +
5559
rebase_path(_amber_files_path, root_build_dir),
60+
"env SYMBOL_INDEX_PATH=" +
61+
rebase_path(_symbol_index_path, root_build_dir),
5662
]
5763

5864
if (defined(invoker.env)) {

src/developer/ffx/lib/e2e_emu/src/lib.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,19 @@ impl IsolatedEmulator {
3737
pub async fn start(name: &str) -> anyhow::Result<Self> {
3838
let amber_files_path = std::env::var("PACKAGE_REPOSITORY_PATH")
3939
.expect("PACKAGE_REPOSITORY_PATH env var must be set -- run this test with 'fx test'");
40-
Self::start_internal(name, Some(&amber_files_path)).await
40+
let symbol_index_path = std::env::var("SYMBOL_INDEX_PATH")
41+
.expect("SYMBOL_INDEX_PATH env var must be set -- run this test with 'fx test'");
42+
Self::start_internal(name, Some(&amber_files_path), Some(&symbol_index_path)).await
4143
}
4244

4345
// This is private to be used for testing with a path to a different package repo. Path
4446
// to amber-files is optional for testing to ensure that other successful tests are actually
4547
// matching a developer workflow.
46-
async fn start_internal(name: &str, amber_files_path: Option<&str>) -> anyhow::Result<Self> {
48+
async fn start_internal(
49+
name: &str,
50+
amber_files_path: Option<&str>,
51+
symbol_index_path: Option<&str>,
52+
) -> anyhow::Result<Self> {
4753
let emu_name = format!("{name}-emu");
4854

4955
info!(%name, "making ffx isolate");
@@ -90,6 +96,11 @@ impl IsolatedEmulator {
9096
this.ffx(&["config", "set", "log.level", "debug"])
9197
.await
9298
.context("setting ffx log level")?;
99+
if let Some(symbol_index_path) = symbol_index_path {
100+
this.ffx(&["debug", "symbol-index", "add", symbol_index_path])
101+
.await
102+
.context("setting ffx symbol index path")?;
103+
}
93104

94105
this.ffx_isolate.start_daemon().await?;
95106

@@ -385,9 +396,10 @@ mod tests {
385396
async fn public_apis_succeed() {
386397
let amber_files_path = std::env::var("PACKAGE_REPOSITORY_PATH")
387398
.expect("PACKAGE_REPOSITORY_PATH env var must be set -- run this test with 'fx test'");
388-
let emu = IsolatedEmulator::start_internal("e2e-emu-public-apis", Some(&amber_files_path))
389-
.await
390-
.expect("Couldn't start emulator");
399+
let emu =
400+
IsolatedEmulator::start_internal("e2e-emu-public-apis", Some(&amber_files_path), None)
401+
.await
402+
.expect("Couldn't start emulator");
391403

392404
info!("Checking target monotonic time to ensure we can connect and get stdout");
393405
let time = emu.ffx_output(&["target", "get-time"]).await.unwrap();
@@ -422,9 +434,10 @@ mod tests {
422434
let test_package_name = std::env::var("TEST_PACKAGE_NAME")
423435
.expect("TEST_PACKAGE_NAME env var must be set -- run this test with 'fx test'");
424436
let test_package_url = format!("fuchsia-pkg://fuchsia.com/{test_package_name}");
425-
let emu = IsolatedEmulator::start_internal("pkg-resolve", Some(&test_amber_files_path))
426-
.await
427-
.unwrap();
437+
let emu =
438+
IsolatedEmulator::start_internal("pkg-resolve", Some(&test_amber_files_path), None)
439+
.await
440+
.unwrap();
428441
emu.ssh(&["pkgctl", "resolve", &test_package_url]).await.unwrap();
429442
emu.stop().await;
430443
}
@@ -433,7 +446,7 @@ mod tests {
433446
/// demonstrating that the same package is unavailable when there's no server running.
434447
#[fuchsia::test]
435448
async fn fail_to_resolve_package_when_no_package_server_running() {
436-
let emu = IsolatedEmulator::start_internal("pkg-resolve-fail", None).await.unwrap();
449+
let emu = IsolatedEmulator::start_internal("pkg-resolve-fail", None, None).await.unwrap();
437450
let test_package_name = std::env::var("TEST_PACKAGE_NAME")
438451
.expect("TEST_PACKAGE_NAME env var must be set -- run this test with 'fx test'");
439452
let test_package_url = format!("fuchsia-pkg://fuchsia.com/{test_package_name}");

0 commit comments

Comments
 (0)