[tests] Use IntoIterator on the array argument (requires Rust 1.53)
This commit is contained in:
		@@ -63,7 +63,7 @@ where
 | 
				
			|||||||
    P: InputProgram<'a>,
 | 
					    P: InputProgram<'a>,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    let args: [&str; 0] = [];
 | 
					    let args: [&str; 0] = [];
 | 
				
			||||||
    let stderr = run_fail(P::path(), &args)?;
 | 
					    let stderr = run_fail(P::path(), args)?;
 | 
				
			||||||
    assert!(stderr.contains(P::missing_input_arg()));
 | 
					    assert!(stderr.contains(P::missing_input_arg()));
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -85,8 +85,7 @@ where
 | 
				
			|||||||
    let mut td = TestDir::new()?;
 | 
					    let mut td = TestDir::new()?;
 | 
				
			||||||
    let output = mk_zeroed_md(&mut td)?;
 | 
					    let output = mk_zeroed_md(&mut td)?;
 | 
				
			||||||
    ensure_untouched(&output, || {
 | 
					    ensure_untouched(&output, || {
 | 
				
			||||||
        let args = args!["-o", &output];
 | 
					        let stderr = run_fail(P::path(), args!["-o", &output])?;
 | 
				
			||||||
        let stderr = run_fail(P::path(), &args)?;
 | 
					 | 
				
			||||||
        assert!(stderr.contains(P::missing_input_arg()));
 | 
					        assert!(stderr.contains(P::missing_input_arg()));
 | 
				
			||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,8 +28,7 @@ pub fn mk_valid_md(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			|||||||
    write_xml(&xml, &mut gen)?;
 | 
					    write_xml(&xml, &mut gen)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let _file = file_utils::create_sized_file(&md, 4096 * 4096);
 | 
					    let _file = file_utils::create_sized_file(&md, 4096 * 4096);
 | 
				
			||||||
    let args = args!["-i", &xml, "-o", &md];
 | 
					    run_ok(THIN_RESTORE, args!["-i", &xml, "-o", &md])?;
 | 
				
			||||||
    run_ok(THIN_RESTORE, &args)?;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ok(md)
 | 
					    Ok(md)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -40,11 +39,11 @@ pub fn mk_valid_md(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			|||||||
pub fn prep_metadata(td: &mut TestDir) -> Result<PathBuf> {
 | 
					pub fn prep_metadata(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			||||||
    let md = mk_zeroed_md(td)?;
 | 
					    let md = mk_zeroed_md(td)?;
 | 
				
			||||||
    let args = args!["-o", &md, "--format", "--nr-data-blocks", "102400"];
 | 
					    let args = args!["-o", &md, "--format", "--nr-data-blocks", "102400"];
 | 
				
			||||||
    run_ok(THIN_GENERATE_METADATA, &args)?;
 | 
					    run_ok(THIN_GENERATE_METADATA, args)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Create a 2GB device
 | 
					    // Create a 2GB device
 | 
				
			||||||
    let args = args!["-o", &md, "--create-thin", "1"];
 | 
					    let args = args!["-o", &md, "--create-thin", "1"];
 | 
				
			||||||
    run_ok(THIN_GENERATE_METADATA, &args)?;
 | 
					    run_ok(THIN_GENERATE_METADATA, args)?;
 | 
				
			||||||
    let args = args![
 | 
					    let args = args![
 | 
				
			||||||
        "-o",
 | 
					        "-o",
 | 
				
			||||||
        &md,
 | 
					        &md,
 | 
				
			||||||
@@ -55,7 +54,7 @@ pub fn prep_metadata(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			|||||||
        "--rw=randwrite",
 | 
					        "--rw=randwrite",
 | 
				
			||||||
        "--seq-nr=16"
 | 
					        "--seq-nr=16"
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
    run_ok(THIN_GENERATE_MAPPINGS, &args)?;
 | 
					    run_ok(THIN_GENERATE_MAPPINGS, args)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Take a few snapshots.
 | 
					    // Take a few snapshots.
 | 
				
			||||||
    let mut snap_id = 2;
 | 
					    let mut snap_id = 2;
 | 
				
			||||||
@@ -63,7 +62,7 @@ pub fn prep_metadata(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			|||||||
        // take a snapshot
 | 
					        // take a snapshot
 | 
				
			||||||
        let snap_id_str = snap_id.to_string();
 | 
					        let snap_id_str = snap_id.to_string();
 | 
				
			||||||
        let args = args!["-o", &md, "--create-snap", &snap_id_str, "--origin", "1"];
 | 
					        let args = args!["-o", &md, "--create-snap", &snap_id_str, "--origin", "1"];
 | 
				
			||||||
        run_ok(THIN_GENERATE_METADATA, &args)?;
 | 
					        run_ok(THIN_GENERATE_METADATA, args)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // partially overwrite the origin (64MB)
 | 
					        // partially overwrite the origin (64MB)
 | 
				
			||||||
        let args = args![
 | 
					        let args = args![
 | 
				
			||||||
@@ -78,7 +77,7 @@ pub fn prep_metadata(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			|||||||
            "--rw=randwrite",
 | 
					            "--rw=randwrite",
 | 
				
			||||||
            "--seq-nr=16"
 | 
					            "--seq-nr=16"
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
        run_ok(THIN_GENERATE_MAPPINGS, &args)?;
 | 
					        run_ok(THIN_GENERATE_MAPPINGS, args)?;
 | 
				
			||||||
        snap_id += 1;
 | 
					        snap_id += 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -87,7 +86,7 @@ pub fn prep_metadata(td: &mut TestDir) -> Result<PathBuf> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
pub fn set_needs_check(md: &PathBuf) -> Result<()> {
 | 
					pub fn set_needs_check(md: &PathBuf) -> Result<()> {
 | 
				
			||||||
    let args = args!["-o", &md, "--set-needs-check"];
 | 
					    let args = args!["-o", &md, "--set-needs-check"];
 | 
				
			||||||
    run_ok(THIN_GENERATE_METADATA, &args)?;
 | 
					    run_ok(THIN_GENERATE_METADATA, args)?;
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -111,7 +110,7 @@ pub fn generate_metadata_leaks(
 | 
				
			|||||||
        "--actual",
 | 
					        "--actual",
 | 
				
			||||||
        &actual_str
 | 
					        &actual_str
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
    run_ok(THIN_GENERATE_DAMAGE, &args)?;
 | 
					    run_ok(THIN_GENERATE_DAMAGE, args)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user