]> git.lizzy.rs Git - rust.git/commitdiff
Merge `fs` and `fs_libc` tests
authorAaron Hill <aa1ronham@gmail.com>
Sat, 3 Oct 2020 16:56:32 +0000 (12:56 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Sun, 4 Oct 2020 16:06:51 +0000 (12:06 -0400)
tests/run-pass/fs.rs
tests/run-pass/fs.stderr [new file with mode: 0644]
tests/run-pass/fs.stdout [new file with mode: 0644]
tests/run-pass/fs_libc.rs [deleted file]
tests/run-pass/fs_libc.stderr [deleted file]
tests/run-pass/fs_libc.stdout [deleted file]

index 8f750847b203b1dcd3af47a92c0dbdc3fd2e5bd3..ca3c6a6d29171b15a4ada6d9e70ae0436d5c677b 100644 (file)
@@ -25,6 +25,7 @@ fn main() {
     test_errors();
     test_rename();
     test_directory();
+    test_dup_stdout_stderr();
 }
 
 fn tmp() -> PathBuf {
@@ -335,3 +336,13 @@ fn test_directory() {
     // Reading the metadata of a non-existent directory should fail with a "not found" error.
     assert_eq!(ErrorKind::NotFound, check_metadata(&[], &dir_path).unwrap_err().kind());
 }
+
+fn test_dup_stdout_stderr() {
+    let bytes = b"hello dup fd\n";
+    unsafe {
+        let new_stdout = libc::fcntl(1, libc::F_DUPFD, 0);
+        let new_stderr = libc::fcntl(2, libc::F_DUPFD, 0);
+        libc::write(new_stdout, bytes.as_ptr() as *const libc::c_void, bytes.len());
+        libc::write(new_stderr, bytes.as_ptr() as *const libc::c_void, bytes.len());
+    }
+}
diff --git a/tests/run-pass/fs.stderr b/tests/run-pass/fs.stderr
new file mode 100644 (file)
index 0000000..b6fa69e
--- /dev/null
@@ -0,0 +1 @@
+hello dup fd
diff --git a/tests/run-pass/fs.stdout b/tests/run-pass/fs.stdout
new file mode 100644 (file)
index 0000000..b6fa69e
--- /dev/null
@@ -0,0 +1 @@
+hello dup fd
diff --git a/tests/run-pass/fs_libc.rs b/tests/run-pass/fs_libc.rs
deleted file mode 100644 (file)
index e3deb7a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// ignore-windows
-// compile-flags: -Zmiri-disable-isolation
-
-#![feature(rustc_private)]
-
-extern crate libc;
-
-fn main() {
-    dup_stdout_stderr_test();
-}
-
-fn dup_stdout_stderr_test() {
-    let bytes = b"hello dup fd\n";
-    unsafe {
-        let new_stdout = libc::fcntl(1, libc::F_DUPFD, 0);
-        let new_stderr = libc::fcntl(2, libc::F_DUPFD, 0);
-        libc::write(new_stdout, bytes.as_ptr() as *const libc::c_void, bytes.len());
-        libc::write(new_stderr, bytes.as_ptr() as *const libc::c_void, bytes.len());
-    }
-}
diff --git a/tests/run-pass/fs_libc.stderr b/tests/run-pass/fs_libc.stderr
deleted file mode 100644 (file)
index b6fa69e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-hello dup fd
diff --git a/tests/run-pass/fs_libc.stdout b/tests/run-pass/fs_libc.stdout
deleted file mode 100644 (file)
index b6fa69e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-hello dup fd