diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/device.rs | 39 | 
1 files changed, 39 insertions, 0 deletions
| diff --git a/tests/device.rs b/tests/device.rs index 7296372..a88c956 100644 --- a/tests/device.rs +++ b/tests/device.rs @@ -653,6 +653,45 @@ fn get_operation_status(device: Storage) {  }  #[test_device] +#[ignore] +fn fill_sd_card(device: Storage) { +    // This test takes up to 60 min to execute and is therefore ignored by default.  Use `cargo +    // test -- --ignored fill_sd_card` to run the test. + +    let mut device = device; +    assert_ok!((), device.factory_reset(DEFAULT_ADMIN_PIN)); +    thread::sleep(time::Duration::from_secs(3)); +    assert_ok!((), device.build_aes_key(DEFAULT_ADMIN_PIN)); + +    let status = unwrap_ok!(device.get_storage_status()); +    assert!(!status.filled_with_random); + +    assert_ok!((), device.fill_sd_card(DEFAULT_ADMIN_PIN)); +    assert_cmd_err!(CommandError::WrongCrc, device.get_status()); + +    let mut status = OperationStatus::Ongoing(0); +    let mut last_progress = 0u8; +    while status != OperationStatus::Idle { +        status = unwrap_ok!(device.get_operation_status()); +        if let OperationStatus::Ongoing(progress) = status { +            assert!(progress <= 100, "progress = {}", progress); +            assert!( +                progress >= last_progress, +                "progress = {}, last_progress = {}", +                progress, +                last_progress +            ); +            last_progress = progress; + +            thread::sleep(time::Duration::from_secs(10)); +        } +    } + +    let status = unwrap_ok!(device.get_storage_status()); +    assert!(status.filled_with_random); +} + +#[test_device]  fn export_firmware(device: Storage) {      let mut device = device;      assert_cmd_err!( | 
