about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSparrowLii <liyuan179@huawei.com>2024-02-07 15:26:57 +0800
committerSparrowLii <liyuan179@huawei.com>2024-02-07 15:26:57 +0800
commita59d00674a6b04ba1eaa5e0c3cf00ddb0346296b (patch)
tree6f4f89552727b1b545de8b16290092fcc63e60f3
parentd4f6f9ee6a3b24f2cb97b1a5b82963609b93aa33 (diff)
downloadrust-a59d00674a6b04ba1eaa5e0c3cf00ddb0346296b.tar.gz
rust-a59d00674a6b04ba1eaa5e0c3cf00ddb0346296b.zip
Add parallel rustc ui tests
-rw-r--r--src/tools/tidy/src/ui_tests.rs2
-rw-r--r--tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs16
-rw-r--r--tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr8
-rw-r--r--tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs7
-rw-r--r--tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs22
-rw-r--r--tests/ui/parallel-rustc/hello_world.rs6
-rw-r--r--tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs18
7 files changed, 78 insertions, 1 deletions
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index e7b1ccf6a02..4a44c40debd 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
 const ENTRY_LIMIT: usize = 900;
 // FIXME: The following limits should be reduced eventually.
 const ISSUES_ENTRY_LIMIT: usize = 1819;
-const ROOT_ENTRY_LIMIT: usize = 870;
+const ROOT_ENTRY_LIMIT: usize = 871;
 
 const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
     "rs",     // test source files
diff --git a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs
new file mode 100644
index 00000000000..148a59240f9
--- /dev/null
+++ b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs
@@ -0,0 +1,16 @@
+// compile-flags: -Z threads=16
+// build-fail
+
+#![crate_type="rlib"]
+#![allow(warnings)]
+
+#[export_name="fail"]
+pub fn a() {
+}
+
+#[export_name="fail"]
+pub fn b() {
+//~^ Error symbol `fail` is already defined
+}
+
+fn main() {}
diff --git a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr
new file mode 100644
index 00000000000..7963165e31b
--- /dev/null
+++ b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr
@@ -0,0 +1,8 @@
+error: symbol `fail` is already defined
+  --> $DIR/cache-after-waiting-issue-111528.rs:12:1
+   |
+LL | pub fn b() {
+   | ^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs
new file mode 100644
index 00000000000..8240b249018
--- /dev/null
+++ b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs
@@ -0,0 +1,7 @@
+// compile-flags:-C extra-filename=-1 -Z threads=16
+// no-prefer-dynamic
+// build-pass
+#![crate_name = "crateresolve1"]
+#![crate_type = "lib"]
+
+pub fn f() -> isize { 10 }
diff --git a/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs
new file mode 100644
index 00000000000..691c36cfc9e
--- /dev/null
+++ b/tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Z threads=16
+// build-pass
+
+pub static GLOBAL: isize = 3;
+
+static GLOBAL0: isize = 4;
+
+pub static GLOBAL2: &'static isize = &GLOBAL0;
+
+pub fn verify_same(a: &'static isize) {
+    let a = a as *const isize as usize;
+    let b = &GLOBAL as *const isize as usize;
+    assert_eq!(a, b);
+}
+
+pub fn verify_same2(a: &'static isize) {
+    let a = a as *const isize as usize;
+    let b = GLOBAL2 as *const isize as usize;
+    assert_eq!(a, b);
+}
+
+fn main() {}
diff --git a/tests/ui/parallel-rustc/hello_world.rs b/tests/ui/parallel-rustc/hello_world.rs
new file mode 100644
index 00000000000..53e95c890ef
--- /dev/null
+++ b/tests/ui/parallel-rustc/hello_world.rs
@@ -0,0 +1,6 @@
+// compile-flags: -Z threads=8
+// run-pass
+
+fn main() {
+    println!("Hello world!");
+}
diff --git a/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs b/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs
new file mode 100644
index 00000000000..1907348cf09
--- /dev/null
+++ b/tests/ui/parallel-rustc/read-stolen-value-issue-111520.rs
@@ -0,0 +1,18 @@
+// compile-flags: -Z threads=16
+// run-pass
+
+#[repr(transparent)]
+struct Sched {
+    i: i32,
+}
+impl Sched {
+    extern "C" fn get(self) -> i32 { self.i }
+}
+
+fn main() {
+    let s = Sched { i: 4 };
+    let f = || -> i32 {
+        s.get()
+    };
+    println!("f: {}", f());
+}