Skip to content

Several tests fail with --disable-jemalloc #35017

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
cuviper opened this issue Jul 24, 2016 · 5 comments
Closed

Several tests fail with --disable-jemalloc #35017

cuviper opened this issue Jul 24, 2016 · 5 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.

Comments

@cuviper
Copy link
Member

cuviper commented Jul 24, 2016

I currently can't run a full make check when using --disable-jemalloc, because there are a few tests that assume they have multiple allocators to play with. Those I found were:

  • src/test/compile-fail/allocator-dylib-is-system.rs
  • src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs
  • src/test/run-pass/allocator-default.rs

All three of these are at least conditional on target_os = "linux" or "macos", but having linux without jemalloc gets a quick failure.

@tbg
Copy link
Contributor

tbg commented Mar 12, 2017

Just tried this (with use-jemalloc=false) on OSX, (still) same, unsurprising results.

error[E0463]: can't find crate for `alloc_jemalloc`
  --> /Users/tschottdorf/rust/rust/src/test/compile-fail/allocator-dylib-is-system.rs:35:1
   |
35 | extern crate alloc_jemalloc;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
./x.py test src/test/compile-fail --test-args alloc
running 9 tests
test [compile-fail] compile-fail/feature-gate-allocator.rs ... ok
test [compile-fail] compile-fail/feature-gate-needs-allocator.rs ... ok
test [compile-fail] compile-fail/regions-return-stack-allocated-vec.rs ... ok
test [compile-fail] compile-fail/allocator-depends-on-needs-allocators.rs ... ok
test [compile-fail] compile-fail/two-allocators-3.rs ... ok
test [compile-fail] compile-fail/allocator-dylib-is-system.rs ... FAILED
test [compile-fail] compile-fail/two-allocators-2.rs ... ok
test [compile-fail] compile-fail/allocator-rust-dylib-is-jemalloc.rs ... FAILED
test [compile-fail] compile-fail/two-allocators.rs ... ok

@tbg
Copy link
Contributor

tbg commented Mar 13, 2017

One way out would be to extend error-pattern to provide multiple alternatives
such as

// error-pattern: cannot link two allocators|can't find crate for
`alloc_jemalloc`

Another option is being able to detect whether jemalloc is available somehow
at compile time, so that the failing tests would be changed to use something
like

#[cfg(has_jemalloc)]<Paste>

Also curious why there isn't a non-jemalloc build that exercises these failing
tests.

The first option is easy to implement, but just for this?

diff --git a/src/test/compile-fail/allocator-dylib-is-system.rs b/src/test/compile-fail/allocator-dylib-is-system.rs
index 4c576de..1a48ccd 100644
--- a/src/test/compile-fail/allocator-dylib-is-system.rs
+++ b/src/test/compile-fail/allocator-dylib-is-system.rs
@@ -12,7 +12,7 @@
 // aux-build:allocator-dylib.rs
 // aux-build:allocator1.rs
 // no-prefer-dynamic
-// error-pattern: cannot link together two allocators
+// error-pattern: cannot link together two allocators|can't find crate for `alloc_jemalloc`

 // Verify that the allocator for statically linked dynamic libraries is the
 // system allocator. Do this by linking in jemalloc and making sure that we get
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 1ec0838..e7e8f53 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -987,20 +987,23 @@ actual:\n\
         }
         let mut next_err_idx = 0;
         let mut next_err_pat = self.props.error_patterns[next_err_idx].trim();
-        let mut done = false;
+        let mut next_or_pats: Vec<&str> = next_err_pat.split('|').collect();
+
         for line in output_to_check.lines() {
-            if line.contains(next_err_pat) {
-                debug!("found error pattern {}", next_err_pat);
-                next_err_idx += 1;
-                if next_err_idx == self.props.error_patterns.len() {
-                    debug!("found all error patterns");
-                    done = true;
+            for pat in next_or_pats.clone().iter() {
+                if line.contains(pat) {
+                    debug!("found error pattern {}", next_err_pat);
+                    next_err_idx += 1;
+                    if next_err_idx == self.props.error_patterns.len() {
+                        debug!("found all error patterns");
+                        return;
+                    }
+                    next_err_pat = self.props.error_patterns[next_err_idx].trim();
+                    next_or_pats = next_err_pat.split('|').collect();
                     break;
                 }
-                next_err_pat = self.props.error_patterns[next_err_idx].trim();
             }
         }
-        if done { return; }

         let missing_patterns = &self.props.error_patterns[next_err_idx..];
         if missing_patterns.len() == 1 {

@Mark-Simulacrum Mark-Simulacrum added the A-testsuite Area: The testsuite used to check the correctness of rustc label Jun 12, 2017
@alexcrichton
Copy link
Member

This is highly likely to be fixed as part of #42313, not tested though.

@cuviper
Copy link
Member Author

cuviper commented Jun 20, 2017

Those 3 tests still fail for me with --disable-jemalloc.

@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 25, 2017
@cuviper
Copy link
Member Author

cuviper commented Sep 12, 2017

The allocator tests are now different, but they all pass even with --disable-jemalloc:

Check compiletest suite=run-pass mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 4 tests
test [run-pass] run-pass/allocator-alloc-one.rs ... ok
test [run-pass] run-pass/allocator/custom.rs ... ok
test [run-pass] run-pass/allocator/xcrate-use.rs ... ok
test [run-pass] run-pass/allocator/xcrate-use2.rs ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 2752 filtered out

        finished in 0.614
Check compiletest suite=compile-fail mode=compile-fail (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 8 tests
test [compile-fail] compile-fail/feature-gate-needs-allocator.rs ... ok
test [compile-fail] compile-fail/feature-gate-global_allocator.rs ... ok
test [compile-fail] compile-fail/allocator/function-allocator.rs ... ok
test [compile-fail] compile-fail/feature-gate-allocator_internals.rs ... ok
test [compile-fail] compile-fail/allocator/two-allocators.rs ... ok
test [compile-fail] compile-fail/allocator/not-an-allocator.rs ... ok
test [compile-fail] compile-fail/allocator/two-allocators2.rs ... ok
test [compile-fail] compile-fail/allocator/two-allocators3.rs ... ok

test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 2741 filtered out

@cuviper cuviper closed this as completed Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants