fd_allocate: put meat of test behind a guard
use more_asserts::assert_gt;
use std::{env, process};
-use wasi_tests::open_scratch_directory;
+use wasi_tests::{open_scratch_directory, TESTCONFIG};
unsafe fn test_file_allocate(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
@@ -27,6 +27,7 @@ unsafe fn test_file_allocate(dir_fd: wasi::Fd) {
let mut stat = wasi::fd_filestat_get(file_fd).expect("reading file stats");
assert_eq!(stat.size, 0, "file size should be 0");
+ if TESTCONFIG.support_fd_allocate() {
// Allocate some size
wasi::fd_allocate(file_fd, 0, 100).expect("allocating size");
stat = wasi::fd_filestat_get(file_fd).expect("reading file stats");
@@ -41,7 +42,7 @@ unsafe fn test_file_allocate(dir_fd: wasi::Fd) {
wasi::fd_allocate(file_fd, 90, 20).expect("allocating size larger than current size");
stat = wasi::fd_filestat_get(file_fd).expect("reading file stats");
assert_eq!(stat.size, 110, "file size should increase from 100 to 110");
-
+ }
wasi::fd_close(file_fd).expect("closing a file");
wasi::path_unlink_file(dir_fd, "file").expect("removing a file");
}
