mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
base: enable WriteZeroes tests on wine
Replace the File::set_len() call with a normal write to set the initial file size. Wine does not support the SetFileInformationByHandle features that set_len() needs: 0009:fixme:file:SetFileInformationByHandle 0000000000000078, 6, 00000000002ED970, 8 BUG=None TEST=tools/dev_container tools/run_tests --target=host --arch=win64 Change-Id: Ib63cef7fd909d8f8a2163f6fe8a27ad8a2e27e76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626024 Reviewed-by: Noah Gold <nkgold@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
eaac8ba442
commit
b12dcb5405
1 changed files with 10 additions and 4 deletions
|
@ -69,7 +69,6 @@ mod tests {
|
|||
};
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[cfg_attr(all(target_os = "windows", target_env = "gnu"), ignore)]
|
||||
#[test]
|
||||
fn simple_test() {
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
|
@ -81,7 +80,11 @@ mod tests {
|
|||
.create(true)
|
||||
.open(&path)
|
||||
.unwrap();
|
||||
f.set_len(16384).unwrap();
|
||||
|
||||
// Extend and fill the file with zero bytes.
|
||||
// This is not using set_len() because that fails on wine.
|
||||
let init_data = [0x00u8; 16384];
|
||||
f.write_all(&init_data).unwrap();
|
||||
|
||||
// Write buffer of non-zero bytes to offset 1234
|
||||
let orig_data = [0x55u8; 5678];
|
||||
|
@ -135,7 +138,6 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(all(target_os = "windows", target_env = "gnu"), ignore)]
|
||||
fn large_write_zeroes() {
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
let mut path = tempdir.path().to_owned();
|
||||
|
@ -146,7 +148,11 @@ mod tests {
|
|||
.create(true)
|
||||
.open(&path)
|
||||
.unwrap();
|
||||
f.set_len(16384).unwrap();
|
||||
|
||||
// Extend and fill the file with zero bytes.
|
||||
// This is not using set_len() because that fails on wine.
|
||||
let init_data = [0x00u8; 16384];
|
||||
f.write_all(&init_data).unwrap();
|
||||
|
||||
// Write buffer of non-zero bytes
|
||||
let orig_data = [0x55u8; 0x20000];
|
||||
|
|
Loading…
Reference in a new issue