Skip to content

Commit 4bf26df

Browse files
committed
More host/target path conversion tests:
- test that the tmpdir Miri tests see is absolute and a directory - test that current_dir returns an absolute path
1 parent d267f7f commit 4bf26df

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tests/pass/shims/env/current_dir.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use std::env;
33
use std::io::ErrorKind;
44

55
fn main() {
6-
// Test that `getcwd` is available
6+
// Test that `getcwd` is available and an absolute path
77
let cwd = env::current_dir().unwrap();
8+
assert!(cwd.is_absolute(), "cwd {:?} is not absolute", cwd);
89
// Test that changing dir to `..` actually sets the current directory to the parent of `cwd`.
910
// The only exception here is if `cwd` is the root directory, then changing directory must
1011
// keep the current directory equal to `cwd`.

tests/pass/shims/fs.rs

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828
test_directory();
2929
test_canonicalize();
3030
test_from_raw_os_error();
31+
test_path_conversion();
3132
}
3233

3334
fn tmp() -> PathBuf {
@@ -74,6 +75,12 @@ fn prepare_with_content(filename: &str, content: &[u8]) -> PathBuf {
7475
path
7576
}
7677

78+
fn test_path_conversion() {
79+
let tmp = tmp();
80+
assert!(tmp.is_absolute(), "{:?} is not absolute", tmp);
81+
assert!(tmp.is_dir(), "{:?} is not a directory", tmp);
82+
}
83+
7784
fn test_file() {
7885
let bytes = b"Hello, World!\n";
7986
let path = prepare("miri_test_fs_file.txt");

0 commit comments

Comments
 (0)