Skip to main content

fshost_test_fixture/
lib.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use assert_matches::assert_matches;
6use diagnostics_assertions::assert_data_tree;
7use diagnostics_reader::ArchiveReader;
8use disk_builder::Disk;
9use fake_keymint::FakeKeymint;
10use fidl::endpoints::{ServiceMarker as _, create_proxy};
11use fidl_fuchsia_boot as fboot;
12use fidl_fuchsia_driver_test as fdt;
13use fidl_fuchsia_driver_token as ftoken;
14use fidl_fuchsia_feedback as ffeedback;
15use fidl_fuchsia_fshost_fxfsprovisioner as ffxfsprovisioner;
16use fidl_fuchsia_fxfs::{BlobReaderMarker, CryptManagementProxy, CryptProxy, KeyPurpose};
17use fidl_fuchsia_hardware_block_volume as fvolume;
18use fidl_fuchsia_hardware_inlineencryption as finline;
19use fidl_fuchsia_hardware_ramdisk as framdisk;
20use fidl_fuchsia_io as fio;
21use fidl_fuchsia_security_keymint as fkeymint;
22use fidl_fuchsia_storage_block as fblock;
23use fidl_fuchsia_storage_partitions as fpartitions;
24use fuchsia_async::{self as fasync, TimeoutExt as _};
25use fuchsia_component::client::{
26    connect_to_named_protocol_at_dir_root, connect_to_protocol_at_dir_root,
27};
28use fuchsia_component_test::{Capability, ChildOptions, RealmBuilder, RealmInstance, Ref, Route};
29use fuchsia_driver_test::{DriverTestRealmBuilder, DriverTestRealmInstance};
30use futures::channel::mpsc;
31use futures::{FutureExt as _, StreamExt as _};
32use ramdevice_client::{RamdiskClient, RamdiskClientBuilder};
33use std::pin::pin;
34use std::sync::Arc;
35use std::time::Duration;
36use test_vmo_backed_block_server::VmoBackedServer;
37
38pub mod disk_builder;
39mod mocks;
40
41pub use disk_builder::write_blob;
42pub use fshost_assembly_config::{BlockDeviceConfig, BlockDeviceIdentifiers, BlockDeviceParent};
43
44pub const VFS_TYPE_BLOBFS: u32 = 0x9e694d21;
45pub const VFS_TYPE_MINFS: u32 = 0x6e694d21;
46pub const VFS_TYPE_MEMFS: u32 = 0x3e694d21;
47pub const VFS_TYPE_FXFS: u32 = 0x73667866;
48pub const VFS_TYPE_F2FS: u32 = 0xfe694d21;
49pub const STARNIX_VOLUME_NAME: &str = "starnix_volume";
50
51const DEFAULT_TIMEOUT: Duration = Duration::from_secs(60);
52
53async fn with_timeout<F: std::future::Future>(fut: F, name: impl Into<String>) -> F::Output {
54    let name = name.into();
55    fut.on_timeout(DEFAULT_TIMEOUT, move || panic!("{name} timed out after {DEFAULT_TIMEOUT:?}"))
56        .await
57}
58
59pub fn round_down<
60    T: Into<U>,
61    U: Copy + std::ops::Rem<U, Output = U> + std::ops::Sub<U, Output = U>,
62>(
63    offset: U,
64    block_size: T,
65) -> U {
66    let block_size = block_size.into();
67    offset - offset % block_size
68}
69
70pub struct TestFixtureBuilder {
71    no_fuchsia_boot: bool,
72    disk: Option<Disk>,
73    extra_disks: Vec<Disk>,
74    fshost: fshost_testing::FshostBuilder,
75    zbi_ramdisk: Option<disk_builder::DiskBuilder>,
76    force_fxfs_provisioner_failure: bool,
77    keymint: std::sync::Arc<FakeKeymint>,
78    crypt_policy: crypt_policy::Policy,
79    simulated_gpt: Option<Arc<VmoBackedServer>>,
80}
81
82impl TestFixtureBuilder {
83    pub fn new(fshost_component_name: &'static str) -> Self {
84        Self {
85            no_fuchsia_boot: false,
86            disk: None,
87            extra_disks: Vec::new(),
88            fshost: fshost_testing::FshostBuilder::new(fshost_component_name),
89            zbi_ramdisk: None,
90            force_fxfs_provisioner_failure: false,
91            keymint: std::sync::Arc::new(FakeKeymint::default()),
92            crypt_policy: crypt_policy::Policy::Null,
93            simulated_gpt: None,
94        }
95    }
96
97    pub fn fshost(&mut self) -> &mut fshost_testing::FshostBuilder {
98        &mut self.fshost
99    }
100
101    pub fn keymint(&mut self) -> std::sync::Arc<FakeKeymint> {
102        self.keymint.clone()
103    }
104
105    pub fn with_keymint_instance(mut self, keymint: std::sync::Arc<FakeKeymint>) -> Self {
106        self.keymint = keymint.clone();
107        if let Some(Disk::Builder(ref mut disk_builder)) = self.disk {
108            disk_builder.with_keymint_instance(keymint.clone());
109        }
110        for disk in &mut self.extra_disks {
111            if let Disk::Builder(disk_builder) = disk {
112                disk_builder.with_keymint_instance(keymint.clone());
113            }
114        }
115        self
116    }
117
118    pub fn with_disk(&mut self) -> &mut disk_builder::DiskBuilder {
119        self.disk = Some(Disk::Builder(disk_builder::DiskBuilder::new()));
120        self.disk
121            .as_mut()
122            .unwrap()
123            .builder()
124            .with_crypt_policy(self.crypt_policy)
125            .with_keymint_instance(self.keymint.clone());
126        self.disk.as_mut().unwrap().builder()
127    }
128
129    pub fn with_extra_disk(&mut self) -> &mut disk_builder::DiskBuilder {
130        self.extra_disks.push(Disk::Builder(disk_builder::DiskBuilder::new()));
131        self.extra_disks
132            .last_mut()
133            .unwrap()
134            .builder()
135            .with_crypt_policy(self.crypt_policy)
136            .with_keymint_instance(self.keymint.clone());
137        self.extra_disks.last_mut().unwrap().builder()
138    }
139
140    pub fn with_uninitialized_disk(mut self) -> Self {
141        self.disk = Some(Disk::Builder(disk_builder::DiskBuilder::uninitialized()));
142        self
143    }
144
145    pub fn with_disk_from(mut self, disk: Disk) -> Self {
146        self.disk = Some(disk);
147        self
148    }
149
150    pub fn with_simulated_gpt(mut self, server: Arc<VmoBackedServer>) -> Self {
151        self.simulated_gpt = Some(server);
152        self
153    }
154
155    pub fn with_zbi_ramdisk(&mut self) -> &mut disk_builder::DiskBuilder {
156        self.zbi_ramdisk = Some(disk_builder::DiskBuilder::new());
157        self.zbi_ramdisk.as_mut().unwrap()
158    }
159
160    pub fn no_fuchsia_boot(mut self) -> Self {
161        self.no_fuchsia_boot = true;
162        self
163    }
164
165    pub fn with_device_config(mut self, device_config: Vec<BlockDeviceConfig>) -> Self {
166        self.fshost.set_device_config(device_config);
167        self
168    }
169
170    pub fn with_crypt_policy(mut self, policy: crypt_policy::Policy) -> Self {
171        self.fshost.set_crypt_policy(policy);
172        self.crypt_policy = policy;
173        if let Some(Disk::Builder(ref mut disk_builder)) = self.disk {
174            disk_builder.with_crypt_policy(policy);
175        }
176        for disk in &mut self.extra_disks {
177            if let Disk::Builder(disk_builder) = disk {
178                disk_builder.with_crypt_policy(policy);
179            }
180        }
181        self
182    }
183
184    pub fn force_fxfs_provisioner_failure(mut self) -> Self {
185        self.force_fxfs_provisioner_failure = true;
186        self
187    }
188
189    pub async fn build(self) -> TestFixture {
190        let builder = RealmBuilder::new().await.unwrap();
191        let fshost = self.fshost.build(&builder).await;
192        // Route fshost's inline encryption Device capability to the parent.
193        builder
194            .add_route(
195                Route::new()
196                    .capability(Capability::protocol::<finline::DeviceMarker>())
197                    .from(&fshost)
198                    .to(Ref::parent()),
199            )
200            .await
201            .unwrap();
202
203        let maybe_zbi_vmo = match self.zbi_ramdisk {
204            Some(disk_builder) => Some(disk_builder.build_as_zbi_ramdisk().await),
205            None => None,
206        };
207        let (tx, crash_reports) = mpsc::channel(32);
208        let mocks = mocks::new_mocks(
209            maybe_zbi_vmo,
210            tx,
211            self.force_fxfs_provisioner_failure,
212            self.keymint.clone(),
213            self.simulated_gpt.clone(),
214        );
215
216        let mocks = builder
217            .add_local_child("mocks", move |h| mocks(h).boxed(), ChildOptions::new())
218            .await
219            .unwrap();
220        builder
221            .add_route(
222                Route::new()
223                    .capability(Capability::protocol::<fkeymint::SealingKeysMarker>())
224                    .capability(Capability::protocol::<fkeymint::AdminMarker>())
225                    .from(&mocks)
226                    .to(Ref::parent()),
227            )
228            .await
229            .unwrap();
230        builder
231            .add_route(
232                Route::new()
233                    .capability(Capability::protocol::<ffeedback::CrashReporterMarker>())
234                    .capability(Capability::protocol::<ffxfsprovisioner::FxfsProvisionerMarker>())
235                    .capability(Capability::protocol::<fkeymint::SealingKeysMarker>())
236                    .capability(Capability::protocol::<fkeymint::AdminMarker>())
237                    .capability(Capability::protocol::<ftoken::NodeBusTopologyMarker>())
238                    .from(&mocks)
239                    .to(&fshost),
240            )
241            .await
242            .unwrap();
243        builder
244            .add_route(
245                Route::new()
246                    .capability(Capability::service::<fvolume::ServiceMarker>())
247                    .from(&mocks)
248                    .to(&fshost),
249            )
250            .await
251            .unwrap();
252        if !self.no_fuchsia_boot {
253            builder
254                .add_route(
255                    Route::new()
256                        .capability(Capability::protocol::<fboot::ArgumentsMarker>())
257                        .capability(Capability::protocol::<fboot::ItemsMarker>())
258                        .from(&mocks)
259                        .to(&fshost),
260                )
261                .await
262                .unwrap();
263        }
264
265        builder
266            .add_route(
267                Route::new()
268                    .capability(Capability::dictionary("diagnostics"))
269                    .from(Ref::parent())
270                    .to(&fshost),
271            )
272            .await
273            .unwrap();
274
275        let dtr_exposes = vec![
276            fidl_fuchsia_component_test::Capability::Service(
277                fidl_fuchsia_component_test::Service {
278                    name: Some("fuchsia.hardware.ramdisk.Service".to_owned()),
279                    ..Default::default()
280                },
281            ),
282            fidl_fuchsia_component_test::Capability::Service(
283                fidl_fuchsia_component_test::Service {
284                    name: Some("fuchsia.hardware.block.volume.Service".to_owned()),
285                    ..Default::default()
286                },
287            ),
288        ];
289        builder.driver_test_realm_setup().await.unwrap();
290        builder.driver_test_realm_add_dtr_exposes(&dtr_exposes).await.unwrap();
291        builder
292            .add_route(
293                Route::new()
294                    .capability(Capability::directory("dev-topological").rights(fio::R_STAR_DIR))
295                    .capability(Capability::service::<fvolume::ServiceMarker>())
296                    .from(Ref::child(fuchsia_driver_test::COMPONENT_NAME))
297                    .to(&fshost),
298            )
299            .await
300            .unwrap();
301        builder
302            .add_route(
303                Route::new()
304                    .capability(
305                        Capability::directory("dev-class")
306                            .rights(fio::R_STAR_DIR)
307                            .subdir("block")
308                            .as_("dev-class-block"),
309                    )
310                    .from(Ref::child(fuchsia_driver_test::COMPONENT_NAME))
311                    .to(Ref::parent()),
312            )
313            .await
314            .unwrap();
315
316        let mut fixture = TestFixture {
317            realm: builder.build().await.unwrap(),
318            ramdisks: Vec::new(),
319            main_disk: None,
320            crash_reports,
321            torn_down: TornDown(false),
322        };
323
324        log::info!(
325            realm_name:? = fixture.realm.root.child_name();
326            "built new test realm",
327        );
328
329        fixture
330            .realm
331            .driver_test_realm_start(fdt::RealmArgs {
332                root_driver: Some("fuchsia-boot:///platform-bus#meta/platform-bus.cm".to_owned()),
333                dtr_exposes: Some(dtr_exposes),
334                software_devices: Some(vec![
335                    fdt::SoftwareDevice {
336                        device_name: "ram-disk".to_string(),
337                        device_id: bind_fuchsia_platform::BIND_PLATFORM_DEV_DID_RAM_DISK,
338                    },
339                    fdt::SoftwareDevice {
340                        device_name: "ram-nand".to_string(),
341                        device_id: bind_fuchsia_platform::BIND_PLATFORM_DEV_DID_RAM_NAND,
342                    },
343                ]),
344                ..Default::default()
345            })
346            .await
347            .unwrap();
348
349        // The order of adding disks matters here, unfortunately. fshost should not change behavior
350        // based on the order disks appear, but because we take the first available that matches
351        // whatever relevant criteria, it's useful to test that matchers don't get clogged up by
352        // previous disks.
353        // TODO(https://fxbug.dev/380353856): This type of testing should be irrelevant once the
354        // block devices are determined by configuration options instead of heuristically.
355        for disk in self.extra_disks.into_iter() {
356            fixture.add_disk(disk).await;
357        }
358        if let Some(disk) = self.disk {
359            fixture.add_main_disk(disk).await;
360        }
361
362        fixture
363    }
364}
365
366/// Create a separate struct that does the drop-assert because fixture.tear_down can't call
367/// realm.destroy if it has the drop impl itself.
368struct TornDown(bool);
369
370impl Drop for TornDown {
371    fn drop(&mut self) {
372        // Because tear_down is async, it needs to be called by the test in an async context. It
373        // checks some properties so for correctness it must be called.
374        assert!(self.0, "fixture.tear_down() must be called");
375    }
376}
377
378pub struct TestFixture {
379    pub realm: RealmInstance,
380    pub ramdisks: Vec<RamdiskClient>,
381    pub main_disk: Option<Disk>,
382    pub crash_reports: mpsc::Receiver<ffeedback::CrashReport>,
383    torn_down: TornDown,
384}
385
386impl TestFixture {
387    pub async fn tear_down(mut self) -> Option<Disk> {
388        log::info!(realm_name:? = self.realm.root.child_name(); "tearing down");
389        let disk = self.main_disk.take();
390        // Check the crash reports before destroying the realm because tearing down the realm can
391        // cause mounting errors that trigger a crash report.
392        assert_matches!(self.crash_reports.try_next(), Ok(None) | Err(_));
393        self.realm.destroy().await.unwrap();
394        self.torn_down.0 = true;
395        disk
396    }
397
398    pub fn exposed_dir(&self) -> &fio::DirectoryProxy {
399        self.realm.root.get_exposed_dir()
400    }
401
402    pub fn dir(&self, dir: &str, flags: fio::Flags) -> fio::DirectoryProxy {
403        let (dev, server) = create_proxy::<fio::DirectoryMarker>();
404        let flags = flags | fio::Flags::PROTOCOL_DIRECTORY;
405        self.realm
406            .root
407            .get_exposed_dir()
408            .open(dir, flags, &fio::Options::default(), server.into_channel())
409            .expect("open failed");
410        dev
411    }
412
413    pub async fn check_fs_type(&self, dir: &str, fs_type: u32) {
414        let (status, info) = with_timeout(
415            self.dir(dir, fio::Flags::empty()).query_filesystem(),
416            format!("check_fs_type({dir})"),
417        )
418        .await
419        .expect("query failed");
420        assert_eq!(zx::Status::from_raw(status), zx::Status::OK);
421        assert!(info.is_some());
422        let info_type = info.unwrap().fs_type;
423        assert_eq!(info_type, fs_type, "{:#08x} != {:#08x}", info_type, fs_type);
424    }
425
426    pub async fn check_test_blob(&self) {
427        with_timeout(
428            async {
429                let expected_blob_hash = disk_builder::test_blob_hash();
430                let reader = connect_to_protocol_at_dir_root::<BlobReaderMarker>(
431                    self.realm.root.get_exposed_dir(),
432                )
433                .expect("failed to connect to the BlobReader");
434                let _vmo = reader
435                    .get_vmo(&expected_blob_hash.into())
436                    .await
437                    .expect("blob get_vmo fidl error")
438                    .unwrap_or_else(|e| match zx::Status::from_raw(e) {
439                        zx::Status::NOT_FOUND => panic!("Test blob not found - blobfs lost data!"),
440                        s => panic!("Error while opening test blob vmo: {s}"),
441                    });
442            },
443            "check_test_blob",
444        )
445        .await
446    }
447
448    /// Check for the existence of a well-known set of test files in the data volume. These files
449    /// are placed by the disk builder if it formats the filesystem beforehand.
450    pub async fn check_test_data_file(&self) {
451        with_timeout(
452            async {
453                let (file, server) = create_proxy::<fio::NodeMarker>();
454                self.dir("data", fio::PERM_READABLE)
455                    .open(
456                        ".testdata",
457                        fio::PERM_READABLE,
458                        &fio::Options::default(),
459                        server.into_channel(),
460                    )
461                    .expect("open failed");
462                file.get_attributes(fio::NodeAttributesQuery::empty())
463                    .await
464                    .expect("Fidl transport error on get_attributes()")
465                    .expect("get_attr failed - data was probably deleted!");
466
467                let data = self.dir("data", fio::PERM_READABLE);
468                fuchsia_fs::directory::open_file(&data, ".testdata", fio::PERM_READABLE)
469                    .await
470                    .unwrap();
471
472                fuchsia_fs::directory::open_directory(&data, "ssh", fio::PERM_READABLE)
473                    .await
474                    .unwrap();
475                fuchsia_fs::directory::open_directory(&data, "ssh/config", fio::PERM_READABLE)
476                    .await
477                    .unwrap();
478                fuchsia_fs::directory::open_directory(&data, "problems", fio::PERM_READABLE)
479                    .await
480                    .unwrap();
481
482                let authorized_keys = fuchsia_fs::directory::open_file(
483                    &data,
484                    "ssh/authorized_keys",
485                    fio::PERM_READABLE,
486                )
487                .await
488                .unwrap();
489                assert_eq!(
490                    &fuchsia_fs::file::read_to_string(&authorized_keys).await.unwrap(),
491                    "public key!"
492                );
493            },
494            "check_test_data_file",
495        )
496        .await
497    }
498
499    /// Checks for the absence of the .testdata marker file, indicating the data filesystem was
500    /// reformatted.
501    pub async fn check_test_data_file_absent(&self) {
502        let err = with_timeout(
503            fuchsia_fs::directory::open_file(
504                &self.dir("data", fio::PERM_READABLE),
505                ".testdata",
506                fio::PERM_READABLE,
507            ),
508            "check_test_data_file_absent",
509        )
510        .await
511        .expect_err("open_file failed");
512        assert!(err.is_not_found_error());
513    }
514
515    pub async fn add_main_disk(&mut self, disk: Disk) {
516        assert!(self.main_disk.is_none());
517        let (vmo, type_guid) = disk.into_vmo_and_type_guid().await;
518        let vmo_clone =
519            vmo.create_child(zx::VmoChildOptions::SLICE, 0, vmo.get_size().unwrap()).unwrap();
520
521        self.add_ramdisk(vmo, type_guid).await;
522        self.main_disk = Some(Disk::Prebuilt(vmo_clone, type_guid));
523    }
524
525    pub async fn add_disk(&mut self, disk: Disk) {
526        let (vmo, type_guid) = disk.into_vmo_and_type_guid().await;
527        self.add_ramdisk(vmo, type_guid).await;
528    }
529
530    async fn add_ramdisk(&mut self, vmo: zx::Vmo, type_guid: Option<[u8; 16]>) {
531        let mut ramdisk_builder = RamdiskClientBuilder::new_with_vmo(vmo, Some(512))
532            .publish()
533            .ramdisk_service(self.dir(framdisk::ServiceMarker::SERVICE_NAME, fio::Flags::empty()));
534        if let Some(guid) = type_guid {
535            ramdisk_builder = ramdisk_builder.guid(guid);
536        }
537        let mut ramdisk = pin!(ramdisk_builder.build().fuse());
538
539        let ramdisk = futures::select_biased!(
540            res = ramdisk => res,
541            _ = fasync::Timer::new(Duration::from_secs(120))
542                .fuse() => panic!("Timed out waiting for RamdiskClient"),
543        )
544        .unwrap();
545        self.ramdisks.push(ramdisk);
546    }
547
548    pub fn connect_to_crypt(&self) -> CryptProxy {
549        self.realm
550            .root
551            .connect_to_protocol_at_exposed_dir()
552            .expect("connect_to_protocol_at_exposed_dir failed for the Crypt protocol")
553    }
554
555    pub async fn setup_starnix_crypt(&self) -> (CryptProxy, CryptManagementProxy) {
556        let crypt_management: CryptManagementProxy =
557            self.realm.root.connect_to_protocol_at_exposed_dir().expect(
558                "connect_to_protocol_at_exposed_dir failed for the CryptManagement protocol",
559            );
560        let crypt = self
561            .realm
562            .root
563            .connect_to_protocol_at_exposed_dir()
564            .expect("connect_to_protocol_at_exposed_dir failed for the Crypt protocol");
565        let key = vec![0xABu8; 32];
566        crypt_management
567            .add_wrapping_key(&u128::to_le_bytes(0), key.as_slice())
568            .await
569            .expect("fidl transport error")
570            .expect("add wrapping key failed");
571        crypt_management
572            .add_wrapping_key(&u128::to_le_bytes(1), key.as_slice())
573            .await
574            .expect("fidl transport error")
575            .expect("add wrapping key failed");
576        crypt_management
577            .set_active_key(KeyPurpose::Data, &u128::to_le_bytes(0))
578            .await
579            .expect("fidl transport error")
580            .expect("set metadata key failed");
581        crypt_management
582            .set_active_key(KeyPurpose::Metadata, &u128::to_le_bytes(1))
583            .await
584            .expect("fidl transport error")
585            .expect("set metadata key failed");
586        (crypt, crypt_management)
587    }
588
589    /// This must be called if any crash reports are expected, since spurious reports will cause a
590    /// failure in TestFixture::tear_down.
591    pub async fn wait_for_crash_reports(
592        &mut self,
593        count: usize,
594        expected_program: &'_ str,
595        expected_signature: &'_ str,
596    ) {
597        log::info!("Waiting for {count} crash reports");
598        for _ in 0..count {
599            let report = self.crash_reports.next().await.expect("Sender closed");
600            assert_eq!(report.program_name.as_deref(), Some(expected_program));
601            assert_eq!(report.crash_signature.as_deref(), Some(expected_signature));
602        }
603        if count > 0 {
604            let selector =
605                format!("realm_builder\\:{}/test-fshost:root", self.realm.root.child_name());
606            log::info!("Checking inspect for corruption event, selector={selector}");
607            let tree = ArchiveReader::inspect()
608                .add_selector(selector)
609                .snapshot()
610                .await
611                .unwrap()
612                .into_iter()
613                .next()
614                .and_then(|result| result.payload)
615                .expect("expected one inspect hierarchy");
616
617            let format = || expected_program.to_string();
618            if expected_signature.contains("unseal-error") {
619                assert_data_tree!(tree, root: contains {
620                    keymint_unseal_failure_events: contains {
621                        format() => 1u64,
622                    }
623                });
624            } else {
625                assert_data_tree!(tree, root: contains {
626                    corruption_events: contains {
627                        format() => 1u64,
628                    }
629                });
630            }
631        }
632    }
633
634    // Check that the system partition table contains partitions with labels found in `expected`.
635    pub async fn check_system_partitions(&self, mut expected: Vec<&str>) {
636        with_timeout(
637            async {
638                let partitions =
639                    self.dir(fpartitions::PartitionServiceMarker::SERVICE_NAME, fio::PERM_READABLE);
640                let entries = fuchsia_fs::directory::readdir(&partitions)
641                    .await
642                    .expect("Failed to read partitions");
643
644                assert_eq!(entries.len(), expected.len());
645
646                let mut found_partition_labels = Vec::new();
647                for entry in entries {
648                    let endpoint_name = format!("{}/volume", entry.name);
649                    let volume = connect_to_named_protocol_at_dir_root::<fblock::BlockMarker>(
650                        &partitions,
651                        &endpoint_name,
652                    )
653                    .expect("failed to connect to named protocol at dir root");
654                    let (raw_status, label) =
655                        volume.get_name().await.expect("failed to call get_name");
656                    zx::Status::ok(raw_status).expect("get_name status failed");
657                    found_partition_labels
658                        .push(label.expect("partition label expected to be some value"));
659                }
660                found_partition_labels.sort();
661                expected.sort();
662                assert_eq!(found_partition_labels, expected);
663            },
664            "check_system_partitions",
665        )
666        .await
667    }
668}