Skip to content
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

master is broken on Travis CI #1137

Closed
frewsxcv opened this issue Dec 24, 2018 · 8 comments
Closed

master is broken on Travis CI #1137

frewsxcv opened this issue Dec 24, 2018 · 8 comments

Comments

@frewsxcv
Copy link
Member

All builds are failing on master, not sure why though...

https://travis-ci.org/rust-lang/rust-by-example/builds/471278832

running 1 test
test /tmp/mdbook-gtxyjb/attribute/crate.md - Crates (line 12) ... FAILED
failures:
---- /tmp/mdbook-gtxyjb/attribute/crate.md - Crates (line 12) stdout ----
thread '/tmp/mdbook-gtxyjb/attribute/crate.md - Crates (line 12)' panicked at 'couldn't run the test: No such file or directory (os error 2)', src/librustdoc/test.rs:353:19
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
failures:
    /tmp/mdbook-gtxyjb/attribute/crate.md - Crates (line 12)
@frewsxcv
Copy link
Member Author

@ghost
Copy link

ghost commented Jan 3, 2019

2019-01-03 12:06:31 [ERROR] (mdbook::utils): Error: Rustdoc returned an error: 
running 1 test
test /tmp/mdbook-XeqJW3/attribute/crate.md - Crates (line 12) ... FAILED

failures:

---- /tmp/mdbook-XeqJW3/attribute/crate.md - Crates (line 12) stdout ----
thread '/tmp/mdbook-XeqJW3/attribute/crate.md - Crates (line 12)' panicked at 'couldn't run the test: No such file or directory (os error 2)', src/librustdoc/test.rs:343:19
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: std::panicking::begin_panic_fmt
   8: rustdoc::test::run_test
   9: <scoped_tls::ScopedKey<T>>::set
  10: syntax::with_globals
query stack during panic:
end of query stack


failures:
    /tmp/mdbook-XeqJW3/attribute/crate.md - Crates (line 12)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

that looks like an error similar to this one: lukaslueg/built#14
whereby the error is bubbled up and the name of the file, since not included in the error, is lost.

@ghost
Copy link

ghost commented Jan 3, 2019

ok, here's what I found out so far, every other test that doesn't fail is an executable like /tmp/rustdoctestJ8T4Sd/rust_out (where J8T4Sd is random for each test) that rustdoc tries to execute, but fails for the failing test from OP because that rust_out doesn't exist, instead there's a rary executable that maybe it(rustdoc?) should be executing instead.

the rary thing seems to be due to:

// The library is named "rary"
#![crate_name = "rary"]
/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust-by-example 
$ time RUST_BACKTRACE=1 mdbook test 
...
2019-01-03 13:27:11 [INFO] (mdbook::book): Testing file: "/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust-by-example/src/attribute/unused.md"
2019-01-03 13:27:12 [INFO] (mdbook::book): Testing file: "/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust-by-example/src/attribute/crate.md"
2019-01-03 13:27:13 [ERROR] (mdbook::utils): Error: Rustdoc returned an error: 
running 1 test
test /tmp/mdbook-7x24cV/attribute/crate.md - Crates (line 12) ... FAILED

failures:

---- /tmp/mdbook-7x24cV/attribute/crate.md - Crates (line 12) stdout ----
!! "/tmp/rustdoctestJ8T4Sd/rust_out"
!! exitcode: !exit code: 1!
!! stdout: !!
!! stderr: !/usr/bin/cp: cannot stat '/tmp/rustdoctestJ8T4Sd/rust_out': No such file or directory
!
!! exitcode: !exit code: 0!
!! stdout: !total 372
drwxr-xr-x  2 xftroxgpx xftroxgpx     60 Jan  3 13:27 .
drwxrwxrwt 30 root      root        1200 Jan  3 13:27 ..
-rwxr-xr-x  1 xftroxgpx xftroxgpx 380272 Jan  3 13:27 rary
!
!! stderr: !!
thread '/tmp/mdbook-7x24cV/attribute/crate.md - Crates (line 12)' panicked at 'couldn't run the test: No such file or directory (os error 2)', src/librustdoc/test.rs:367:19
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: std::panicking::begin_panic_fmt
   8: rustdoc::test::run_test
   9: <scoped_tls::ScopedKey<T>>::set
  10: syntax::with_globals
query stack during panic:
end of query stack


failures:
    /tmp/mdbook-7x24cV/attribute/crate.md - Crates (line 12)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out



real	1m8.184s
user	0m56.835s
sys	0m7.165s
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 24bb00f411..3031b5cfa5 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -329,7 +329,8 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
     // environment to ensure that the target loads the right libraries at
     // runtime. It would be a sad day if the *host* libraries were loaded as a
     // mistake.
-    let mut cmd = Command::new(&outdir.lock().unwrap().path().join("rust_out"));
+    let shie=&outdir.lock().unwrap().path().join("rust_out");
+    let mut cmd = Command::new(shie);
     let var = DynamicLibrary::envvar();
     let newpath = {
         let path = env::var_os(var).unwrap_or(OsString::new());
@@ -338,6 +339,29 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
         env::join_paths(path).unwrap()
     };
     cmd.env(var, &newpath);
