Skip to content

Parallel tests fail in workspace project #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
taqtiqa-mark opened this issue Mar 28, 2022 · 3 comments
Closed

Parallel tests fail in workspace project #71

taqtiqa-mark opened this issue Mar 28, 2022 · 3 comments

Comments

@taqtiqa-mark
Copy link

taqtiqa-mark commented Mar 28, 2022

Thank you for the effort you have put into making macrotest, and for making it open source.

I ran into this issue in the course of trying to isolate what appears to be unexpected behavior.

PR #72 proposes to add a workspace project example, and this error can be observed by checking out the first commit in the PR.

cd workspace-project
cargo test -- --nocapture

Should show these two results for parallel_1 and parallel_2 test cases:

tests/expand/second.rs - different!
Diff [lines: 6 added, 1 removed]:
--------------------------
 #[macro_use]
 extern crate test_project;
 pub fn main() {
+    {
+        let mut temp_vec = Vec::new();
+        temp_vec.push(1);
+        temp_vec
+    };
-    ();
 }
+
--------------------------



thread 'parallel_2' panicked at '1 of 1 tests failed', /home/user/src/macrotest/src/expand.rs:171:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test parallel_2 ... FAILED
tests/expand/first.rs - different!
Diff [lines: 2 added, 1 removed]:
--------------------------
 #[macro_use]
 extern crate test_project;
 pub fn main() {
+    Vec::new();
-    ();
 }
+
--------------------------



thread 'parallel_1' panicked at '1 of 1 tests failed', /home/user/src/macrotest/src/expand.rs:171:9
test parallel_1 ... FAILED

failures:

failures:
    parallel_1
    parallel_2
taqtiqa-mark added a commit to taqtiqa-mark/macrotest that referenced this issue Mar 28, 2022
This initial commit contains the state of play immediately after
add the example crates:

- test-project
- test-procmacro-project

Other than setting up the workspace references no changes
to the example crates have been made.

The integration test harness has not yet been implemented.

Signed-off-by: Mark Van de Vyver <[email protected]>
@taqtiqa-mark
Copy link
Author

taqtiqa-mark commented Mar 28, 2022

Workaround for the test-project:

cargo test -- --test-threads=1

However, this does not workaround the issue in the test-virtual.

taqtiqa-mark added a commit to taqtiqa-mark/macrotest that referenced this issue Mar 10, 2024
This initial commit contains the state of play immediately after
add the example crates:

- test-project
- test-procmacro-project

Other than setting up the workspace references no changes
to the example crates have been made.

The integration test harness has not yet been implemented.

Signed-off-by: Mark Van de Vyver <[email protected]>
@ijackson
Copy link
Contributor

This may be tangentially related to #83/#84. I don't think #84 will fix it but perhaps better choice of subdirectory name would.

@taiki-e
Copy link
Collaborator

taiki-e commented Mar 30, 2024

tests/expand/second.rs - different!
Diff [lines: 6 added, 1 removed]:
--------------------------
 #[macro_use]
 extern crate test_project;
 pub fn main() {
+    {
+        let mut temp_vec = Vec::new();
+        temp_vec.push(1);
+        temp_vec
+    };
-    ();
 }
+
--------------------------

This is due to the crate that defining macro is "wrkspc-test" but you are importing extern crate test_project;.
Changing extern crate test_project; to extern crate wrkspc_test; would give the correct result.

Closing as this doesn't seem to macrotest bug.

@taiki-e taiki-e closed this as completed Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants