Skip to content

Commit 8716843

Browse files
committed
std: fix run tests when symlink is in the rust checkout path
1 parent 44af506 commit 8716843

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/libstd/run.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,28 +1100,34 @@ mod tests {
11001100
11011101
#[test]
11021102
fn test_keep_current_working_dir() {
1103-
11041103
let mut prog = run_pwd(None);
11051104
11061105
let output = str::from_bytes(prog.finish_with_output().output);
11071106
let parent_dir = os::getcwd().normalize();
11081107
let child_dir = Path(output.trim()).normalize();
11091108
1110-
assert_eq!(child_dir.to_str(), parent_dir.to_str());
1109+
let parent_stat = parent_dir.stat().unwrap();
1110+
let child_stat = child_dir.stat().unwrap();
1111+
1112+
assert_eq!(parent_stat.st_dev, child_stat.st_dev);
1113+
assert_eq!(parent_stat.st_ino, child_stat.st_ino);
11111114
}
11121115
11131116
#[test]
11141117
fn test_change_working_directory() {
1115-
11161118
// test changing to the parent of os::getcwd() because we know
11171119
// the path exists (and os::getcwd() is not expected to be root)
1118-
let parent_path = os::getcwd().dir_path().normalize();
1119-
let mut prog = run_pwd(Some(&parent_path));
1120+
let parent_dir = os::getcwd().dir_path().normalize();
1121+
let mut prog = run_pwd(Some(&parent_dir));
11201122
11211123
let output = str::from_bytes(prog.finish_with_output().output);
11221124
let child_dir = Path(output.trim()).normalize();
11231125
1124-
assert_eq!(child_dir.to_str(), parent_path.to_str());
1126+
let parent_stat = parent_dir.stat().unwrap();
1127+
let child_stat = child_dir.stat().unwrap();
1128+
1129+
assert_eq!(parent_stat.st_dev, child_stat.st_dev);
1130+
assert_eq!(parent_stat.st_ino, child_stat.st_ino);
11251131
}
11261132
11271133
#[cfg(unix)]

0 commit comments

Comments
 (0)