+    eprintln!("!! {:?}", shie);//cmd works but it's double quoted!
+    let blah=Command::new("/usr/bin/cp")
+            .arg("-af")
+            .arg(shie)
+            .arg("/tmp/ahaaaaa")
+            .output()
+            .expect("failed to execute process");
+//    eprintln!("!! !{}!",String::from_utf8_lossy(&blah));
+    eprintln!("!! exitcode: !{}!",blah.status);
+    eprintln!("!! stdout: !{}!",String::from_utf8_lossy(&blah.stdout));
+    eprintln!("!! stderr: !{}!",String::from_utf8_lossy(&blah.stderr));
+    let blah=Command::new("/usr/bin/dirname")
+        .arg(shie)
+        .output()
+        .expect("failed dirname");
+    let blah=Command::new("/usr/bin/ls")
+        .arg("-la")
+        .arg(format!("{}",String::from_utf8_lossy(&blah.stdout)).trim())
+        .output()
+        .expect("failed ls");
+    eprintln!("!! exitcode: !{}!",blah.status);
+    eprintln!("!! stdout: !{}!",String::from_utf8_lossy(&blah.stdout));
+    eprintln!("!! stderr: !{}!",String::from_utf8_lossy(&blah.stderr));
 
     match cmd.output() {
         Err(e) => panic!("couldn't run the test: {}{}", e,

@ghost
Copy link

ghost commented Jan 3, 2019

It looks to me that the string rust_doc shouldn't be hardcoded here:

https://github.com/rust-lang/rust/blob/140936307e692c324815c9640696b3e3f0c7ae78/src/librustdoc/test.rs#L332

but instead, it should somehow call find_crate_name from src/librustc_codegen_utils/link.rs perhaps not unlike how it's called in this place:
https://github.com/rust-lang/rust/blob/140936307e692c324815c9640696b3e3f0c7ae78/src/librustdoc/test.rs#L103-L105

But since I don't know how all of this works, hopefully someone who does could make the relevant changes in a rustc PR? if I'm even correct about the need for such changes.

EDIT: So it turns out, there already exists a cratename parameter, and for this failing case, the argument cratename has the value /tmp/mdbook-ROD0Lj/attribute/crate.md, hmm, useless I guess.
anyway, i give up - i don't know enough to dig any deeper

@QuietMisdreavus
Copy link
Member

Ah, this looks like a legit rustdoc issue. Thanks for investigating, @xftroxgpx! Looks like if a doctest sets its crate name with an attribute, it will fail for the same reason. I've opened rust-lang/rust#57317 on rustdoc itself to track the issue upstream.

kennytm added a commit to kennytm/rust that referenced this issue Jan 5, 2019
…r=GuillaumeGomez

rustdoc: force binary filename for compiled doctests

Fixes rust-lang#57317, needed for rust-lang/rust-by-example#1137

Right now, when building a doctest, rustdoc provides the compiler an output directory (a temp dir) but lets the compiler name the executable. If the doctest needs to be executed, it then tries to run a binary named `rust_out` from that directory. For the most part, this works fine. However, if the doctest sets its own crate name, the compiler uses that name for the output binary instead. This causes rustdoc to try to execute a nonexistent binary, causing the test to fail.

This PR changes the paths rustdoc gives to the compiler when building doctests to force the output *filename* instead of just the *directory*.
@QuietMisdreavus
Copy link
Member

Now that rust-lang/rust#57338 is merged, the next nightly that comes out should be able to run that test.

@ghost
Copy link

ghost commented Jan 5, 2019

I can confirm that's working(all tests pass) with the stage1&2 rustc that I'm currently still building

$ rustc -vV
!! LD_LIBRARY_PATH=/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:
!! Executing '/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build//x86_64-unknown-linux-gnu/stage1/bin//rustc' in pwd='/home/xftroxgpx' with args: '-vV'
rustc 1.33.0-dev (68fe5182c 2019-01-05)
binary: rustc
commit-hash: 68fe5182c967259ef89dbe313e4bf80f45a53e7e
commit-date: 2019-01-05
host: x86_64-unknown-linux-gnu
release: 1.33.0-dev
LLVM version: 8.0

$ rustc -vV
!! LD_LIBRARY_PATH=/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/xftroxgpx/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:
!! Executing '/home/xftroxgpx/build/2nonpkgs/rust.stuff/rust/rust/build//x86_64-unknown-linux-gnu/stage2/bin//rustc' in pwd='/home/xftroxgpx' with args: '-vV'
rustc 1.33.0-dev (68fe5182c 2019-01-05)
binary: rustc
commit-hash: 68fe5182c967259ef89dbe313e4bf80f45a53e7e
commit-date: 2019-01-05
host: x86_64-unknown-linux-gnu
release: 1.33.0-dev
LLVM version: 8.0

@frewsxcv
Copy link
Member Author

thanks all! master is building again https://travis-ci.com/rust-lang/rust-by-example/builds/97132791

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

2 participants