1 ///! This crate exists to build crates for wasm32-wasi in build.rs, and execute 2 ///! these wasm programs in harnesses defined under tests/. 3 4 #[cfg(all(feature = "test_programs", not(skip_wasi_http_tests)))] 5 pub mod http_server; 6 7 /// The wasi-tests binaries use these environment variables to determine their 8 /// expected behavior. 9 /// Used by all of the tests/ which execute the wasi-tests binaries. 10 pub fn wasi_tests_environment() -> &'static [(&'static str, &'static str)] { 11 #[cfg(windows)] 12 { 13 &[ 14 ("ERRNO_MODE_WINDOWS", "1"), 15 // Windows does not support dangling links or symlinks in the filesystem. 16 ("NO_DANGLING_FILESYSTEM", "1"), 17 // Windows does not support renaming a directory to an empty directory - 18 // empty directory must be deleted. 19 ("NO_RENAME_DIR_TO_EMPTY_DIR", "1"), 20 // cap-std-sync does not support the sync family of fdflags 21 ("NO_FDFLAGS_SYNC_SUPPORT", "1"), 22 ] 23 } 24 #[cfg(all(unix, not(target_os = "macos")))] 25 { 26 &[ 27 ("ERRNO_MODE_UNIX", "1"), 28 // cap-std-sync does not support the sync family of fdflags 29 ("NO_FDFLAGS_SYNC_SUPPORT", "1"), 30 ] 31 } 32 #[cfg(target_os = "macos")] 33 { 34 &[ 35 ("ERRNO_MODE_MACOS", "1"), 36 // cap-std-sync does not support the sync family of fdflags 37 ("NO_FDFLAGS_SYNC_SUPPORT", "1"), 38 ] 39 } 40 } 41 42 pub fn stdio_is_terminal() -> bool { 43 use is_terminal::is_terminal; 44 is_terminal(&std::io::stdin()) 45 && is_terminal(&std::io::stdout()) 46 && is_terminal(&std::io::stderr()) 47 } 48